Solved SQL with multiple profiles
#1
I have 2 profiles in kodi.  Each has a different list of tv shows in the TV Shows section.  I am using the advancedsetting.xml so I can keep everything on a SQL.  How does kodi, or whatever, know to use my wife' DB instead of mine when I sign in under her profile?  I thought I would use the <name> tag to specify but it doesn't seem to be supported anymore.  The reason I ask is because for some unknown reason, when I sign into my wife's profile now, I see my shows instead of hers.  If I look at the DB I see the table tara107 which is the one with her shows and I see the table myvideos107 which are my shows but now kodi seems to be pulling the shows from my db instead of hers.  The profile name is tara so I figured that's why it named the db tara107 and how it knows to search for a table that contains the same name as her profile but it's not.  Also, I had the advancedsettings file in each of our profiles but the logs leads me to believe that I can just delete them from there because it's only loading the one in the userdata folder.  Is that correct?  Thanks.
Reply
#2
could you please show us the advancedsettings-file you created for both users?
Reply
#3
Each profile has its own advancedsettings.xml file, so specifying which profile connects to which database shouldn't be a problem.
However, Kodi 17 may have the occasional glitch in profile handling.
Reply
#4
Thanks for the replies. The problem started when I "fixed" an error that I noticed in the advancedsettings file.  Everything was fine so I should have left it alone.  I had a generic one in the userdata folder that was:

<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>192.168.***.*</host>
    <port>3306</port>
    <user>****</user>
    <pass>****</pass>
  </videodatabase> 
  <musicdatabase>
    <type>mysql</type>
    <host>192.168.***.*/host>
    <port>3306</port>
    <user>****</user>
    <pass>****</pass>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
</advancedsettings>

I also had one in the Nick profile that was:
<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>192.168.***.*</host>
    <port>3306</port>
    <user>****</user>
    <pass>****</pass>
  </videodatabase> 
  <musicdatabase>
    <type>mysql</type>
    <host>192.168.***.*/host>
    <port>3306</port>
    <user>****</user>
    <pass>****</pass>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
</advancedsettings>

And finally, one in the Tara profile folder tat was:
<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>192.168.***.*</host>
    <port>3306</port>
    <user>****</user>
    <pass>****</pass>
    <name>tara</name>
  </videodatabase> 
  <musicdatabase>
    <type>mysql</type>
    <host>192.168.***.*/host>
    <port>3306</port>
    <user>****</user>
    <pass>****</pass>
    <name>tara</name>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
</advancedsettings>

I had messed around with the name tag and realized that I had left it in the Tara profile one the other day so I removed that line so they all looked the same.  Then, last night, I looked at the shows under her profile and now her's mimic mine.  As I mentioned, her shows are still correct for her table in the db but it's just not pulling them after removing that line.  My db has the following tables:

myvideos107
mymusic60
tara107
tara60

It got me thinking, how does kodi know to use the tara107 for her profile?  Does it look for a table name that contains the profile name in it?  That's all I can think of.  I tried adding the <name> tag back but figured I would need to put the exact table name so I put <name>tara107</name> but that didn't work.  I don't see any mention in the wiki about putting a separate advancedsettings file in each profile folder so I tried deleting both of them and just leaving the one advancedsettings file in the userdata folder but got the same results.  Both profile have my shows in them. I've been told on other posts that the Name tag is not supported anymore  but it's still in the wiki guide:
Quote:6 Name tag
An additional 
<name>
 tag can be used for both the 
<videodatabase>
 and 
<musicdatabase>
 entries in advancedsettings.xml file, if you want to change the name of the database. The 
<name>
 tag is not required. Kodi will use "MyVideos" and "MyMusic" as database names if the 
<name>
 tag is not specified.
You may want to do this if you want to have multiple separate libraries (with different content) on the same MySQL server. For example, if you want to create multiple profiles, each with their own shared library, so that each Kodi device can "log-into" that library. (a kids library, a guest library, etc)
Note: Don't try to merge the video and music databases! You need to use different values in the 
<name>
 tag or you'll end up confusing Kodi leading to the library functionality not working at all. In other words, don't use 
<name>Kids</name>
 for both music and videos, but instead use something like 
<name>Kids-music</name>
 and 
<name>Kids-video</name>
So I figured that it might be.  What am I missing here?  Thanks.
Reply
#5
My guess is, and unfortunately I'm not that experienced with MySQL DBs, but a MySQL Database can have different users. So if for all profiles on your Kodi machines

    <user>****</user>
    <pass>****</pass>

is the same (for example "kodi" for the user), then every profile will connect to the Kodi MySQL user.

How many users did you create on the MySQL DB?

https://kodi.wiki/view/MySQL/Setting_up_MySQL
Reply
#6
I only created the one user.  I think that if I created 2 users then it would just be 2 separate users but still connecting to the same database.  Kodi Automatically creates a database for each profile. I just can't figure out why kodi isn't telling the "tara" profile to connect to the tara107 db for the shows.
Reply
#7
For anyone having similar issues, I fixed it.  Turns out that kodi does still support the <name> tag.  I was trying to put the entire db name though.  You have to just put the first part and let kodi add the numbers.  eg. I was putting <name>tara107</name> and, in my log, kodi was trying to connect to tara107107.  So, putting just tara in there let it add the correct number and connect to tara107.  All is working now. Thanks for everyone who offered up advice though.
Reply
#8
Sorry I was too late to reply saying exactly what you found out, i.e. Kodi does still use the name tag.

I use it with profiles that have their own sources.xml pointing to folders to keep the kids stuff separate. Then I just put anything they can watch or listen to in their folders and the database updates itself with a library scan. 

Works really well actually! Glad you got it sorted.
Reply
#9
Very informative, thanks for coming back to share your findings @nolos

Preparing to move to a similar setup and stumbled upon this thread wondering how this would work. Taking this on board Wink
Reply
#10
Thread marked solved.
Reply
#11
Damn!! Thanks for sharing! Informative one!
Reply

Logout Mark Read Team Forum Stats Members Help
SQL with multiple profiles0