Setting up synced profiles between devices

Hi all,

This is nothing OSMC specific, rather than Kodi’s workings. But I find the group here always very knowlegdable and friendly, so I try here first.

I have 2 OSMC RPIs running and started playing with a central mysql database to keep watched status synced.

At the same time I wanted to use the same profiles between the two devices. So I set the profiles up nicely on the first device and thought about sharing it with the second. By my first attemps failed miserably. I copied userdata/profiles and userdata/profiles.xml. But that didn’t do the trick. I still had to setup all sources again and it started downloading metadata again.

So what am I missing? do I need to copy more?

My endgoal was to move the profiles info onto the server and mount them via nfs on the individual devices, hence keeping them completely synced. But for now I am already happy if I can get something correctly working by copying from device 1-> device 2.

If anyone has a better angle of attack to synced profiles between devices, I’m happy to hear it as well of course:-)

Regards,

Bert

Moving all user files to a central location is not supported by Kodi and I doubt in practice this would do much for you anyway. If you have the first device setup how you want then the easiest way would probably be to just clone the entire SD card. Alternatively copy the entire .kodi/userdata/ folder but make sure you stop Kodi first with

systemctl stop mediacenter

as some files will not be replaced otherwise (including guisettings.xml which holds the majority of your settings).

If your goal is to have the same metadata / pictures for each on both devices, I would download that metadata / pictures into each videos folder through a program called TinyMediaManager.

KODI will then start using that metadata instead of downloading that information from the internet. In this fashion, both systems will show the same information / pictures.

At one point, it was possible for KODI to have shared thumbnails but that proved to be impractical. KODI will now cache all the thumbnails / pictures on the local device.

Kodi has never recommended shared thumbnails folder and it has always had issues for people who did it anyway. Kodi does not require local art in order for multiple boxes using a shared MySQL db to have the same artwork. There is zero configuration needed for artwork to propagate and update to the various clients.

All I know is that when I create a NFO file with TinyMediaManager and have them download the artwork for the movie or TV show, KODI will then start using those thumbnails in their system. It is most likely because the NFO file has linked those thumbnails to my folder.

Kodi stores the artwork location in the MySQL db whether it is local or online. This artwork, again whether it is local or online, is then cached to the thumbnail folder. Every client will store its own cached copy regardless, and missing artwork on any client is cached on demand from the path stored in the MySQL db which is the same across these clients. No setup, no configuration, it just works.

The issue with trying to have a shared thumbnail cache is that this cache information is stored in a separate SQLite db which cannot be shared and which Kodi has no mechanism to remain consistent from client to client. You could copy an entire profile or just textures13.db and its matching thumbnails folder, but if you had multiple clients writing to a single centralized thumbnail folder then the various textures.db will not stay in sync so they will start overwriting each others files and cause incorrect art to start to show up.

You are correct darwindesign in how Kodi stores artwork and caches it for its use.

What I have found and tried to explain is this. By storing your artwork with the movie in it’s folder and allowing a media manager program to catalog it and create a .NFO file will allow KODI to use that artwork to scrap for its use.

It isn’t enough just to create the NFO file. The movie either (1) needs to be deleted and rescanned so the NFO file is read or (2) needs to be refreshed using local information to read the NFO file. This causes KODI to store the local paths in it’s textures.db and cache those in the thumbnails folder.

All that work, so each KODI instance has the same artwork and that is something that I wanted.

With a setup not using local art and a shared MySQL database the artwork chosen on any of the clients is stored as a url to the online source of the artwork. Any clients that try to access this art and it is missing will immediately just download it from the internet from the same place the scraping client did and then cache it. If any client changes the art it is automatically propagated to all clients. This mechanism is exactly the same if the art is local or online.

I’m not saying that using NFO files and local art is wrong. It has its uses in some setups to be sure. What I am saying though is that it is 100% not necessary for a shared library setup to keep the artwork in sync.

The following will sync a profile from one device to another (assuming you ssh in) (the --delete removes any files from device B that are not present on device A)

