Share your XBMC library on a Synology DS (or other NAS)

UPDATE: I’ve written an new post based on XBMC 12.0 Frodo:

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: Users\USERNAME\AppData\Roaming\XBMC\userdata\
  • Mac OS X: /Users/USERNAME/Library/Application Support/XBMC/userdata/
  • iOS: /private/var/mobile/Library/Preferences/XBMC/userdata/
  • Linux: $HOME/.xbmc/userdata/

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 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;

  1. Filesystem symlinks (windows), or
  2. Pathsubstitution

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.

  1. Symlink (Windows);
    Execute the following command from a elevated command prompt (run as administrator) to create a symlink of the Thumbnails directory;
    CD %appdata%\XBMC\userdata\
    mklink /D Thumbnails \\***.***.***.***\video\XBMC\userdata\Thumbnails (replace the * with your NAS ip)
  2. Pathsubsitution;
    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;


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.

12 thoughts on “Share your XBMC library on a Synology DS (or other NAS)

  1. Nou Rob, Ik snap er niet veel van, maar misschien komt dat omdat ik blond ben.

    Wat ik volledig mis in je beschrijving is de link tussen de XBMC database en de locatie waar de werkelijke bestanden op de NAS staan. Voor mijn idee maak je nu alleen maar een lege database aan en verder niets.
    Maar dat kan komen omdat ik vanuit een bepaald standpunt redeneer en als jouw beschrijving niet vanuit dat standpunt gaat, dan kan het heel goed dat ik wat mis.
    Even mijn situatie. Een vriend heeft XBMC op mijn AppleTV gezet. Dus het logootje is er.
    Nu heb ik een aantal series op de (synology) NAS staan, ergens in SABNZB/downloads/complete bijvoorbeeld.
    Hoe kan ik het nu zover krijgen dat de Apple TV, die bestanden op mijn NAS kan vinden. Zoals ik lees zou dat moeten komen door de database die jij ertussen plaatst, maar zowel de link tussen de database en de NAS locaties als de link tussen de database en de Apple TV ontgaat mij in de beschrijving.
    Het is toch niet zo dat de video bestanden IN de database moeten staan?
    Alle andere beschrijvingen die je geeft over SABNZB, couchpotato en zo snap ik, maar gebruik ik niet. Ik wil alleen maar die videos op het scherm zien te krijgen via Apple TV

  2. Somehow links in the form of smb:// does not work in Windows (8) XBMC. It does however work properly in my Android Pivos Xios. Anyone an idea on how this can be resolved? I really want to centralize everything for all devices in my home…

  3. Ik gebruik al jaren na volle tevredenheid XBMC (mac mini) en werd door het lezen van je artikels geïnspireerd tot het kopen van een Synology 213+. IK zit met een aantal probleempjes waar ik hulp bij nodig heb.
    1. Hoe kan ik mijn huidige bestanden (films/muziek) op de NAS krijgen? Via het netwerk geeft hij aan dat het dagen gaat duren. De data (500 Gb) staat op een externe USB 2.0 harddisk met eigen voeding. Maar als ik de harddisk aansluit op de NAS dan zie ik bij Externe apparaten wel de USB harddisk staan, maar in de File station niet. Wat doe ik fout?

    1. Beste Henk,

      De makkelijkste manier om de data op de Syno DS te plaatsen is toch wel via het netwerk. Dit kan over een 100 mbit netwerk idd even duren. Over een gigabit netwerk zou het met een paar uur over moeten zijn.

      Het probleem wat je heb bij het koppelen van de USB disk direct aan de DS heeft waarschijnlijk te maken met het bestandsysteem van de USB disk.

      Groet Rob

      1. Rob bedankt,
        Inderdaad USB was NTFS reform. Niet aan gedacht. Domme fout ik had de kopieeropdracht gegeven vanaf een wifi werkplek. Later gegeven vanaf vaste werkplek en inderdaad overpompen was binnen 1 dag gefixt. Nu ga ik verder met XBMC aanpassen. Nog tips waar ik rekening mee moet houden?

  4. I have this working perfectly, so thanks for this instruction.
    Only thing missing is a scheduled update that runs on the sinology. Now every time there is new content, when you start xbmc, it updates the database. Would be nice if this can be done on the synology as well 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.