Kodi Community Forum

Full Version: [MYSQL] HOW-TO: 5 User XBMC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
(2021-05-15, 03:03)Supay Wrote: [ -> ]I'm not sure if it is due to having this setup, but is anyone able to please advise me?

I am running this multi-user setup with 6 users.  Myself as the master so I can manage it all, with all sources scraped to the database.  Other users are 2 children and 3 adults.  I have setup everyone with their own profile and have everything configured for each person.  For the children, they only have three sources added, for child friendly content, however of course because they run off the same database master the content for that still shows up.  I therefore set a custom library node with a rule specifically for those source paths and replaced the main menu TV Shows with this custom library node.  However, all of the adult source content still shows up.  Is this still due to the database info showing up for them and thereby just outright bypassing the sources?  Is there any way to tweak this so that we can all run off the same setup but exclude specific content from the child profiles please?
Yes this is because of the DB, I do remember someone else doing some changes to the views that are used for the kids to remove content. I
 can have a look at editing some of the SQL for you.

What are the 3 sources you want for the kids?
(2021-05-16, 16:53)BigMong Wrote: [ -> ]
(2021-05-15, 03:03)Supay Wrote: [ -> ]I'm not sure if it is due to having this setup, but is anyone able to please advise me?

I am running this multi-user setup with 6 users.  Myself as the master so I can manage it all, with all sources scraped to the database.  Other users are 2 children and 3 adults.  I have setup everyone with their own profile and have everything configured for each person.  For the children, they only have three sources added, for child friendly content, however of course because they run off the same database master the content for that still shows up.  I therefore set a custom library node with a rule specifically for those source paths and replaced the main menu TV Shows with this custom library node.  However, all of the adult source content still shows up.  Is this still due to the database info showing up for them and thereby just outright bypassing the sources?  Is there any way to tweak this so that we can all run off the same setup but exclude specific content from the child profiles please?
Yes this is because of the DB, I do remember someone else doing some changes to the views that are used for the kids to remove content. I
 can have a look at editing some of the SQL for you.

What are the 3 sources you want for the kids?

Thank you for this!  Though I imagine if you get a nice way to work this out you will also make a lot of others happy.  The sources I want specifically for the children are below.  I have them in folders based on UK age ratings for films and just a kids TV folder.

        <default pathversion="1"></default>
        <source>
            <name>movies-12</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/movies-12/</path>
            <allowsharing>true</allowsharing>
        </source>
        <source>
            <name>movies-pg</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/movies-pg/</path>
            <allowsharing>true</allowsharing>
        </source>
        <source>
            <name>tv-kids</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/tv-kids/</path>
            <allowsharing>true</allowsharing>
(2021-05-17, 11:22)Supay Wrote: [ -> ]
(2021-05-16, 16:53)BigMong Wrote: [ -> ]
(2021-05-15, 03:03)Supay Wrote: [ -> ]I'm not sure if it is due to having this setup, but is anyone able to please advise me?

I am running this multi-user setup with 6 users.  Myself as the master so I can manage it all, with all sources scraped to the database.  Other users are 2 children and 3 adults.  I have setup everyone with their own profile and have everything configured for each person.  For the children, they only have three sources added, for child friendly content, however of course because they run off the same database master the content for that still shows up.  I therefore set a custom library node with a rule specifically for those source paths and replaced the main menu TV Shows with this custom library node.  However, all of the adult source content still shows up.  Is this still due to the database info showing up for them and thereby just outright bypassing the sources?  Is there any way to tweak this so that we can all run off the same setup but exclude specific content from the child profiles please?
Yes this is because of the DB, I do remember someone else doing some changes to the views that are used for the kids to remove content. I
 can have a look at editing some of the SQL for you.

What are the 3 sources you want for the kids?

Thank you for this!  Though I imagine if you get a nice way to work this out you will also make a lot of others happy.  The sources I want specifically for the children are below.  I have them in folders based on UK age ratings for films and just a kids TV folder.

        <default pathversion="1"></default>
        <source>
            <name>movies-12</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/movies-12/</path>
            <allowsharing>true</allowsharing>
        </source>
        <source>
            <name>movies-pg</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/movies-pg/</path>
            <allowsharing>true</allowsharing>
        </source>
        <source>
            <name>tv-kids</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/tv-kids/</path>
            <allowsharing>true</allowsharing>
@Supay Sorry for the delay been away with work.
Give this a try

Kodi V119 - 05 Custom Views.sql

This is set to create the views for U02, you can change easy on line 12
at the bottom of each view I have added 3 where strings
  WHERE
    `path`.`strPath` LIKE '%movies-12%' OR
    `path`.`strPath` LIKE '%movies-pg%' OR
    `path`.`strPath` LIKE '%tv-kids%';
more can be added and even removed as long as there is a OR at the end of each line except the last line that needs a ;
the % is wildcards.

