Solved Path Substitution for sources.xml > Conflicting info
#1
I have been using multiple systems sharing the DB. In my recent updates across my systems (multiple LibreELEC systems), I noticed that all my sources had disappeared.

I had configured advancedsettings.xml to redirect the sources.xml file to a shared DIR on the server with the media but all the systems still had that file in the userdata folder.

Once I cleaned things up so that sources.xml was no longer on the client itself, I lost all sources in the systems.

Digging around, I noticed a flag on the docs (https://kodi.wiki/view/Advancedsettings....bstitution). It states, "Note: Path substitution for "sources" and profiles is broken, and will NOT be fixed." But on the Path Substitution main page (https://kodi.wiki/view/Path_substitution), it's announced that "Note: Path substitution for "sources" and profiles only works from v18.3."

Is this still broken in Kodi v20, or is the previous warning for an older version? 

If it has been fixed for v20, I think I ran into a bug, as the path redirect does not seem to be working.
Reply
#2
In my experience, path substitution works best on system network shares (not Kodi internal network links) that need no (direct) password verification, such as NFS.

I have path substitution for a couple of things in Kodi 20, in Ubuntu Linux but also with running LibreELEC, but I do not it for the sources.xml file.
I use a couple of system network shares on LibreELEC that are being created at boot time using the autostart.sh file.
Reply
#3
Hey @Klojum 

So all my media is on NAS shares. I have two x86 boxes and an RPi4. My intention was to have all of them have the same experience; that was the purpose of getting the MariaDB going again. 

Even with the path mapping for the sources.xml pointing to a share on the NAS, it seemed that Kodi ignored it and created a new blank XML with only the local TV and Movie folders present.

So I have to keep the sources.xml on each of the 'heads'. How can ensure that the sources on each head stay in sync, other than manually copying that over to each head whenever there is a change?

You mentioned NFS shares as a possibility for the path subs to work reliably. I've tried setting up NFS shares from my Synology and couldn't wrap my head around how that actually works (as in, it never did work, lol). I was keeping passwords.xml on each head, so they should have no problem accessing the share for the path substitution entries. But maybe that was me assuming how things work again, Doh!



Just to dream for a bit, a total long shot, I know, but I think it would be pretty awesome if there were a Kodi function that made it into either a server or a slave. You'd then flip a switch in the other Kodi heads to mirror what has been configured on the server. Addons (A tough one, I understand, all the different platforms, yikes), sources, skins, menu layouts, basically, all of it. Then all the admin is managed on the one 'server', and all the other heads are identical.

One can dream.......
Reply
#4
hey @Klojum 

So I looked into the autostart.sh file and what I could do there. I didn't know about that before now. I'll bet there's a lot of functionality that I am not aware of.

If I could ask one question though. I mounted a network share and tried storing sources.xml, mediasources.xml, and favorites.xml. Both systems now have the autostart set up and I've confirmed that the mounts are working.

I restarted one system and when my wife tried to play a video, the item was reported as missing and couldn't play it. I tried a library refresh but that sat at 'preparing 0%'. I then when and checked the files area and all the network mappings were gone. I had to re-add all the mappings back in for both TV and Movies.

I understood that the sources.xml and mediasources.xml files were where Kodi stores that information and that if they were edited, the changes would show up in the UI. But it appears that this is not the case. If those files are edited and the system rebooted, Kodi seems to freak out and flush everything.

Now, after adding those entries again, I didn't need to do a library refresh. It just started working again.

Could this behaviour be a sign that the path substitution is failing in some way? How could I confirm that Kodi is seeing those files and taking in the config from them?

Thanks in advance!

A.
Reply
#5
If your system mounts work, "everything" should work as far as Kodi or any other program on a networked computer goes. The autostart.sh file can execute commands just like on any Linux command line level, including network mounts.

LibreELEC can be quite fast in booting, and at times forget to initiate the network connection. That's why the "Wait for network" option needs to be enabled with a sufficient time-out value, and more so with wifi connections. With that option enabled, all system mounts via autostart.sh 'should be fine'™, and networked media should be present and playable. Double-check that the mounts are working in the System Information / Storage tab.

Kodi or LibreELEC do not 'flush files', or loose network mappings. If your network connection is up during the booting of LibreELEC, things will work.
Reply
#6
Sorry, maybe I was describing something wrong. What I mean was the media library sources were wiped. On both systems. All the thumbs were showing but anytime you tried t play anything, Kodi reported it was missing. I had to re-add the media sources for both movies and TV before anything would actually play.

Does Kodi not use either of those XML files to store that configuration? Is it stored somewhere else? Also, could leaving those files on each system in the userdata folder cause problems when using the path sub option?

I do have the wait for the network set up and the autostart.sh mounts the share just fine. Works like a charm!
Reply
#7
So, very interesting.

I rebooted one of the systems and again, all the media sources were gone. Everything.

I've checked those mounted shares by ssh into the system and checking the mount point. All working just fine. But Kodi didn't seem to like it.

I haven't checked the other system after a reboot as yet.
Reply
#8
(2023-03-27, 00:25)AGLyons Wrote: What I mean was the media library sources were wiped. On both systems.
"Wiped" in my book means deleted, gone. I take it (hope) that your video files are still there? It's just that sources are stored in the sources.xml file merely for backup reasons. Sources links are mainly stored in the video database for direct access. And nothing, other than the deliberate manual deletion by the user, should remove source entries. Unless you have ended up with a corrupted database. But having it happen on both your systems makes that a bit unlikely. I don't pathsub my sources.xml file myself though, and I also have not encountered that my sources just vanished in my shared mysql database.

(2023-03-29, 03:15)AGLyons Wrote: I rebooted one of the systems and again, all the media sources were gone. Everything.
Sounds like your boxes are haunted. I have no explanation for it at the moment. Although SDcard corruption could be another option. Again, on two setups at basically the same moment, is weird.

I have a RPi4B with some pathsubs and some system mounts, and it seems to be stable.
python:
# AUTOSTART.SH
mount -t nfs 192.168.1.101:/mnt/media/KODI/favourites /storage/favourites
mount -t nfs 192.168.1.101:/mnt/media/KODI/playlists /storage/playlists
mount -t nfs 192.168.1.101:/mnt/media/KODI/thumbs /storage/thumbnails
xml:
<pathsubstitution>
<substitute>
<from>special://videoplaylists</from>
<to>/storage/playlists/video</to>
</substitute>
<substitute>
<from>special://profile/Thumbnails/</from>
<to>/storage/thumbnails/</to>
</substitute>
<substitute>
<from>special://profile/favourites.xml</from>
<to>/storage/favourites/favourites.xml</to>
</substitute>
</pathsubstitution>
Reply
#9
@Klojum

I figured out the problem. Things don't work very well when you don't put the right file paths in config files!

All good, working like a charm.

PS, I also discovered that you can't create folders in /var/media/ and have it persist. It gets deleted on a reboot. I tried mounting to a folder there and it kept failing. Because the target kept getting deleted.
Reply
#10
(2023-03-31, 01:48)AGLyons Wrote: Things don't work very well when you don't put the right file paths in config files!
You don't say! Shocked

(2023-03-31, 01:48)AGLyons Wrote: I also discovered that you can't create folders in /var/media/ and have it persist.
That location in LibreELEC is on the read-only system partition. You can undo the read-only and then write stuff, but it will be overwritten with every LibreELEC update (or downgrade).
Reply
#11
Thread marked solved.
Reply

Logout Mark Read Team Forum Stats Members Help
Path Substitution for sources.xml > Conflicting info0