Kodi Community Forum
2 XBMC PCs and 1 Database on the shared NAS - Printable Version

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Kodi General Help and Support (/forumdisplay.php?fid=111)
+---- Forum: Windows support (/forumdisplay.php?fid=59)
+---- Thread: 2 XBMC PCs and 1 Database on the shared NAS (/showthread.php?tid=70603)



2 XBMC PCs and 1 Database on the shared NAS - rtrimarchi - 2010-03-23 15:56

Hello everyone Big Grin

I have 2 HTPC and 1 NAS in my house.

I am trying to have these 2 HTPC share the same settings and database and fanarts and JPegs located phisically on the NAS.

(right now these HTPC are 2 independent PC)

This is to avoid to manage 2 HTPC databases.....since all the movies are on the common NAS shared via SMB.

Can you guys point me to the right direction on how to do it Confused

Thanks a lot.....
Rick Wink


- charrua - 2010-03-23 16:34

There is a new feature already implemented in XBMC(since svn r28142) that lets you use a central MySQL database for all your clients.
The basic steps you need to do in order to use it are:

1. Setup a MySQL server (a database server) accesible from all the machines running XBMC. Even some NAS support running MySQL server, so an option is to run the database server directly on your NAS (if you have one that supports it) or run it on any machine that you want (MySQL server is freeware and supports lots of OSs).

2. Modify your advancedsettings.xml located in the userdata folder of XBMC adding this lines:
Code:
<videodatabase>
  <type>mysql</type>
  <host>localhost</host>
  <port>3306</port>
  <user>xbmc</user>
  <pass>xbmc</pass>
  <name>xbmc_video</name>
