Using a human friendly folder structure and multiple music sources
#1
Kodi v18 supports users having a more human friendly folder structure for their music files.  This thread presents what the benefits of that are - why you may want to make use of it , and suggestions for moving to it - how to use it.

But let's be clear from the start, changing music folder layout is not compulsory.  If you have a modest or simple music library and are happy with what you have then it is fine to stay as you are.

If you have hit issues with local artist art e.g. have albums where artists collaborate (multiple album artists), want art or NFO for guest artists or other musicians etc. or just don't want images and NFO files mixed in with your media files, then you want to make use of having an Artist Information Folder (AIF) see Artist_information_folder (wiki). This is a new feature in v18, and a more flexible and robust way to handle artist art etc. so I encourage users to consider switching to it,  but you can still leave the music files themselves in whatever folder layout you used for previous versions.

However if you would like to reorganise your music files in a more human friendly way than a strict artist/album structure, and be able to browse and filter the library based on that arrangement then read on.

If you are a beginner wondering how best to organise things before using Kodi for the first time, then group your albums under folders in a manner that makes sense to you, and put artist art in correctly named folders an AIF.  Reading Music_tagging (wiki) is the place to start, but you may find what is said here about filtering using multiple music sources interesting

History and limitations of Previous Versions
Kodi could always make a library from properly tagged music files regardless of how they were arranged, even if they were all in one flat folder, but support for local art and NFO for both artists and albums depended on a precise artist/album folder structure. Names of folders and files did not matter at all, but the files for an album need to be gathered in a unique folder, and all the albums by an album artist and only that album artist had to be under a unique folder. This led to users having an artist/album folder layout for their music files, and frequently just one music source being added (the top of that folder layout).

Having a folder for each album is an easy and obvious thing to do, with possibility for sub-folders for each disc should they have different disc art. But there are numerous situations where that exacting artist folder arrangement is impossible, as anyone with classical music (where the album artists are composer, conductor and orchestra) or other collaborative albums will know. Also users with larger music libraries and thousands of album artists often want to split them by other criteria e.g. genre, or perhaps put their kid's or spouse's music separately from their own, and artists may figure in more than one category. Arranging albums by album artist is not always the optimum human friendly way.

The other limitation of Kodi before v18 is that only album artists can have local art and NFO files. Artists that don't have albums but just appear as featured guest artists on songs on albums by others, or on various artist compilations, or those that contribute to the music in other ways e.g. producer, composer, lyricist, or musicians etc., they can not have local art or NFO to provide information. Some art addons would create additional folders for these artists mixed into the artist/album layout, that could result in hundreds of extra folders that didn't have music in them.

Why Change To A Different Music Folder Structure
The big reason to change your music folder structure is to be able to easily filter artists, albums and songs based on some user devised way of categorising your music.

This is best explained by an example, my own real life use. I have a music library of 2000 albums the majority popular music of some kind or other but 200 albums of classical music, 75 of classical/spanish/folk guitar,  50 soundtracks and film music, 80 Jazz (I rarely am in the mood to listen to) and a few albums that I ripped and probably will never listen to again but since I ripped them they may as well be in my library as long as they don't get in the way.  For my sanity music from each of these categories is under a separate folder e.g. "Popular", "Classical", "Guitar", "Soundtrack", "Jazz" and "Junk", often (but not always) with the albums in folders beneath some kind of artist folder.

Before v18 I only added the popular music to my music library, because I could not stand the mess of having classical composers, conductors and orchestras, jazz musicians and pop artists all jumbled together in the artists node. I could fix some by filtering by genre, but there were lots of crossover artists in more than one category. There were also numerous collaboration albums which made local artist art impossible too.

In v18 I have added each of these 6 category folders as a separate music source. I can now start my browsing from the Sources node, pick a source and just see that artists on the music in that category, or the albums or songs etc. I can also use this filtering  in both smart playlist rules and in the sideblade filter option. Click here for explanatory images

Filtering by source is even better when using Yatse on a phone or tablet to control my music playback (which I often do since I listen with TV off). It supports common filtering by source across all music library views  - artists, albums, songs, genres and even the overview screen. I pick a source, usually "Popular", and all the other music is nicely hidden until I want to see it. And of course if I ever want to see everything then I can.

Simply making a folder moving the music files into folders beneath that and then adding it as a music source is a more user friendly way to adjust the way music is categorised at the highest level than changing music file tags or editing NFO files. My wife and I share similar music tastes and there are no kids at home, but I'm sure many of you have other people using Kodi with you and different music tastes. This gives you an easy way to split that up too, and still be able to search and see the entire library easily as well.

How to change to a different folder structure
1. Export Song Playback History
Assuming that you have at least some of your music in the library and want to keep playcounts, user ratings and last played date then you want to export this data.
  1. From Settings>Media>Library scroll down to the music library section
  2. Click on Export Library,
  3. Choose kind of export: "Single file"
  4. Select the Destination folder of your choice: (A single file will be created in the form of kodimusicdbYYYY_MM_DD.xml)
  5. Items to export: "Songs"
Making a note of the actual output filename, there is nothing in the name to indicate that is contains song history data.

For more information see: Music#Single_File (wiki)

