So I am sick and therefore grounded, and I decided this is the perfect time to finally clean up my mediacenter setup. A rambling geek post.
You see, I have a home server (based on Raspberry Pi + Raspbian + 3 TB of storage + NFS) where I store my movies and music. I have two Raspberry Pi based OSMC/Kodi setups in my living room and in my bedroom (and, soon, in my car… subject to further blogging). The bedroom setup is relatively new and so far the two boxes had two separate local libraries, and they were not in sync.
I now decided to rectify the situation and set up MySQL sync for my mediacenter libraries.
This is, supposedly, not very hard. You follow this guide, set up your central MySQL server (in my case: on the home server), amend advancedsettings.xml on the clients with the MySQL server setup, and boom, a wild sync appears.
In my case, it just didn’t want to work. Set up sync on one device, then the other one, and boom, no sync appeared whatsoever.
Reading the MySQL further I concluded there’s a version mismatch between my Kodi setups (there wasn’t), and that would somehow cause this issue. The big red disclaimer at the top of the page:
…confirmed my delusion. I thought: the one in the living room is years old, there must be a build version mismatch even though it’s supposedly up-to-date. And of course (Mistake One) I totally accepted my own assumption, being too lazy to validate it.
So, to bring them in sync, I decided to do another thing I have been planning for a while.
The Kodi box in the living room was rocking a Raspberry Pi 2 (that is the successor of a netbook based XBMC setup that I had put together many, many years ago), and an older version of OSMC. Now I decided to replace the Raspberry Pi 2 with a Raspberry Pi 3 (plus move the wonderful HifiBerry DAC+ from old to new), and installed the latest official build of Kodi, then copied over advancedsettings.xml for good measure.
At this point I had two, supposedly identical Kodi boxes, except one having HifiBerry and the other not. (That one has a USB speaker, which also means the other HifiBerry I have can go into the car.)
And of course, sync didn’t happen at all. So I (Mistake Two) started wildly googling “kodi mysql sync issues” and similar, being absolutely sure this was a Kodi bug, and not my own stupidity. And of course it wasn’t, and I only found advanced issues that people had.
At this point I finally cared to retrace my steps and opened the two advancedsettings.xml files on the two Kodi boxes in two separate terminals. And sure enough, one contained this:
<advancedsettings> <videodatabase> <type>mysql</type> <host>***.***.***.***</host> <port>3306</port> <user>kodi</user> <pass>kodi</pass> </videodatabase> <musicdatabase> <type>mysql</type> <host>***.***.***.***</host> <port>3306</port> <user>kodi</user> <pass>kodi</pass> </musicdatabase> <videolibrary> <importwatchedstate>true</importwatchedstate> <importresumepoint>true</importresumepoint> </videolibrary> </advancedsettings>
…and the other contained this:
<videodatabase> <type>mysql</type> <host>***.***.***.***</host> <port>3306</port> <user>kodi</user> <pass>kodi</pass> </videodatabase> <musicdatabase> <type>mysql</type> <host>***.***.***.***</host> <port>3306</port> <user>kodi</user> <pass>kodi</pass> </musicdatabase> <videolibrary> <importwatchedstate>true</importwatchedstate> <importresumepoint>true</importresumepoint> </videolibrary> </advancedsettings>
(Host address is of course correctly filled in both cases…)
Long story short: I missed 1 line, and created around 5 hours worth of extra effort for myself.
Learnings are of course:
- always validate assumptions, for example by reading more than half of the documentation, plus
- before googling, care to look through config and syntax, because sometimes the software contains less problems than your attention span.
On the positive side:
- I know have my Psych episodes’ watched status synced between my mediacenters, and
- I know have a Raspberry Pi 3 mediacenter in my living room (that I didn’t necessarily need, but it’s a Raspberry Pi one higher!)
So yay, synced mediacenters!