Jump to content

Recommended Posts

Posted (edited)

I tried to change the Content Type of an existing library on Emby server installed on Synology. I followed the guide here: https://emby.media/community/index.php?/topic/99927-how-to-change-the-content-type-for-a-library/, but Synology stores libraries in an SQL database, so the process is not as straightforward. Therefore, I’m sharing the procedure that worked for me. I hope that it hepls someone.

- Turn off the Emby server

- Connect to NAS by SSH

- Navigate to the directory:   

cd /var/packages/EmbyServer/var/data

- Set correct permissions:    

sudo chmod 664 library.db
sudo chmod 775 /var/packages/EmbyServer/var/data/

- Create a backup of the database:

cp library.db library.db.bak

- Open the database tool:    

sudo sqlite3 library.db

- List the tables:

  .tables

- Libraries are stored in the table `MediaItems`.

- Get the column names for the library table:    

PRAGMA table_info(MediaItems);

- Select data based on the name of the desired library (focus on entries with an existing `Path`):  

SELECT Id, Name, Path FROM MediaItems WHERE Name = 'LIBRARY_NAME';

- From the selected record, take the ID.

- Select additional settings for the library based on the ID: 

SELECT * FROM ItemExtradata WHERE ItemId = ID;

- It will show that one column contains JSON data with settings, including the `ContentType` value.

- Valid `ContentType` values:  
  - Audio books: `"ContentType":"audiobooks"`  
  - Camera Uploads: `"ContentType":"homevideos"`  
  - Collections: `"ContentType":"boxsets"`  
  - Home videos & photos: `"ContentType":"homevideos"`  
  - Movies: `"ContentType":"movies"`  
  - Music: `"ContentType":"music"`  
  - Music Videos: `"ContentType":"musicvideos"`  
  - Playlists: `"ContentType":"playlists"`  
  - TV shows: `"ContentType":"tvshows"`  
  - Mixed content: `EMPTY` (no `ContentType` key)

- Update the `ContentType` to Mixed content (original value is `ORIGINAL_CONTENT_TYPE`): 

  UPDATE ItemExtradata SET Value = REPLACE(Value, '"ContentType":"ORIGINAL_CONTENT_TYPE",', '') WHERE ItemId = ID;

- Alternatively, update `ContentType` to a new value (`NEW_CONTENT_TYPE`) (original value is `ORIGINAL_CONTENT_TYPE`):  
  

UPDATE ItemExtradata SET Value = REPLACE(Value, '"ContentType":"ORIGINAL_CONTENT_TYPE"', '"ContentType":"NEW_CONTENT_TYPE"') WHERE ItemId = ID;

- Exit the database tool: 

 .exit

- Delete the database backup: 

sudo rm library.db.bak

- Start the Emby server

- Run the "Scan media library" task

Edited by Raldes
  • Like 1
  • Thanks 1
Happy2Play
Posted

Yes this was a change in 4.8 moving to db only information making existing Emby-Server\programdata\root\default obsolete and new installs will not have this location.

But you could have done the same thing via the api by Get /Library/VirtualFolders/Query to get the library payload

image.png.bbf3f2fe20b604bdecd6f67f81807441.png

Then make your changes then POST /Library/VirtualFolders/LibraryOptions the payload

image.png.db771c7f413885b67ce7cc6e97ead2a9.png

Steps somewhat covered here.

https://emby.media/community/index.php?/topic/127031-createrestore-collections-library-on-new-install

 

But either method you will need to go to the library setup afterwards and verify setting as the entire template will change per changing the content type.  So you have to verify the entire library setup options.

 

 

  • Like 1
  • 2 weeks later...
simonmason
Posted

This seems like it should be much easier.  Though the UI perhaps?

Posted
42 minutes ago, simonmason said:

This seems like it should be much easier.  Though the UI perhaps?

Hi, yes that’s something we should look at.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...