Solved Update music library not working in Kodi 19.0-ALPHA1
#1
Previously, I could copy a folder of mp3 files into my music source folder, select Update library from the source UI, and Kodi would find and index the new files. (E.g., I have a folder for an artist, I copy a new album folder into that and Update.)

However, recently this stopped working, and I'm not sure why. I'm currently on Kodi 19.0-ALPHA1, compiled 4/26, and Ubuntu 18.04 Linux 4.15.0-48-generic on x86_64. I update Kodi often, so I'm not sure exactly when this stopped working, sorry.

I also tried Scan item to library from the source context menu — no change.

I've checked the Event log, but I don't see anything about problems scanning the music library.

Is there some way I can generate a more detailed log file on the server HDD, to try and diagnose this? I poked around in the UI and on the wiki, but I can't figure this out.

Any other suggestions?

Thanks!
Reply
#2
You can follow the Basic method to create a Debug Log then upload it to Kodi Paste Site and provide the link.
My Signature
Links to : Forum rules (wiki) | Banned_Add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create_Music_Library (wiki) | HOW-TO:Create_Video_Library (wiki) || Artwork (wiki) | Basic_controls (wiki) | Import-export_library (wiki) | Movie_sets (wiki) | NFO_files (wiki) | Quick start guide (wiki)
Reply
#3
Yeap, debug log needed. There have been no music library scanning changes in recent months, nothing different in v19.

With nothing to go on I have 2 wild guessess of things to look at
a) the name of the new folder begins with a "." - Kodi ignores anything names like that
b) something wrong with folder/file permissions

but at this point who knows.
Reply
#4
I had been running 20190425 for testing purposes and found no problem with music library scans. I've reverted to Leia for the moment, though, since Matrix broke my PVR client.
Reply
#5
(2019-04-27, 05:59)Karellen Wrote: You can follow the Basic method to create a Debug Log then upload it to Kodi Paste Site and provide the link.

Hey, thanks much! My log file is here:

http://paste.ubuntu.com/p/VQ.../

I restarted, tried Update library and then Scan item to library, so those actions should be in the log file.
Reply
#6
@mrob I can't see anything going wrong in the log. The subfolders under /media/mroberts/kinuta-2018-01/Music 01/ are checked, the hash compare of folder size and timestamp between now and the previous scan into libraray find no changes so no deeper scanning is performed.

Where are the new mp3 files located?  Can you navigate to them in file view? Is the folder shown in the log file?

I'm trying to think of ways the files could be added and yet the hash check on folder not see a difference.

Of course when you click scan item to library on the context menu it should you ask you if you "Do a full tag scan even when music files are unchanged?", you could answer yes and everything gets rescanned regardless of the hash check seeing no changes. But I would like to know why new files are not picked up.
Reply
#7
@mrob The scanning process seems to be correct, maybe it's a database error. You could try to temporarily rename the MyMusic72.db to something else so it gets recreated at the next scan (exit Kodi before renaming). If it's not too big you could also upload it somewhere, maybe someone could take a look.

Also check that the copying process hasn't changed and that all permissions are created correctly in the destination.
Reply
#8
(2019-04-27, 13:15)HeresJohnny Wrote: @mrob The scanning process seems to be correct, maybe it's a database error. You could try to temporarily rename the MyMusic72.db to something else so it gets recreated at the next scan (exit Kodi before renaming). If it's not too big you could also upload it somewhere, maybe someone could take a look.

Also check that the copying process hasn't changed and that all permissions are created correctly in the destination.
Thanks for the speedy replies!

I looked through the log myself and noticed this:
Quote:2019-04-27 19:44:58.194 T:140334932641536 ERROR: GetDirectory - Error getting /media/myAlbumDir/ ...
I then checked the folder that was provoking the error, and indeed as DaveBlake suspected, the permissions were wrong: no read access! (Not sure how this happened, but that's another story.)

So I fixed the permissions, tried Update library again, and rebooted. I look at the new log file and now it says...
Quote:DEBUG: DoScan Skipping dir '/media/myAlbumDir/' due to no change

So it looks like maybe I need to rebuild the music database(?), but I'm a little confused that the files were skipped when I re-updated the library, even though they couldn't be accessed last time.

What if I use touch to update the file's access times and then update again — would that sync the database?
Reply
#9
Try the new database suggestion first but make a backup of the old database.
Reply
#10
So it was permissions...

(2019-04-27, 13:34)mrob Wrote: So it looks like maybe I need to rebuild the music database(?), but I'm a little confused that the files were skipped when I re-updated the library, even though they couldn't be accessed last time.

What if I use touch to update the file's access times and then update again — would that sync the database? 
Nothing so dramatic as a rebuild needed, simply try the touch approach and change the timestamp.

Failing that try scan item to library from the context menu and when it asks you "Do a full tag scan even when music files are unchanged?", answer yes and everything gets rescanned regardless of the hash check seeing no changes.
Reply
#11
(2019-04-27, 13:50)DaveBlake Wrote: So it was permissions...
(2019-04-27, 13:34)mrob Wrote: So it looks like maybe I need to rebuild the music database(?), but I'm a little confused that the files were skipped when I re-updated the library, even though they couldn't be accessed last time.

What if I use touch to update the file's access times and then update again — would that sync the database? 
Nothing so dramatic as a rebuild needed, simply try the touch approach and change the timestamp.

Failing that try scan item to library from the context menu and when it asks you "Do a full tag scan even when music files are unchanged?", answer yes and everything gets rescanned regardless of the hash check seeing no changes. 
Yeah, I'm trying to sort out the permissions now. What exactly is expected? I assume(?) just read access for the music files, but I'm also seeing this error in the log for a bunch of my movie files:
Quote:ERROR: GetDirectory - Error getting ...

Are there other problems during scanning that can raise this error?

Thanks!
Reply
#12
(2019-04-27, 14:04)mrob Wrote: Yeah, I'm trying to sort out the permissions now. What exactly is expected? I assume(?) just read access for the music files, but I'm also seeing this error in the log for a bunch of my movie files:
Code:
ERROR: GetDirectory - Error getting ...
Are there other problems during scanning that can raise this error? 
Folder and file read access should be sufficient for tag scanning. If you want to export albums or artists to nfo files then you will need folder write access too. Not so sure about the video library needs, but would expect similar.

Access is the normal cause of that error message, because the folder/files are locked, lack permissions or do not exist.

Could be a secuirty issue with how the storage is mounted. I'm a bit vague on the details, but Kodi can only access files on sources that you have added and needs the name/url it is using to access the files to match exactly the mounted source. But I have only seen that issue with JSON API access to art, not during scanning.
Reply
#13
Thanks for the clarification. After some fiddling with permissions, I managed to eliminate all the GetDirectory errors.

I used recursive chmod -R to change everything at once, and discovered that it's necessary to do chmod -R a+x, because +x grants access to directories and there are subdirectories for albums inside the artist-name directories, or for the movies there are subdirectories like /VIDEO_TS.

But it seems a bit odd to have all my mp3s and mkv files marked executable. Hmm.

I wonder if somebody has written a shell script to fix up correct permissions for a Kodi media source...?

EDIT: I wrote a simple shell script for fixing up file and directory permissions. It takes as a parameter the directory path of the source:
Quote:#!/bin/bash

find "$1" -print | while read each; do
  if [ -d "$each" ] ; then
     chmod 755 "$each"
else
    if [ -f "$each" ]; then
        chmod 644 "$each"
    else
        echo "$each is not valid";
        exit 1
    fi
fi
done
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Update music library not working in Kodi 19.0-ALPHA100