[[image:xbmc-ss.png]]
=== Synchronize XBMC library with devices (Raspberry)===
First the starting point:
I have OpenELEC mainly running on my RPi (version is r13078 from http://openelec.thestateofme.com/) and wanted other devices, e.g. a tablet, to pick up at the same position where I stopped watching on the RPi. Usually XBMC stores this information locally so you could potentially run into a big mess and unsynchronized XBMC installations. So I wanted to get a neat setup where I would not have to worry about which device I now need to use to start at the same part where I left. For this I wanted to use the built-in MySQL server that comes with Amahi and store the media related information there.
In order to do so we just need to modify/ create the advancedsettings.xml file in the XBMC installation(s). They all need to be the same though, i.e. a Frodo installation cannot work on the same database as an Eden installation.
This is what you need to do:
1. SSH into the server or via Terminal and create a MySQL user and database (this will be the user for the XBMC installations)
{{Code|hda-create-user-and-db xbmc}}
<!--1. SSH into the server or via Terminal and access the MySQL environment in order to create a user (this will be the user for the XBMC installations)
Code = mysql -u root -p
}}
The standard password used by Amahi is "hda".
2. Paste the SQL command to create the user, set permissions, and update everything
{{Code|
Code = CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';
GRANT ALL ON *.* TO 'xbmc'; FLUSH PRIVILEGES;
}}-->
2. Now we need to make the adjustments on the OpenELEC installation in order to have OpenELEC connect and use the MySQL database
2.1 Open the OpenELEC SMB Share "Userdata" and in it create a file called "advancedsettings.xml" (or edit it if it's already created; DO NOT delete the content already written in it, just add the following code). The following needs to be entered (replace 'x.x.x.x' with the IP of the HDA):
{{Code|
Code = <advancedsettings>
<videodatabase>
<type>mysql</type>
<host>x.x.x.x</host>
<port>3306</port>
<user>xbmc</user>
<pass>xbmc</pass>
</videodatabase>
<musicdatabase>
<type>mysql</type>
<host>x.x.x.x</host>
<port>3306</port>
<user>xbmc</user>
<pass>xbmc</pass>
</musicdatabase>
</advancedsettings>
}}
2.2 Save the file.
2.3 In the same SMB share on your OpenELEC installation please go into the "Database" folder to delete "MyVideosXX.db" & "MyMusicXX.db". XX seem to be random numbers.
3. Reboot the Raspberry
[[Category:Apps]]