Updating music library isn't working as expected
#1
I have Kodi installations on multiple devices, some on Android and some on Windows 10 and 11. All my media sources are pointing to the same NAS location, using the local network IP address, like "smb://user:[email protected]/Music" and that's exactly the same for all my Kodi installations. I'm using MySQL for my libraries. That MySQL server is also running on the same NAS device, which is some old PC running TrueNAS OS.
I have some network shares set up on my Windows 11 machine, to prepare my music files the way I like them, with album arts etc. The same location that is listed as media source in Kodi as "smb://user:[email protected]/Music" is mapped as a network M: drive on my Windows 11 PC, as "\\192.168.1.10\Music".
Here is the problem that I see:
If I scan for new music using Kodi on Windows 11, it's finding all new music files properly and I can play them on that Windows PC, but my Android devices are skipping over each newly added song without playing a single one of them. I knew that this means the file location wasn't found, so I connected my MySQL client to see what went wrong. Somehow the Windows PC didn't recognize that there is already a registered path to the folder I'm scanning (which was registered as "smb://freenas/Music/Artist"). My Windows PC added "M:\Artist" to the path table and linked all newly scanned songs under that new path ID. I don't have any reference in my Kodi installation to the "M:\" and I have no idea why the scan did that. Obviously, my Android devices don't have the "M:\Artist" as the accessible path, so they can't play those songs. After updating path references in the song table to use the old "smb" path id (using MySQL client), all my devices can now play those songs, including the Windows 11 PC that caused the problem in the first place.
I'm OK with IP address being converted to the computer name, like "192.168.1.10" being changed to "freenas" (although I don't see the need for it), but I can't see why would a network-friendly media location path be converted to the one that's local to a single machine.
I will say again that all my Kodi installations have the exact same settings in their XML files. My Windows installs are using Kodi in a portable mode.
I'd love to scan my libraries using much faster device, but for now I guess I'd have to do my scans using Android devices.

My question is: Is this local path saving logic something that can be changed somewhere in settings or setting files (and I missed it), or is this one of those "unwanted features"?
Reply
#2
When you write "registered" I assume you mean sources.xml <source> has a child?
xml:
<path pathversion="1">smb://freenas/Music/Artist</path>

I don't know, but assume that it is hard coded to call the win32 api to get the mapped local drive instead of the network UNC.  But I don't know if that is the design either or unintended.

scott s.
.
Reply
#3
When I wrote "registered" I meant there is already a record in the path table with the network UNC, like "smb://freenas/Music/Artist" in the strPath field, but the scan from Win11 Kodi didn't recognize that and added "M:\Artist", even though both records are pointing to the same network folder.
My sources.xml file has a line that says:
Code:
<path pathversion="1">smb://192.168.1.10/Music/</path>
which is the root folder for my music files. Each artist has a separate sub-folder under that folder, with music files sorted by albums. I've entered that source using the actual static IP address because I wanted my albums/songs to be playable on any OS and any device on the network, without the need for the computer name to be translated into the IP address.
That path should be a starting point for scans and each path that contains some songs should be saved to the path table using the syntax "source path/subfolder/" if that subfolder contains some media files. There is no need to translate that into "smb://freenas..." or "M:\...", because everything works nicely when only IP addresses are used.
I already mentioned that I'm using Kodi with MySQL database, and that's the info I've gathered when I accessed the server and Kodi databases using one of the MySQL clients.

This problem is not visible only from devices with different OS - it's visible between Windows PCs as well. Let's say that I added a few more songs to my network storage and now I want them added to the library. This time I'm using Windows 10 PC, which has that same sources.xml as the Win11 PC. That same Music folder in mapped on Win10 PC as a network E: drive (not M: drive). All songs will be added with the path starting with E:\ and that path will have a different path ID, even though there is already a record with the path to that artist that starts with M:\ . Since my Windows 11 PC has a drive letter E: used for a local SSD partition, I won't be able to play any of these songs on that PC. In fact, they won't play on any other devices, except on the device that scanned those songs into the library.

IMHO this is a bug and a pretty big one, which could make the whole idea of using MySQL server/database pretty much pointless.

I'd be happy if someone says that I've missed some settings that already exist in Kodi. Please tell me they exist, I don't want to run MySQL statements each time I scan something new to my library Smile
Reply
#4
I have saved my record collection in mp3 format on a USB stick and mounted on max2play/Raspi 
/dev/sda1 16GB 54% /media/usb0
on the Kodi remonte I can play all the items
in the Kodi Log's all the items has "Fehler beim Scannen von Album:"
so on each start the indexing-procedure is running
in Systeminfo/network Internet is connected
Reply
#5
Obviously if you didn't map your smb folder to a drive letter then there would not be an issue, but I can see where you might want to do that mapping.

I think you are correct in using IPv4 address, not name, in setting up the SMB share (assuming you want
IPv4 addressing) to avoid ambiguity.

I tried to look at the code and I'm not sure if Kodi tries to get the actual SMB UNC from the Windows api when you have mapped it to a drive letter in Windows.  Agree that that would probably be better from a design viewpoint.

scott s.
.
Reply
#6
I think Kodi should use whatever format user enters in the media source and that should be the starting point for the path, followed by the folder name where media files exist.

If user has only one Windows PC with Kodi, or if they plan to map a network share on all Windows PCs to the same drive letter, they can enter media source with that drive letter (e.g. "M:\Music").
If they have their network setup to frequently change IP addresses, they would probably want to enter the source with the computer name ("smb://computername/sharedfolder") and rely on all devices being able to discover the current dynamic IP of the storage location that way.
If they configured their network to have all media servers use static IP addresses, they would enter the source with the IP address of their storage device(s) ("smb://192.168.1.10/sharedfolder").
In each of these scenarios the actual path from the media source is used to save path to all songs, art etc. and all media files should be accessible every time for that given scenario.

IMHO, there should be no need to obtain any type of converted path from the OS. Simply read each media source path and add currently scanned folder if it contains media files of that type.

I don't remember that being an issue in earlier versions of Kodi, but that could be just me and my bad memory.
Reply
#7
Kodi on Windows just hooks into the native Microsoft provided SMB services, so it could be that MS have change something in how drives are reported in Windows 11.
Reply

Logout Mark Read Team Forum Stats Members Help
Updating music library isn't working as expected0