</videodatabase>
where:
host is the network address of the server running MySQL
port is the port used by the MySQL server (default is 3306)
user and pass are the credentials used to connect to the MySQL server
name is the name of the MySQL database you want XBMC to use (it must be all lowercased)
(you don't need to create the database, XBMC will create it for you the first time you run it after modifying the advancedsettings.xml).

You can also setup a central database for music albums, you need to add these additional lines to your advancedsettings.xml:
Code:
<musicdatabase>
  <type>mysql</type>
  <host>localhost</host>
  <port>3306</port>
  <user>xbmc</user>
  <pass>xbmc</pass>
  <name>xbmc_music</name>
</musicdatabase>
The same explanation given for videodatabase applys here, just one more thing: you can't share the same database for music and video, so just pick a different name for each database (also all lowercased)
Remember to modify the advancedsettings.xml of each XBMC you intend to share the MySQL database with.

Some advantages of this setup:
Every PC or MAC running XBMC can access that central database even simultaneously (instead of using a local database for each instance of XBMC), avoiding the need to scrape movie info once per each XBMC. Also sharing the info of watched/unwatched movies/tvshows/musicvideos and any other info that XBMC stores in the media library database (like stop/resume bookmarks).

For more info, trobleshooting and details you can check this thread (readers beware: it may be a bit technical (it's in the developers area of the forum)).


- nabz - 2010-03-23 17:03

Thanks charrua for the reply
I have some questions about this:
1.- Will it work if I use XBMC from XBOX and from HTPC? I know the video database schema used by XBOX is older...
2.- What about BD migration? I mean: move all from the local DB to the central DB.
3.- What we have to put the tbn files?

Thanks!


- charrua - 2010-03-23 17:39

nabz Wrote:Thanks charrua for the reply
I have some questions about this:
1.- Will it work if I use XBMC from XBOX and from HTPC? I know the video database schema used by XBOX is older...
2.- What about BD migration? I mean: move all from the local DB to the central DB.
3.- What we have to put the tbn files?

Thanks!

1.- It hasn't been ported to the XBOX branch
2.- Your best option at the present time is to export the libraries from XBMC, then change the DB to MySQL and then reimport from XBMC. A Python script for DB migration would be very welcome though. Smile
3.- I think that the best place for the tbn files are in the same folders where the media files are located. Additionally when exporting the DB you can also export the tbns and fanart so they will be cached again when importing the movie/tvshows info. However there is still a problem that it is being discussed about thumbnails: when you first access the central MySQL DB from a XBMC client that is not the one that scraped the media files, there are problems in the thumb cache generation, because the URL of the thumbs are not stored in the DB (at least in the current version of XBMC) however they are working on a solution.


- nabz - 2010-03-23 18:14

Thanks for your reply Big Grin
I'll wait for coming news... Wink


- bradvido88 - 2010-03-23 18:16

I'm using this solution and it is pretty great. The thing that will make it kick@$$ is when the thumbs/fanart gets rolled into it.
Current i still have to do a manual update on all my XBMC instances in order to keep fanart updated in all.


- charrua - 2010-03-23 18:35

bradvido88 Wrote:I'm using this solution and it is pretty great. The thing that will make it kick@$$ is when the thumbs/fanart gets rolled into it.
Current i still have to do a manual update on all my XBMC instances in order to keep fanart updated in all.
There are two alternative methods for that right now:

a-Copy the thumbnails folder from the XBMC where you scraped the media files and paste it into the XBMC userdata folder of the other XBMC clients.

b-After scraping new media files, in the other instances of XBMC (not the one that scraped the files) go and browse the new files in file-view (instead of library-view).


- bradvido88 - 2010-03-23 19:22

charrua Wrote:b-After scraping new media files, in the other instances of XBMC (not the one that scraped the files) go and browse the new files in file-view (instead of library-view).
What does this do? I'm not sure I understand how it will get the thumbs/fanart/actor images by doing this.


- rtrimarchi - 2010-03-23 19:50

charrua

let me give you a quick THANKS for now.. Wink

I will give it a try in a couple of days......

for now I just say THANKS to you all guys for the great info Wink

rick


- charrua - 2010-03-23 20:47

bradvido88 Wrote:What does this do? I'm not sure I understand how it will get the thumbs/fanart/actor images by doing this.

Well, in my case, I have the tbn files and fanart stored along with the media files, so if I browse the path of the media source in fileview mode, XBMC stores the tbn and fanart(not actor images though) in the local cache, so I don't need to scrape all media files again or update the thumbnails manually.


- bradvido88 - 2010-03-23 20:50

I see. Is there a way to have XBMC always store that info with the files, or can it only be done through a manual library export?


- charrua - 2010-03-23 21:05

bradvido88 Wrote:I see. Is there a way to have XBMC always store that info with the files, or can it only be done through a manual library export?

No, there is no way (or at least no way I know of) to do that with XBMC. But you can use a third party utility (like Ember Media Manager, Media Companion, Media info Plus, etc.) to scrape movies and tvshows info/thumbs/fanart/actor images before scanning them with XBMC, those utilities will store all the info in the same folder as the media files and then XBMC will read them from there and will store the info in the db and the image files in the local cache.


- rtrimarchi - 2010-03-24 11:57

hi charrua,

you said :

Quote:1. Setup a MySQL server (a database server) accesible from all the machines running XBMC. Even some NAS support running MySQL server, so an option is to run the database server directly on your NAS (if you have one that supports it) or run it on any machine that you want (MySQL server is freeware and supports lots of OSs).

Can you tell me from where to download this windows package ?

Consider that I will be installing mySql on a win 2003 server pc/nas.

I just don't want to install more stuff then what I will need....just the minimum MYSQL package..... which I never installed before.

Sorry to bother.... but I don't want to put unecessary junk on my NAS pc....No

Thanks AGAIN for your help Nod


- charrua - 2010-03-24 12:41

rtrimarchi Wrote:hi charrua,
Can you tell me from where to download this windows package ?
Consider that I will be installing mySql on a win 2003 server pc/nas.
I just don't want to install more stuff then what I will need....just the minimum MYSQL package..... which I never installed before.
Sorry to bother.... but I don't want to put unecessary junk on my NAS pc....No
Thanks AGAIN for your help Nod
http://dev.mysql.com/downloads/mysql/
Download the "essential" package, choose 32-bit or 64-bit MSI Installer according to the version of your win 2003 server. Install with default options and you'll be good to go.


- rtrimarchi - 2010-03-24 14:02

OK...

Wink thanks again......

So finally.... just to see if I understood the benefits of this little trick....

Let's suppose (like in my case) I have :

1 NAS
2 PCs (PC1 and PC2) win7 running XBMC

With this configuration, this is what will happen:

1 - I insert a new Movie into my NAS shared folder

2 - Go to PC1 and from within XBMC, I download ALL the new movie info from
my online scraper website (mymovies.it). So I get the movie cover jpg,
the fanart, the movie related info...etc, etc

3 - Go to PC2, and theoretically, browsing the same media sources I should
be able to have ALL those movie info, movie cover, movie fanart,
etc etc WITHOUT DOING ANY EXTRA STEPS.......


Did I miss something or did I include something Wrong Confused

I'm sorry for this extra clarification..... Rolleyes