Kodi Community Forum

Full Version: Returning a path for artists
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was privately asked
hmann333 Wrote:How hard would it be to add a "file" or "path" property to the Audio.Fields.Artist object so that it can be returned with the AudioLibrary.GetArtists. This is something that appears to be in the Video.Fields.TvShow object which is returned by VideoLibrary.GetTvShows method and already appears to be present in the Artist.cpp model as strPath.
Looks like a simple JSON API question, but there are deeper aspects that are worth giving a wider public view.

My reply was:
Adding properties to the JSON API is not hard at all, but there are issues with this particular request and you need to say more about what you think such a property would contain and how you want to use it.

While historically for artist art Kodi assumes that all artists have a unique path beneath which  all their music is located, this often is not true. For example think of albums with more than one album artist i.e. collaborations, or classical music, having larger music collections split across multiple music sources, or artists that only apppear on compliation albums or as guest artist featured on albums by others. This is something I am reworking for v18, where all artists will have a single separate folder location for artwork, but related music can be in multiple other places.

Hence I think in future JSON API will be able to provide the folder for default artist artwork (and NFO files) if that is what you want, but that there is no such thing as artist path for the music.
hmann333 Wrote:Basically I'm searching for a way to selectively update the music library without triggering a full scan when music or artwork is added to a specific folder outside of Kodi. The idea would be to call to API to find the matching artist and trigger a library update for that particular folder/artist. Is it possible to do this currently without an added route/property?   

Firstly music files:
If you have a large music collection, or for some other reason want to speed up the time that library update takes to locate any new or changed music files and scan the tags then selective library update is available from file view. Simply navigate to the folder that you want scanned and click on "Scan to library" from the context menu when on that folder

That is via Kodi UI, however (like so many things) selective library update is not supported by the JSON API nor by the addon interface. Adding facility to trigger selective library update to the API is something I can add to my long todo list, but for most API consumers I suspect it is of little interest at the moment because of the current delete/insert approach to DB records. Since IDs are not fixed an update to some part of the library means that any remote duplicate of the library has to be resynced in entirity.

Artwork changes is slightly different.
Once Kodi has art (thumb or fanart) for something it caches it, also it only scrapes things that have not been scraped before. Hence getting Kodi to notice new art is often a manual affair - go to the info dialog and select the new art.  To be able to trigger replacing what is in the cache via the API is something to look at . But I suspect that gets on the "not going to get to this anytime soon" list just because I don't know enough about the thumbnail cache handling.

All I can say is that I am aware art management (for the music library) is not easy, and it sounds like that is where you would like changes, but I don't see how adding the return of an artist path to the API will help at all.

I want to say loud and clear the relationship between artists and folder path of related music files is many to many. Artists don't always have a unique path that contains all the music by them and only by them. Albums mostly will have a unique folder (it is not mandatory, Kodi will build a library of artists, albums etc. from a flat set of fully tagged files), artists don't necessarily have a physical storage location at all.

From v18 artists will have an "artpath", a unique folder (separate from where the music files are located) where Kodi looks for art (when it looks for art) and NFO for that artist by default. I think that addons like cdArt and skin helper service need access to the artist "artpath", so that user can have just one place for art not repeated stores for each addon. I hope that the authors of those addons (and any similar) will come and talk to me about it. But I don't think it will help you trigger anything productive when "artwork is added to a specific folder outside of Kodi".

I am currently working on music art API changes https://github.com/xbmc/xbmc/pull/13101 and https://forum.kodi.tv/showthread.php?tid=324170.  That enables the API to set artist artwork of any kind, perhaps that is useful to you? Rather than trying to trigger Kodi to refetch art based on folder, just set where the new art is?
Just out of interest, what would be the point of this request?