UPDATE: I've written an new post based on XBMC 12.0 Frodo: http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/
In a previous post I wrote about how you can install XBMC on an Apple TV 2. Because the ATV doesn't support attached USB drives and has no internal storage for your media you probably want to store these on a NAS (Network Attached Storage) device. But only store your media files on shared storage may not be enough. XBMC creates a local media library by default, if you have more than 1 XBMC device you might consider to place the library also on you NAS to share the library, thumbnails and even settings and plugins.
When you using a shared library you unlock the following features;
- Share watched and unwatched status for your media on all devices
- Stop watching a movie or TV show in one room then finish watching it in another room automatically
- Only one library to maintain for all devices
- Consolidate thumbnails and fanart to save hard drive space (and reduce scraping time)
Since I own a Synology DiskStation 410 I'll describe how you can accomplice this on an Syno DS, but most the options will also apply to a Windows or Linux based storage device (like a desktop computer or home server) or even other smart NAS solutions.
XBMC file locations
First take a look at where XBMC place the configuration files, later we need to edit some of them and place some additional files.
- Windows XP:
Documents and Settings\USERNAME\Application Data\XBMC\userdata\
- Windows Vista/7:
- Mac OS X:
From now on when I refer to 'XBMC userdata folder' I mean the one listed above.
Create a sources.xml file
One of the configuration files we need to edit is the sources.xml, in this file we will define where the media is located. If you want to use the shared library options later you must keep in mind this location must be accessible from all of these devices. I'm using the default smb video share of my Synology DS with access permissions for everyone so I'm not using any usernames and passwords on my fileshare. The sources.xml will look like this;
Click sources to download my sample file (rename the file extension to xml). Place the sources.xml file on (all, if you want to use the shared library option) your XBMC installation(s) in the XBMC userdata folder.
If you want to share the library using a centralized MySQL database continue reading, if not you're ready for now.
Enable MySQL and phpMyAdmin
Now we will make the preparations to use the MySQL database for you shared XBMC library.
First step is to enable MySQL on the DS (if you don't use a Synology DS check how you can install MySQL on your device at http://www.mysql.com/). Open the Synology Disk Station Manager (DSM) and open the 'Control Panel' and click 'Web Services'. Enable MySQL by placing a check at 'Enable MySQL' and click 'Apply';
Now we need to install the phpMyAdmin package so we can create and edit the databases (If you dont have a Synology DS please check the phpMyAdmin website to see how to install it on your device). Open the 'Package Center' and click the 'Available'-tab. Locate the phpMyAdmin package en click 'Install'.
Follow the instructions in DSM to complete the installation.
Create XBMC databases
Now we have a database server we need to create the databases for XBMC. Open phpMyAdmin in an internet browser (http://YOUR-IP/phpMyAdmin). On the main page we can create two databases, one for the video library and one for the music library (optional). Give the database a name (like xbmc_video) and click 'Create'. Now do the same for the music library and name it xbmc_music (if you want to use a shared music library).
Now we have created the databases we need to create a user so XBMC can use the database. To do this we need to click on the 'Databases' tab on the top of the main window. Now phpMyAdmin will show a list of all databases, click on the icon on the right of the xbmc_video database.
A new screen will open where you can modify the access permissions per users. Click 'Add a new user' at the bottom of the screen to create a new user.
I've created a user with the username 'xbmc' and password 'xbmc', of course you can use another password for more security. Fill in the field 'User name', 'Password' (en re-type :)). Select 'Grant all privileges on database "xbmc_video"' and click 'Check All'. The screen should look like the screen below. Now click 'Go' to create the user and apply the privileges on the database.
If you have chosen to make a music database to you have to do the same thing on the xbmc_music database.
That's it, your database server is ready to serve XBMC.
Connect XBMC to your shared database
OK, the database is up, only thing left is to connect XBMC to it. There is no fancy configuration option in the gui so we have to edit/create a .xml file again. Don't worry, it is't that hard 🙂
The file we need to create (not default present after the installation of XBMC) is advancedsettings.xml and place it into the XBMC userdata folder. In this file we're define the MySQL database connection. It should look like this;
You must replace the ***.***.***.*** with the ip-address of your MySQL database server. You can download a sample file here: advancedsettings (rename the file extension to .xml).
That's all, you centralized library and media files are in place. You can stop reading here... But the next section, where we will take a look on how we can share thumbnails and other files, is worth reading...
Share other components (i.e. thumbnails)
The sharing of Thumbnails is a little bit more complex. XBMC will place the Thumbnails into your device' user profile. To place these on a shared location you have 2 options;
- Filesystem symlinks (windows), or
I'll describe both options. The first one is the most easy one but only limited to Windows Vista and higher. You can create symlinks on NTFS to redirect a local folder or file to another location. Within Windows it seems to be a local folder. Pathsubsitution is a feature of XBMC and will work on all supported operation systems.
First you need to know witch files and folders you want to redirect and where there default positioned , the most common redirected files and folders are 'Thumbnails'\, 'Playlists\' and 'sources.xml' (for a complete list take a look at the XBMC wiki).
I'll describe the procedure for the Thumbnails directory only but for every other folder it works the same.
- Symlink (Windows);
Execute the following command from a elevated command prompt (run as administrator) to create a symlink of the Thumbnails directory;
mklink /D Thumbnails \\***.***.***.***\video\XBMC\userdata\Thumbnails(replace the * with your NAS ip)
For pathsubsitution we need to add a view lines to the advancedsettings.xml file. Add the following to redirect the Thumbnails folder to a different (shared) folder;
<pathsubstitution> <substitute> <from>special://masterprofile/Thumbnails/</from> <to>SMB://***.***.***.***/video/XBMC/userdata/Thumbnails/</to> </substitute> </pathsubstitution>
Well, that's it... Enjoy your shared media, library, thumbnails and maybe other content on all your XBMC devices! Check back to my site in the future to read more articles about the great XBMC media center. Thanks for reading en please share this article with your friends, family and colleagues.