Sunday, January 18, 2015

Networking multiple XBMCs (pi hosted MySQL)

Here I am setting up a newer copy of XBMC (Kodi 14.0 Git:2014-12-24-e044d5a-dirty) and at the same time I'm moving my library to a 2TB NAS (used to have a 400 GB USB HDD connected directly to the pi). I figured this would be a good time to re-do things so I can have multiple XBMC clients pull from that same source (a pi that is on all the time) and keep track of the "watched" information.

I like my pi at a static IP making it easy to find (and use my 'droid as a remote!):
  - XMBC -> Program -> XBMC Settings -> Static IP
Set up SSH:
  - Change the default password (raspberry): sudo passwd
Set up MySQL:
 - sudo apt-get update
 - sudo apt-get install mysql-server-5.5
    # Installs 10 packages
    # Choose a sql root password
 - sudo nano /etc/mysql/my.cnf
    # comment out Bind-Address 127.0.0.1 to allow external connections.
  - mysql -u root -p # set up xbmc as a user
    mysql> CREATE USER 'xbmc'@'%' IDENTIFIED BY 'xbmc';
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'xbmc'@'%';
    mysql> quit

Then, the following needs to be done for each XBMC installation that is to connect to this server (including the one just set up with MySQL!):
  - cd ~/.kodi/userdata
  - put the following into a newly created file advancedsettings.xml:
<advancedsettings>
<videodatabase>
<type>mysql</type>
<host>192.168.1.33</host>
<name>xbmc_video</name>
<user>xbmc</user>
<pass>xbmc</pass>
</videodatabase>
<musicdatabase>
<type>mysql</type>
<host>192.168.1.33</host>
<name>xbmc_music</name>
<user>xbmc</user>
<pass>xbmc</pass>
</musicdatabase>
</advancedsettings>


Miscellaneous notes:
  • "Sources" are stored in ~/.kodi/userdata/sources.xml
  • Source format for a SMB file share: "smb://servername/ShareName/[Folders]"
  • List remote SMB shares: smbclient -L servername -Uusername
  • Logging can be enabled via Settings → System → Debugging # filename given onscreen
  • If you find the need, the MySQL database can be deleted: 
    • mysql -u xbmc -p xbmc
    • mysql> DROP DATABASE xbmc_video90; # 'show databases;' if your version is different

No comments: