2022-06-30, 22:20
(2021-04-13, 21:15)BigMong Wrote: Database Version 119 [aka Matrix]Hi BigMong
This has been tested with MySQL Server Version 8.X I don't know if this will (it should) work with lower versions.
Please Note:
Lower Versions or MariaDB 10 you will need to change the Character Set and Collate.
Within each file do a find and replace in this order;
utf8mb4_0900_ai_ci -> utf8_general_ci
utf8mb4 -> utf8
What does this do?
This will allow you to use the main user "Kodi_U01_Video_119" to add shows and movies to your collection and let the other users see this data as its added. (only need to sync once for everyone to get the new items)
Also this keeps the play counts, last played, and ratings separate for each user
Some things to start off with.
- The MySQL user i'm using for Matrix is "KODI_19" (I change this with each major version) and this user I don't give access to anything (as I do other things with this server)
Change password to what you want to use.sql:CREATE USER 'KODI_19'@'%' IDENTIFIED BY 'password';
- I have 9 users profiles on this set up, you can remove the unneeded, leave them or even add more.
Naming for my Databases:
Kodi_U01_Video_119
Kodi_U02_Video_119
...
Kodi_U09_Video_119
- You should update the advancedsettings.xml file and reboot Kodi after the steps below are done.
My advancedsettings.xml as a reference
I also set within Libre-ELEC to wait for network on bootxml:<advancedsettings>
<samba>
<clienttimeout>30</clienttimeout> <!-- timeout (in seconds) -->
</samba>
<videolibrary>
<recentlyaddeditems>50</recentlyaddeditems> <!-- number of recently added items. Defaults to 25 -->
</videolibrary>
<videodatabase>
<type>mysql</type>
<host>X.X.X.X</host> <!-- Use IP here as its faster then DNS -->
<port>3306</port>
<user>KODI_19</user>
<pass>some_password</pass>
<name>Kodi_U01_Video_</name> <!-- Change the U01 to the one you want -->
</videodatabase>
</advancedsettings>
- Added the sql files to Github.
Let me know if you have any problems or questions with this.
- Create the default tables
If you have already got a Multi-User setup then start here as Kodi will fail to update the database
This SQL will create all the tables and views that Kodi does.
It also has a small fix in the "tvshow" table column "C06" as I have found scraping shows with lots of fan art fails on the field size eg. Family Guy
Kodi V119 - 01 Default Tables.sql
- Updating the base tables
This will change the tables and make views so you can have more users.
Kodi V119 - 02 Update Base Tables.sql
- Creating the users
Run this for each user with doing a find and replace for _U02 to _U03 etc, this is set to use the main Database of Kodi_U01_Video_119.
Kodi V119 - 03 Creating the Users.sql
- Finalizing
This is optional but I do recommend doing the first part of it as it cleans the bookmarks when you remove files.
Kodi V119 - 04 Finalizing.sql
- Current watched status
You should be using https://trakt.tv/ but if you have python on your Kodi box you can use the tool from https://github.com/MilhouseVH/texturecache.py
I used this the other day to move Kodi 14 to Kodi 19 as trakt didn't support that version anymore.
Backup:
Restore:Code:./texturecache.py watched movies backup movies.dat
./texturecache.py watched tvshows backup tvshows.dat
the .dat files can be open in a text editor if you like to see what it exports.Code:./texturecache.py watched movies restore movies.dat
./texturecache.py watched tvshows restore tvshows.dat
I followed this pretty much to the letter I'm sure I did. I'm running MariaDB on my NAS so I made those changes to the scripts first. Everything seems to be working for my 2 profiles. Adult for me with 2 sources (mature films & kids movies) and a kids profile with just 1 source (kids movies). Same for TV. Adult and kids tv sources. The only thing I can spot that's not working right is recently watched TV shows on the kids profile. It works fine in the adult profile. Oh and recently watched movies works fine even in the kids profile. It's not a deal breaker but I wonder why just that one thing is not working as it should.
Many thanks for this great bit of work. I must admit it seemed a bit daunting at first but once I read it couple of times and took my time it all worked out. You must let me buy you a beer or a coffee