Let me know if you get the desired results.

If the string are found anywhere in the path it will show
Thank you for continually updating this thread for each new Kodi version. For the longest time I've been running 16.1 with the multi-user MySQL setup (needed to keep a SPMC installation synchronized). But now thanks to new hardware, I'll be moving to 19.1. I've already run your scripts to create and modify the 119 schema databases.

For the next step, do I simply run an instance of Kodi 19.1 and let it migrate my existing library on its own? Or do I have to export the library in Kodi 16.1, and then import it using 19.1? Or do I have to run each major version migration one at a time, 16 -> 17 -> 18 -> 19?
(2021-05-26, 02:48)runningnaked Wrote: [ -> ]Thank you for continually updating this thread for each new Kodi version. For the longest time I've been running 16.1 with the multi-user MySQL setup (needed to keep a SPMC installation synchronized). But now thanks to new hardware, I'll be moving to 19.1. I've already run your scripts to create and modify the 119 schema databases.

For the next step, do I simply run an instance of Kodi 19.1 and let it migrate my existing library on its own? Or do I have to export the library in Kodi 16.1, and then import it using 19.1? Or do I have to run each major version migration one at a time, 16 -> 17 -> 18 -> 19?

If you setup the 119 like you said then rebuild your library.
from your old setup for each user use Step 5 "texturecache.py" to export then import once the new library is ready.
there are lots of little changes from each db version and its easier to do it this way then to write a script todo it sorry.

on a plus side your library information is all updated Smile

hope this helps
@BigMong Thank you so much! That definitely helps a lot -- it's very clear and I'll take a stab at it this week. Smile
(2021-05-22, 09:32)BigMong Wrote: [ -> ]
(2021-05-17, 11:22)Supay Wrote: [ -> ]
(2021-05-16, 16:53)BigMong Wrote: [ -> ]Yes this is because of the DB, I do remember someone else doing some changes to the views that are used for the kids to remove content. I
 can have a look at editing some of the SQL for you.

What are the 3 sources you want for the kids?

Thank you for this!  Though I imagine if you get a nice way to work this out you will also make a lot of others happy.  The sources I want specifically for the children are below.  I have them in folders based on UK age ratings for films and just a kids TV folder.

        <default pathversion="1"></default>
        <source>
            <name>movies-12</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/movies-12/</path>
            <allowsharing>true</allowsharing>
        </source>
        <source>
            <name>movies-pg</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/movies-pg/</path>
            <allowsharing>true</allowsharing>
        </source>
        <source>
            <name>tv-kids</name>
            <path pathversion="1">nfs://10.17.42.50/srv/nfs/tv-kids/</path>
            <allowsharing>true</allowsharing>
@Supay Sorry for the delay been away with work.
Give this a try

Kodi V119 - 05 Custom Views.sql

This is set to create the views for U02, you can change easy on line 12
at the bottom of each view I have added 3 where strings
  WHERE
    `path`.`strPath` LIKE '%movies-12%' OR
    `path`.`strPath` LIKE '%movies-pg%' OR
    `path`.`strPath` LIKE '%tv-kids%';
more can be added and even removed as long as there is a OR at the end of each line except the last line that needs a ;
the % is wildcards.

Let me know if you get the desired results.

If the string are found anywhere in the path it will show

Sorry for the long delay.  Life went a bit crazy and I wasn't able to do anything further to my systems since then.  However, sometime after you posted this (again not entirely sure when due to chaos here), all of the content in my kids profiles that I did not want them to see just vanished of its own accord.  It has remained that way since, they can only see the content that their sources provide and the adult profiles can see everything.  I have no idea why, as I made no changes to either Kodi or the database other than Kodi updates, but it now works exactly the way I wanted it to.  I'm unsure if this is simply part of an update to Kodi to provide this function more easily, or if there was some odd delay between the initial setup and my clients realising they should only be showing the added sources.  Whatever happened, it works and had no need for any changes by me.  I really appreciate the information you provided though and if I find out anything further as to why this just started working I will reply again.
If we are already running 116 an want to upgrade...  I first start with 1.) Create the default table, make all the new DB tables/views... then run the new version of Kodi and let it upgrade itself?  Will that allow the old data that was stored transfer over to the new one?
I have 2 Kodi apps running, each one with 2 profiles.
Basically the Kodi running on my TCL tv is the main on and the 2 profiles are master (the default one created) and the second is for my wife.
I started installing mySQL on my home pc (which is also my main repository) but then I stopped when I've realized that simply sharing the db isn't enough for sharing the profiles too...  Sad

I've read a bit this topic (from https://kodi.wiki/view/MySQL/Advanced_no...L_database) so I've stopped because it's too complex...
The OP did a very great job! ...but it's a shame Kodi itself cannot deal with sharing db and profiles by its own...  Confused
Hi @BigMong ,

