2012/12/25

Raspbmc: using a central mysql database

All my raspbmc's now share the same mysql db running on a tonido plugpc. That way all movie and music info is shared through all the raspbmc's. This post details the steps to setup this shared mysql for xbmc. First you have to setup the shared mysql db:
  • Let mysql listen for incoming network connections (modify with the ip of your mysql device):
    edit /etc/mysql/my.cnf
    #bind-address = 127.0.0.1
    bind-address = 192.168.0.199
  • restart mysql:
    /etc/init.d/mysql restart
  • create the xbmc user:
    mysql -u root -p root_password

    CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';
    GRANT ALL ON *.* TO 'xbmc';
Now, log on to your raspberry pi and create the $HOME/.xbmc/userdata/advancedsettings.xml file.
contents:
<advancedsettings>
    <videodatabase>
        <type>mysql</type>
        <host>192.168.0.199</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
    </videodatabase>

    <musicdatabase>
        <type>mysql</type>
        <host>192.168.0.199</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
    </musicdatabase>

  <pathsubstitution>
    <substitute>
      <from>special://profile/playlists/</from>
      <to>smb://tonidoplug2/your_share/xbmc/userdata/playlists/</to>
    </substitute>
    <!-- removed: this causes problems with the raspbmc plugin
    <substitute>
      <from>special://profile/addon_data/</from>
      <to>smb://tonidoplug2/your_share/xbmc/userdata/addon_data/</to>
    </substitute>-->
    <substitute>
      <from>special://profile/sources.xml</from>
      <to>smb://tonidoplug2/your_share/xbmc/userdata/sources.xml</to>
    </substitute>
    <substitute>
      <from>special://profile/mediasources.xml</from>
      <to>smb://tonidoplug2/your_share/xbmc/userdata/mediasources.xml</to>
    </substitute>
    <substitute>
      <from>special://profile/RssFeeds.xml</from>
      <to>smb://tonidoplug2/your_share/xbmc/userdata/RssFeeds.xml</to>
    </substitute>
    <substitute>
      <from>special://profile/favourites.xml</from>
      <to>smb://tonidoplug2/your_share/xbmc/userdata/favourites.xml</to>
    </substitute>
  </pathsubstitution>
</advancedsettings>

   
source: http://wiki.xbmc.org/index.php?title=HOW-TO:Sync_multiple_libraries/Setting_up_MySQL

2 comments:

Brandon said...

Nice saving tip on removing addon_data (i was in a restart loop). I also had to remove passwords.xml from pathsubstitution.

Took me a while to figure out there are a few pathsubstitution that will throw the pi into restart loops (luckily you can scp in and modify the file, wait for it to auto restart and repeat until it boots).

Also noteworthy is the log in /tmp/xbmc.log

Great article, seems most don't cover the pathsubstitution which is very important imo.

Unknown said...

What does the pathsubstitution do?