2. Export existing additional album information and art
Assuming that you have scraped additional album information and art then capture that data to avoid repeating the requests to remote servers etc. to get it again and of course loss of any manual art selection you may have made.  Also since you will be moving files and folders local album art may also end up in a different place,  Kodi will automatically pick this up from the album folder when the library is repopulated.
  1. From Settings>Media>Library scroll down to the music library section
  2. Choose kind of export: "To library folders"
  3. Items to export: "Albums"
  4. Output information to NFO  files: enabled
  5. Include artwork such as fanart and thumbnails: enabled
  6. Overwrite existing files: disabled
Export creates image files at the resolution Kodi uses and caches them. If you have higher resolution local album art then you will need to take care that overwrite is disabled avoid export overwriting it.

This step will create album.nfo files and art in the current album folders, ready for Kodi to pick-up automatically when the library is repopulated once the music files are moved. However those users wanting to avoid creating album.nfo files, and already having album art as separate files can use export to single file instead as described in the previous step by adding to the setting Items to export. The resulting xml file of album data can be imported later.

For more information see: Music#To_library_folders (wiki)

3. Export existing additional artist information and art
Since you will probably no longer have all the music by and artist and only that artist under a unique artist folder, you will need to start using the  Artist Information Folder approach to local artist art and nfo files. You could manually move existing local artist art and NFO files into correct folders in the AIF, but it is simpler to let export do this for you. Also, as with albums you want to capture any information or art previously scraped from remote sources.

Nominate a folder to be your AIF under Settings>Media>Music see https://kodi.wiki/view/Settings/Media/Music#Library. This can be located anywhere, including with the music files, but since you may have music by an artist in several locations and the AIF is sensitive to artist folder names (while the rest of Kodi is not)  it is better if it is a separate location to the music files.
  1. On Export Library dialog enter
  2. Choose kind of export: "To library folders"
  3. Items to export: "Album Artists"
  4. Output information to NFO  files: enabled
  5. Include artwork such as fanart and thumbnails: enabled
  6. Overwrite existing files: disabled
This will create a folder in the AIF for every album artist that has additional information or art, and artist.nfo and images files within each folder.
Again export creates image files at the resolution Kodi uses and caches them. If you have higher resolution local artist currently located in the artist/album folder structure art then you will need to manually move this to the correct artist folder in the AIF.

The steps in this section and the previous section can of course be combined by selecting items to export of "Album Artists, Albums", but I know that some of you will want to be monitoring the outcome of each step. If you have set art for song artists (manually, via JSON or using an artwork  addon) then this can be captured too by selecting items to export of "Song Artists".

For more information see: Music#To_library_folders (wiki)

4. Drop the music source(s) and deep clean the library
Data captured, time to clean out the music library. Although there are some manual tricks you can use when you move music files, the kind of file/folder reorganisation you are doing it is best to simply wipe the library, move the files, and then repopulate it scanning tags and scraping from NFO files. It may take some time, but it is worth it.
  1. From file view select the music source, and on the context menu click on "Remove source". When asked if you want to remove all items within this path say yes. Repeat for all music sources that you are effecting by moving files.
  2. Clean the music library, removing any orphaned entries, from Settings>Media>Library, take care to scroll down the screen to the music library section before clicking on "Clean Library".
  3. Close Kodi
At this point you may also want to use the texturecache utility to clean up your textures db and thumbnail cache as well.  Rebuilding your library may result in cache bloat for the moved art, which those that like to keep a tidy system (or have limited storage) will want to manage.

For more information see: Update_Music_Library#Remove_Source (wiki)

5. Move your music files
Rearrange your album folders into a layout that makes sense to you.

6). Rebuild your music library
  1. Start Kodi and in Settings>Media>Music enable "Fetch additional information during updates" which will ensure the album and artist nfo files are read.
  2. Add new music sources for your newly partitioned music folders and each time  say "yes" to scanning into library
This will scan the tags, remaking the music library entries and then scrape the NFO files for additional artist and album information.

7. Import Song Playback History
Finally restore the original song user ratings, playcount and last played date by importing the xml file created in step 1. From Settings>Media>Library scroll down to the music library section and click on Import Library, then select the xml file.

Opps I Nuked My Library!!
Well doing major moves like this it is a risk. Make backup copies of your userdata files especially MyMusic72.db, and take care with precious art or NFO files. I promise that Kodi will not overwrite art or NFO files unless you tell it to do so, and if will never change your music files, but users can make mistakes.
Reply
#2
(2019-07-12, 10:50)black_eagle Wrote: Is there a 'best practice' method for moving from an artist/album structure to something better ?  I'd like to take advantage of all the work you have put in and split my music up differently in the future but the original library db was built probably with V15 and has only been upgraded through Kodi upgrades.  Everything is tagged with Picard and already has existing art and nfo files alongside the album tracks. Feel free to spin this off into a new thread if you feel it warrants it, or just point me to a link where you may have gone through all this before Big Grin

Well here you are @black_eagle as promised.

This content may get edited or eventually moved into a separate guide, but questions and feedback from users is welcome on this thread. If someone would like to test out the procedure  that would be great too.
Reply
#3
A HUGE thanks Dave !! I'm following your guide and currently in the middle of exporting all the albums into one file.  I see no point in exporting art I already have.  Oh, the joy of flexibility !!!
Learning Linux the hard way !!
Reply
#4
Yes, also why I gave album and artist steps separately, you can choose to skip album art or NFO if you already have them.

It maybe too late, but in this case you probably want to leave "Fetch additional info on update" disabled. Then scan tags but not scrape, so you can import the album xml export, and then use "query info for all" on the context menu of the artists node to scrape just the artist.nfo

I'll be interested how you get on.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Using a human friendly folder structure and multiple music sources00