Friday 26 August 2011

A Shared MySQL Database for XBMC

I want to use XBMC to stream media from my home server to various devices on my network. XBMC supports using a central MySQL database to store details about media such as the cast of a movie which can be accessed by any device on the network. This means that all devices are in sync, media only has to be scanned once rather than on each device and if you stop playback on one device you can resume from the same place on another device.

I followed this guide to set up the database.

I had to open port 3306 for TCP in the Vista firewall to allow devices to access to the database.

XBMC threw up some errors and I found that I had to scrap the databases I had created (xbmc_video and xbmc_music) and build them again with the following commands:
CREATE DATABASE xbmc_video CHARACTER SET latin1 COLLATE latin1_general_ci;
CREATE DATABASE xbmc_music CHARACTER SET latin1 COLLATE latin1_general_ci;

After getting it working with a XBMC 10.01 for Windows, I installed a nightly build of XBMC on an Apple TV 2 and found I had problems with the Apple TV build expecting a different database version. It looks like you need to be careful about using builds that that expect the same database version. XBMC creates the required tables automatically when scanning the library provided it can get to the DB and has access, so to rebuild the DB to a different version you just need to drop the tables (or drop and recreate the databases) and re-scan the library from XBMC.

The advancedsettings.xml file used by XBMC to enable the MySQL DB needed to go in the following locations:
Windows - C:\Users\<USERNAME>\AppData\Roaming\XBMC\userdata
Apple TV 2 - /private/var/mobile/Library/Preferences/XBMC/userdata

The XBMC log files are really helpful in diagnosing issues like these and are in the following locations:
Windows - C:\Users\<USERNAME>\AppData\Roaming\XBMC\xbmc.log
Apple TV 2 - /private/var/mobile/Library/Preferences/xbmc.log

No comments:

Post a Comment