Jdiesel 1497 Posted 41 minutes ago Posted 41 minutes ago I'm developing a music metadata plugin that fingerprint-identifies tracks via Chromaprint/AcoustID and assigns MusicBrainz IDs. After identification, I set MusicBrainzAlbum ProviderId on individual Audio tracks via SetProviderId + LibraryManager.UpdateItem. This works — the ProviderIds persist correctly. However, the AlbumId field (the foreign key linking Audio items to their parent MusicAlbum) is not being updated. Tracks identified after the initial library scan have AlbumId=NULL in the database, even though they now have MusicBrainzAlbum ProviderIds. This means only some tracks appear under their MusicAlbum in the Emby UI. What I've tried: 1. LibraryManager.UpdateItem(track, track, ItemUpdateType.MetadataDownload, opts) — persists ProviderIds but does NOT write the AlbumId column 2. LibraryManager.UpdateItem(track, track, ItemUpdateType.None, opts) — same, AlbumId not written 3. Setting track.InternalAlbumId = album.InternalId before UpdateItem — UpdateItem does not persist InternalAlbumId 4. Setting track.InternalAlbumId and calling ItemRepository.SaveItem via reflection — SaveItem resets InternalAlbumId back to 0 after saving (appears to reload from DB) Context: - The MusicAlbum items exist as virtual items (created by Emby during the initial scan) but have empty Path values - Tracks have ParentId pointing to a Folder (type 3), not the MusicAlbum (type 12) - Only tracks that had MusicBrainzAlbum in their file tags at initial scan time got AlbumId linked; tracks identified later by the plugin did not - A subsequent library scan does not re-evaluate AlbumId for existing items Question: Is there a supported API to update the AlbumId of an existing Audio item from a plugin? Or is there a way to trigger Emby to re-evaluate album linking for tracks that now have MusicBrainzAlbum ProviderIds but AlbumId=NULL? I'd prefer not to use raw SQL or delete/re-create items. Any guidance would be appreciated.
Luke 42992 Posted 29 minutes ago Posted 29 minutes ago HI, you don't worry about the album object. you just set the values on the track - album, albumartist, external ids, and when you save the track, the core server will take care of the rest.
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