Wouldn't it be nice if you could pause or stop your media centre in the living room, head into the bedroom and pick up exactly where you left off without skipping a beat? You can with XBMC, and here's how it works.
We've shown you how to clean up your media, customise your install and emulate games in pursuit of making XBMC the ultimate media centre. Today we're going to show you how to synchronise all the XBMC consoles in your house.
XBMC is a fantastic open-source media centre application for Windows, Mac, Linux and (at least the old) Apple TV. If this is your first time hearing about XBMC, you really should check out our start-to-finish guide to setting up XBMC to see what XBMC is really capable of.
If you have more than one XBMC installation in your house — we're currently rocking five installations in this media centre-happy home — you might have noticed one seemingly small but annoying flaw in XBMC. If you paused, stopped or bookmarked a television show or movie in the living room and then went to resume watching it in the bedroom, the remote instance of XBMC had no idea where you left off. Bookmarks and resume points are stored on each local XBMC installation, as are any changes or annotations you make to your library. We're going to take care of that annoyance today with a little database wizardry. When we're done, you'll be able to pause Scarface in the living room and unpause it in the bedroom, and your network of XBMC centres will keep everything in sync.
Getting Started with XBMC Syncing
You're going to need a couple things to make this synchronisation magic happen. The foremost is multiple copies of XBMC running a current release -- if you only have one XBMC install, you don't need to worry about all this syncing jazz. To enable synchronisation via a central database, you must be using SVN version R28117 or above. Check your release number in the System Info menu of XBMC if you're unsure which version you have. If you have a pre-R28117 release, the easiest way to upgrade — and enjoy some sweet new features in the process — is to grab a current release here.
The other component you'll need to bind all your XBMC installs together is a MySQL database. If you've never worked with databases or MySQL before, that might sound like a frightening proposition, but I assure you it's not. This is the first time I've ever played with MySQL, and despite a few hiccups with syntax (my fault) when I first set everything up, it was a breeze. Download a free copy for your OS of choice here. Stick with the Essentials package. Although our setup instructions below focus on Windows, the MySQL commands transfer across operating systems, so Linux and Mac users can easily follow along.
Once you've ensured your XBMC installations are up to date and you've grabbed a copy of MySQL, it's time to get started setting up your database.
Step One: Install and Configure MySQL
Where you choose to install MySQL is critical to the success of your synchronisation efforts. Whether you install it on a Windows, Mac or Linux machine is not as important as installing it on a machine that's running most often. I installed it on my home server, which runs 24/7.
Run the MySQL installer. When prompted to select a configuration type, choose "Standard Configuration". If you're a web developer or MySQL wiz, you've possibly already got it installed and configured; if you're new to MySQL — like I was — the standard installation is just fine for the simple media database we'll be creating. Enter a password for your database when you're prompted to do so and specify that you want your database to have network access. Leave the default port of 3306 alone — if you change it here, you'll just have to change it in the files we'll be working with in a few minutes. After the installation is complete, pull up the MySQL Command Line Client — look in the MySQL start menu entry for it — and run it. It will prompt you for your password and then dump you into a console that looks like the screenshot below.
Now it's time to create a user, some databases and assign our new user some privileges. First we'll be creating a user account for all of our XBMC installations. They'll be sharing the same login. At the commend prompt type in:
CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';
You've just created the login/password pair xbmc/xbmc. Since this database is just for a media centre and just for use on a private network, we're not going to concern ourselves with heavy security. You can, of course, go more secure if you like.
After you've created your user account, it's time to create some databases for XBMC. Type the following:
CREATE database xbmc_video;
CREATE database xbmc_music;
Now we have user "xbmc" and two databases. XBMC requires a separate database for the video library and the music library.
Finally, we need to give our user access to the databases. Again, since we're not concerned with securing confidential records or the like, we'll take the easy way out here to minimise the amount of typing and fussing we need to do. Type the following command at the prompt:
GRANT ALL ON *.* TO 'xbmc';
Now user "xbmc" has access to all our databases. To confirm that everything's in order so far, fire off the following commands:
SELECT host,user from mysql.user;
If everything is in ship shape, you'll see results like those in the screenshot above. Now all that's left to do is tell XBMC how to access the database and start sharing information through it.
Step Two: Configure XBMC to Use Your New Database
As with any software-based tinkering, we recommend backing up before proceeding, so let's do that first.
Under the Settings menu in Video and Music, you'll find an Export Library button. Export the video and music library for safe keeping. We'll be importing them shortly.
Once you've exported your libraries, open up your favourite text editor and copy the following text into a new file:
***.***.***.*** with the IP address of the computer on your network that is hosting the MySQL database. If you altered the MySQL server port during the installation, make sure you change it. (If you didn't, the default was 3306.) In Windows, save this file as
advancedsettings.xml in the
%APPDATA%XBMCuserdata — just copy and paste that text into the Explorer address bar or the Run box. (On Linux, the path should look something like
~/.xbmc/userdata; on OS X, something like
Once you've copied the file to every XBMC installation on your network, start one of them up and import the music and video libraries you exported. This freshly imported — or freshly scanned, if you're starting from scratch — library will populate the database on your primary machine/server. From here on out your XBMC viewing habits will sync between machines and you'll be able to resume playback, access bookmarks and see what media you've already viewed from anywhere in your house. The first screenshot below is taken from the XBMC centre in one room, and the second was taken in another room; both XBMC installs feed from the central database.
Note how the second XBMC install knows that we already watched the first episode and that we paused the second one 45 seconds into the show. In addition to remembering which shows we've watched and where we left off, the database also remembers things like subtitle settings, if we've zoomed the screen in, video modes and more. If you're curious to see everything currently shared by the XBMC database, you can check out this developer's thread, complete with charts, that highlight all the variables that'll sync between installations.
One current shortcoming with the database system — although rumoured to be in the pipe for future releases — is that thumbnails and fan art are cached locally and not stored with the database. While creative users in the XBMC forums have come up with solutions to work around this, like using symbolic links and moving your thumbnail cache, there is a much easier solution. We'd strongly recommend you go check out our guide to whipping your movie and TV show art into shape for XBMC. The method we outline in the guide results in all your thumbnails, movie posters, fan art and more being stored with your media. It's the best way to do it, and it makes reinstalling XBMC or adding a new install to your network a breeze, since the "scraping" it does is from the local network and not a distant server. If you combine local artwork storage with a MySQL media database, you'll have the fastest home media network around.
Have a favourite XBMC tip, trick or add-on to share? Let's hear about it in the comments. We love a good media centre, especially a powerful and open-source one, and we always love to hear about new ways to make them better.