thanks for your tutorial and work. I tried to migrate from a v19 mysql DB with single user to your multi user approach. I copied my old database to Kodi_U01_Video_119 applied the change to "tvshow" table column "C06" manually and executed the sql commands 2-5 afterwards. I thought that everything is working but I realized now that for U1 the watched status doesn't seem to work correctly. The strange thing is that it is working fine for the movies but it isn't for the TV shows' episodes. I checked the database and the playcount gets updated while it is still shown as being unwatched from within kodi. Do you have any clue why this could be happening?

Thanks!
Ok, fixed it by starting with an empty DB.
The next thing I'm struggeling with is that the clean library function doesn't work as intended anymore. How do you work around that?
Thanks!
I started here:

Create the default tables
If you have already got a Multi-User setup then start here as Kodi will fail to update the database

So I ran the scripts, got that all created.  Started Kodi, and the database upgrade failed.

MYSQL: Connected to version 10.0.38-MariaDB-0+deb8u1
2022-03-13 12:08:20.016 T:5904     INFO <general>: Running database version MyMusic82
2022-03-13 12:08:20.127 T:5904    ERROR <general>: Can't update database Kodi_U01_Video_119 from version 0 - it's too old
2022-03-13 12:08:20.142 T:5904    ERROR <general>: Unable to open database: Kodi_U01_Video_118 [1049](Unknown database 'Kodi_U01_Video_118')
2022-03-13 12:08:20.157 T:5904    ERROR <general>: Unable to open database: Kodi_U01_Video_117 [1049](Unknown database 'Kodi_U01_Video_117')
2022-03-13 12:08:20.217 T:5904     INFO <general>: Old database found - updating from version 116 to 119
2022-03-13 12:08:20.317 T:5904    ERROR <general>: SQL: Can't create database for copy: 'Kodi_U01_Video_116' (1007)
2022-03-13 12:08:20.317 T:5904    ERROR <general>: Unable to copy old database Kodi_U01_Video_116 to new version Kodi_U01_Video_119
2022-03-13 12:08:20.319 T:5904     INFO <general>: Running database version TV38
2022-03-13 12:08:20.320 T:5904     INFO <general>: Running database version Epg13

The 1007 error is because the database already exists.  So while this guide is good from a new start, I don't see how it possibly lets anyone upgrade from an old database to a new one.  Any ideas?
(2022-03-13, 18:22)john_es Wrote: [ -> ]I started here:

Create the default tables
If you have already got a Multi-User setup then start here as Kodi will fail to update the database

So I ran the scripts, got that all created.  Started Kodi, and the database upgrade failed.

MYSQL: Connected to version 10.0.38-MariaDB-0+deb8u1
2022-03-13 12:08:20.016 T:5904     INFO <general>: Running database version MyMusic82
2022-03-13 12:08:20.127 T:5904    ERROR <general>: Can't update database Kodi_U01_Video_119 from version 0 - it's too old
2022-03-13 12:08:20.142 T:5904    ERROR <general>: Unable to open database: Kodi_U01_Video_118 [1049](Unknown database 'Kodi_U01_Video_118')
2022-03-13 12:08:20.157 T:5904    ERROR <general>: Unable to open database: Kodi_U01_Video_117 [1049](Unknown database 'Kodi_U01_Video_117')
2022-03-13 12:08:20.217 T:5904     INFO <general>: Old database found - updating from version 116 to 119
2022-03-13 12:08:20.317 T:5904    ERROR <general>: SQL: Can't create database for copy: 'Kodi_U01_Video_116' (1007)
2022-03-13 12:08:20.317 T:5904    ERROR <general>: Unable to copy old database Kodi_U01_Video_116 to new version Kodi_U01_Video_119
2022-03-13 12:08:20.319 T:5904     INFO <general>: Running database version TV38
2022-03-13 12:08:20.320 T:5904     INFO <general>: Running database version Epg13

The 1007 error is because the database already exists.  So while this guide is good from a new start, I don't see how it possibly lets anyone upgrade from an old database to a new one.  Any ideas?

@john_es inside the table Kodi_U01_Video_119.version is there a single row with the value of 119
as if you have created all the tables then it shouldn't try to upgrade, it should just start with a blank setup, as its not easy to upgrade with the changes.

I normal just start again, export your watch status to Trakt or texturecache.py there are other services/scripts too.
Reimport your data (this also will update any text and pictures too unless you have nfo files)
(2022-03-03, 08:57)palym Wrote: [ -> ]Ok, fixed it by starting with an empty DB.
The next thing I'm struggeling with is that the clean library function doesn't work as intended anymore. How do you work around that?
Thanks!
(2022-03-03, 08:57)palym Wrote: [ -> ]Ok, fixed it by starting with an empty DB.
The next thing I'm struggeling with is that the clean library function doesn't work as intended anymore. How do you work around that?
Thanks!
@palym 
What do you mean not working as intended?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24