smoothquark 5 Posted June 22, 2024 Posted June 22, 2024 I have been trying to get to the bottom of the reason why deleted items still appear when using the API. I had 3 tracks for a sample folder that I had deleted which kept appearing, so I tried removing ALL my music folders. Although they longer appear on the Emby web interface, they unfortunately appear using the API (http://<server>:8096/emby/Items?api_key=<api_key>&Fields=Path,ProviderIds&IncludeItemTypes=MusicAlbum&Recursive=true). I have tried rescanning, vacuuming the database, compacting the database using DB Browser, deleting the music metadata folders etc, but this has not made a difference whatsoever. Obviously, Emby was stopped / restarted. The only thing I have not done is delete library.db and start all over again - afraid to do so as I have made changes to some of the metadata on my movies and TV shows. I tried creating a new music library and added a test folder with just a few albums. They all appear fine on the web interface and the API calls but so are the deleted albums, artists and tracks. Using ParentId of either the music library or folder within brings up tracks correctly but does not work for albums or artists. Using the Artists endpoint also brings up artists from the deleted albums. So, the API seems to be pretty useless currently. Is there a workaround to stop the deleted items from showing up on the API calls? My main reason for using the API was to try and write a script to correct some errors/inconsistencies on scanning.... 1. Piano Concertos nos. 1-5 by Sergei Prokofiev (MBID: 6cefe43e-b733-42fe-8f89-d157be945e43) Artists are shown as Сергей Сергеевич Прокофьев / BBC Philharmonic, Gianandrea Noseda, Jean-Efflam Bavouzet. Prokofiev is shown in Cyrillic as per MusicBrainz and looks like Emby does not support aliases to show the locale=en version. The other 3 are lumped together as one artist instead of 3 separate artists, although the MusicBrainz IDs are separated with a ";" in ffprobe and "/" inthe Emby metadata editor. Many of my classicals have the same issue. 2. Ultimate Kylie by Kylie Minogue (MBID: d6817148-ecaa-4a76-a9ad-ec7b10fedd29) Album name is shown as "Ultimate Kylie (disc 2)" under Albums and also for each track. Similar issues with other albums which are listed with multiple discs.
Luke 42077 Posted June 22, 2024 Posted June 22, 2024 Quote http://<server>:8096/emby/Items?api_key=<api_key>&Fields=Path,ProviderIds&IncludeItemTypes=MusicAlbum&Recursive=true HI, these aren't tracks, these are the linked album records. Try making this a user-specific request with a userId to match the web app.
smoothquark 5 Posted June 23, 2024 Author Posted June 23, 2024 8 hours ago, Luke said: HI, these aren't tracks, these are the linked album records. Try making this a user-specific request with a userId to match the web app. Thanks Luke. Yes, I was aware of that - I was using it as an example. Anyway, I have tried the following end-points: Music Albums: http://<server>:8096/emby/Items?api_key=<api_key>&Fields=Path,ProviderIds&IncludeItemTypes=MusicAlbum&Recursive=true "TotalRecordCount": 630 (shows previously deleted items) Music Artists: http://<server>:8096/emby/Items?api_key=<api_key>&Fields=Path,ProviderIds&IncludeItemTypes=MusicArtist&Recursive=true "TotalRecordCount": 3894 (shows previously deleted items) Music Tracks: http://<server>:8096/emby/Items?api_key=<api_key>&Fields=Path,ProviderIds&IncludeItemTypes=Audio&Recursive=true "TotalRecordCount": 173 (this is now correct) Using an Administrator User: Music Albums: http://<server>:8096/emby/Users/{admin_id}/Items?api_key=<api_key>&Fields=Path,ProviderIds&IncludeItemTypes=MusicAlbum&Recursive=true "TotalRecordCount": 8 (this is now correct) Music Artists: http://<server>:8096/emby/Users/{admin_id}/Items?api_key=<api_key>&Fields=Path,ProviderIds&IncludeItemTypes=MusicArtist&Recursive=true "TotalRecordCount": 91 (this is now correct) Music Artists: http://<server>:8096/emby/Users/{admin_id}/Items?api_key=<api_key>&Fields=Path,ProviderIds&IncludeItemTypes=Audio&Recursive=true "TotalRecordCount": 173 (this is now correct) So, yes, using Users/{admin_id} in the Items endpoint does bring up the correct ones, however, why does IncludeItemTypes=Audio works correctly without the Users/{admin_id} but IncludeItemTypes=MusicArtist and IncludeItemTypes=MusicAlbum does not? Perhaps these inconsistencies can be corrected / documented? That would help a lot! Also, it means that although albums have been removed from the library, it remains in the database. I am trying to see if I can get a list of these orphaned items through my script and perhaps use Items/Delete?Ids=... to delete them. I am hoping that this would "clean-up" the database.
Solution smoothquark 5 Posted June 24, 2024 Author Solution Posted June 24, 2024 I have been making progress with my script. The "orphaned" MusicAlbum and MusicArtist no loner appear when using the API. Deleting the orphaned items: (Note that I have already deleted the orphaned Albums on a previous test run) /emby-music.sh --server <server> delete_orphaned Authenticating Emby Server <server>:8096 API key: OK Checking Emby Administrator account: OK Retrieving All Albums: OK (8) Checking Albums without MusicBrainz Id: OK (0) Checking Albums possibly previously deleted (orphaned) done(8): OK (0) Retrieving All Artists: OK (91) Checking Artists without MusicBrainz Id: OK (0) Checking Artists possibly previously deleted (orphaned) done(3893): Failed (3802) Retrieving All Tracks: OK (173) Checking Tracks without MusicBrainz Id: OK (0) Checking Tracks possibly previously deleted (orphaned) done(173): OK (0) WARNING!You have requested to attempt deleting orphaned items from the music library.This may delete your actual files! ([y]es or [N]o): y Deleting orphaned items from Artists done(3802): OK Re-checking Artists possibly previously deleted (orphaned): OK Checking after the deletions: /emby-music.sh --server <server> check_orphaned Authenticating Emby Server <server>:8096 API key: OK Checking Emby Administrator account: OK Retrieving All Albums: OK (8) Checking Albums without MusicBrainz Id: OK (0) Checking Albums possibly previously deleted (orphaned) done(8): OK (0) Retrieving All Artists: OK (91) Checking Artists without MusicBrainz Id: OK (0) Checking Artists possibly previously deleted (orphaned) done(91): OK (0) Retrieving All Tracks: OK (173) Checking Tracks without MusicBrainz Id: OK (0) Checking Tracks possibly previously deleted (orphaned) done(173): OK (0) After vacuuming the database, library.db has reduced in size too! I shall now try to see if I can rectify the artists being lumped together and album names with discs issues next.
smoothquark 5 Posted June 24, 2024 Author Posted June 24, 2024 On 22/06/2024 at 21:22, smoothquark said: My main reason for using the API was to try and write a script to correct some errors/inconsistencies on scanning.... 1. Piano Concertos nos. 1-5 by Sergei Prokofiev (MBID: 6cefe43e-b733-42fe-8f89-d157be945e43) Artists are shown as Сергей Сергеевич Прокофьев / BBC Philharmonic, Gianandrea Noseda, Jean-Efflam Bavouzet. Prokofiev is shown in Cyrillic as per MusicBrainz and looks like Emby does not support aliases to show the locale=en version. The other 3 are lumped together as one artist instead of 3 separate artists, although the MusicBrainz IDs are separated with a ";" in ffprobe and "/" inthe Emby metadata editor. Many of my classicals have the same issue. An update ... looks like Emby requires the albumartists tag to correctly set up artists. Kodi has the same issue (https://kodi.wiki/view/Music_tagging#albumartists). The link suggests how to set up Picard to add this tag. This now works for me, but it would be helpful if Emby were just to pick up the MusicBrainz tags that it already supports and construct the album artists from there.
smoothquark 5 Posted June 24, 2024 Author Posted June 24, 2024 On 22/06/2024 at 21:22, smoothquark said: My main reason for using the API was to try and write a script to correct some errors/inconsistencies on scanning.... 2. Ultimate Kylie by Kylie Minogue (MBID: d6817148-ecaa-4a76-a9ad-ec7b10fedd29) Album name is shown as "Ultimate Kylie (disc 2)" under Albums and also for each track. Similar issues with other albums which are listed with multiple discs. Another update - I deleted my library once again and rescanned. I no longer get the (disc 2) added to the album name. Not sure if upgrading to Version 4.9.0.26 beta has helped. I shall do more testing. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now