rsync -av --delete /home/osmc/.kodi/userdata/profiles/<yourprofile>/ osmc@111.222.333.444:/home/osmc/.kodi/userdata/profiles/<yourprofile>/

or, (if you run linux on your laptop) you can just do the whole thing remotely:
rsync -av --delete osmc@111.111.111.111:/home/osmc/.kodi/userdata/profiles/<yourprofile>/ osmc@222.222.222.222:/home/osmc/.kodi/userdata/profiles/<yourprofile>/

or, you can copy the entire userdata directory (copy all profiles, including the default/admin one)
rsync -av --delete osmc@111.111.111.111:/home/osmc/.kodi/userdata/ osmc@222.222.222.222:/home/osmc/.kodi/userdata/

note, you also need to have the same plugins installed on both devices (otherwise, you may find some things don’t work, because the plugin is missing), and some plugins store data in the plugin source directory, instead of the userdata addon_data directory.

you can, of course, sync that as well with
rsync -av --delete osmc@111.111.111.111:/home/osmc/.kodi/addons/ osmc@222.222.222.222:/home/osmc/.kodi/addons/

or, you can go all out and sync the entire kodi directory:

rsync -av --delete osmc@111.111.111.111:/home/osmc/.kodi/osmc@222.222.222.222:/home/osmc/.kodi/

Note that if you are copying from between different types of devices (osmc pi to a PC kodi install) your mileage may vary, due to differences in plugin versions that are available (or binary plugins you may have installed). especially, if you are running different kodi versions on the different devices.

If you copy /userdata/guisettings.xml from a RPi to a Vero it will sad face reboot loop. I’m not sure what happens if you try to go the other way or from a different platform, but it is probably a bad idea. You might be able to get away with that anyway though if you leave Kodi running as it will be written out from memory when Kodi exits overwriting anything that was put there.

ok, that one leaves me scratching my head… not sure what gui settings from and RPi would break a Vero… A resolution the Vero can’t handle?

No clue. I’ve not tried to answer that question as just deleting it and letting Kodi recreate from defaults has been a sufficient enough solve when it comes up.

You are also correct darwindesign. I have found that the artwork on internet sometimes changes and I would get different artwork on different devices. I solved that by using local media artwork that is downloaded through a media manager.

1 Like

Hello all,

Thanks for the replies and even the brainstorming.
At one point the question was about my goal.
I mainly want the profiles to by synced, so if you add a source on one device, it is also available on all others.

Within the profiles I want the library to be synced, so I have the played status of a series aligned between devices, so I can continue in the basement where I left off in the living room.

My setup is fortunately quite suited. I only have kodis on RPI3s at the moment. So all HW is identical. But that can change in the future of course. Also I am running the devices with an nfs root setup. So copying files over is as simple as logging into the NAS and copy from A to B.

Reading through the above and some other threads I found, I realized the current kodi architecture is not well suited for syncing or even copying profiles. In my case copying is doable, as the HW is identical here. But I won’t attempt sharing the userdata folder. Profiles are not changing often, so Worst case I have to copy them ones or twice again in the future.

Using a central mysql database is supported for media info, so I have that one covered now. So I can now indeed continue watching a movie or TV show on an other device.

For now I think this is the best I can do towards my goal of making the gui a bit netflix-like:-)

Regards,

Bert

I have now just copied the userdata directory from one kodi to an other and it seems to work. At leas I am in sync now:-) the profiles are not ver

Having the same sources on all profiles might only be important if you plan on scraping on all of them. Library items are stored as absolute paths so for a non scraping client you don’t need any sources at all. Regardless you can sync the sources.xml, mediasources.xml, and passwords.xml in the userdata or profiles folders at any point without shutting down Kodi and that should not pose any issue at all.

I second this. I do not do any scraping from my Veros. (or my android device). I run kodi on my file-server to do all the scraping into a mysql DB. (it’s a headless server, but I run a VNC session for things like that) Also faster scraping that way, since the file-server has direct disk access rather then going over the network)