Kodi Community Forum

Full Version: Export music library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just realized that Kodi supports exporting its music library. This is fantastic and should give me album art in local file for each album, which is great.

I also noticed though one limitation on the wiki (http://kodi.wiki/view/Import-export_libr....2F_Import), which may be quite major:
Quote:Note: There are weaknesses in the way that Kodi determines the location of the artist directory. It looks for the folder that is common to all the songs with that album artist, the name of that folder is irrelevent. If you have multiple albums by an artist all under an artist folder then this works perfectly. However the algorithm does not work for collaboration albums, those that have more than one album artist e.g. "Riding with the King" by Eric Clapton and BB King, or classical music with composer, orchestra and conductor given as the album artist. It also gets confused when you have only one album by an artist, and takes the album directory as the artist directory. Also if you have not kept all songs by an artist under a unique folder, then the artist directory will probably be mis-identified. The result for export is that the artist.NFO file goes somewhere unexpected, and that location may not be unique, so the NFO will contain the artist information from the last album artist exported

If I understand this correctly, the artist.nfo is saved in the album folder in cases where I only have one album. Is there any chance to have a "fix" for this?
There are subtantial changes to the export of the music library for Leia fixing a number of issue, Krypton changes are of course frozen.

For export of art you need to be aware that it is the possibly compressed artwork that is exported, not the image in its original resolution. Take great care not to overwrite original higher resolution images.

As for the limitations described in the wiki. Export of artist.nfo in v17 and below depends upon each artist have a unique folder that contains their music and only their music. No other aspect of Kodi require that folders layout. Additionally here were some users that reported artist.nfo going unexpected places that was not explained by them having music by that artist in various folders leading to a shared common path with other artists. Sometimes this was when there was only one album by that artist, but I never satisfactorily managed to repeat or understand the issue. Given the redesign that has taken place I stopped pursuing that.

If your only folder layout concern is having artists with one album I would say export and see, but you do need to have all music files for an artist beneath one unique folder that contains no music by any other artists, or your nfo files for those artists will be confused.
Thanks for your message and great to see more changes to come with Leia.

All my artwork is embedded in the MP3/M4A file. Would exporting the library preserve the same size that it is embedded or would it compress it upon export?
It exports the image at the resolution held in the texture db. This is set as 720p for thumbs 1080p for fanart by default, but can be changed see http://kodi.wiki/view/Advancedsettings.xml (new value applies to subsequent new music). If your embedded art was bigger than this default or different w/h ratio then it will have been compressed, otherwise resolution is preserved.
Thanks for your reply. Not all embedded art will be in the texture db as the texture db only includes those that I have looked at or played in the GUI. That's actually exactly the reason why I'd like to export the library.

Does export library take the same resolution that can be found in the embedded file (even if it is not cached yet)?

And on related note, is there any command line item to run export library? I would like to automate it and would want to do this with a script outside of Kodi.
(2018-01-17, 01:57)steve1977 Wrote: [ -> ]Does export library take the same resolution that can be found in the embedded file (even if it is not cached yet)?
I don't know but somehow I doubt it. Try it and see. If you have no existing external art files to overwrite then there is nothing to lose.

On the otherhand if what you are trying to achieve is external copies of your embedded artwork then I would use Mp3tag, that can extract the exact images you have embedded.
(2018-01-17, 01:57)steve1977 Wrote: [ -> ]And on related note, is there any command line item to run export library?
Library export is availlable to both the Python interface see http://kodi.wiki/view/List_of_Built_In_Functions, and JSON API http://kodi.wiki/view/JSON-RPC_API/v6#Au...ary.Export
Thanks. Do I assume right that I would need to learn some basic python to get s script working to export music library from commmand line?
I don't think there is any way to do it from the command line, but you could create an "autoexec.py" script that would run when Kodi starts.

scott s.
if there was an autoexec.py, i could launch this from the command line? or put it into cron?

i would still need to know what to put into the autoexec.py file. can you share?
Autoexec method would require starting Kodi from the command line, then the script would run and leave Kodi running, so it would have to be stopped after some time (don't know it there is a way to determine if export has completed).

In doing some searching I see there is a Kodi test tool here:

I'm thinking that script could be modified to run the export command, but still not sure when to tell Kodi to quit safely.

scott s.