[BETA] - XBMC Sync Script
#1
XBMC Syncer

http://dl.getdropbox.com/u/397935/XBMC%20Syncer.zip - Version 0.11

I have multiple XBMC installs and stream all of my videos from a NAS. I want stuff to stay in sync but want independent libraries. My first order of business was to keep watched status in sync. I wrote a script.

Requirements
  • Your libraries don't have to be the same, but they should point to the same files with the same path structure. All my machines have their media as: smb://user:password@server/share/etc. The sync will work with local files on different machines if their paths are the same.
  • You have to set up an FTP server. The script keeps a "master database" to work across multiple computers. The script stores a file on the root level of the FTP server. If you're using multiple XBMC installs with a NAS, I assume you can set up FTP. I chose FTP because it's built in to python and so should work on all platforms.
  • The web interface should be on for all the computers that you sync to. The port should be set to 80 and no password or username should be needed to access it. I can add support for different ports and user names/passwords later.

Quick Instructions
I am actively developing this at the moment but wanted it out in the open for feedback. There are some functions other than simple syncing in the script but they will have to be polished and I don't have time to write a manual at the moment.

Overview:
  1. Back up your video libraries (myvideos34.db in your user profile)
  2. Install the script on all the computers you wish to sync
  3. Launch the script on a machine and enter its ip address or hostname (whatever other computers can connect to) and then the ftp server settings
  4. Select Run Sync
  5. Enter an address or hostname for a computer running XBMC with the web interface running
  6. Run the script on the remaining machines, they will add themselves to the sync after supplying the necessary local address and ftp settings

Some of the features:
  • Keeps a library on an FTP server to store sync data between computers
  • Has utilities to reset the sync data if problems arise. A computer can replace the synced playcounts in the master database through a menu
  • If a computer doesn't contain a file in the library the sync still works. Therefor your libraries don't have to be the same on all computers.
  • Keeps track of xbmc database's playcounts correctly, and its lastplayed pretty correctly.
  • You can set up "aliases" for computers if they have more than one ip address, one of my laptop's doesn't always work with the DNS in my house and so sometimes needs to be connected to with either of its two ip addresses (lan and wireless). I set up an alias and the script handles this fine
  • You can set up links to video files whose playcounts you want to remain in sync. My faster machines have BluRay backups in their libraries, slower ones encoded versions. I setup a video link for each movie and the play counts remain the same between the two. So if I watch a movie's encoded version on one computer, the full rip will show up as watched on another computer
  • There are some functions to look up information in the master library
  • The script tries to keep writes to the XBMC database to a minimum to prevent issues.
  • Failed syncs are handled gracefully. If I yank out the ethernet on a computer that I am syncing to, the sync finish early and syncs what it can.
  • I found sometimes the XBMC web interface can return malformed information. The script skips the sync on a file whose information is malformed. Usually on the next sync the file will be picked up fine.
  • There are functions to prevent more than one computer syncing at a time.
  • Disconnection and file transfer errors are handled through the script, giving the user feedback instead of the script failing/crashing
  • Has a function to see which computers that are set up to sync have xbmc running

Note
The script is still in testing and under development. That being said it works fine in my environment with windows machines and mac os machines. I will test linux later.

Still, consider it beta

Changelog
0.11 - Fixed a bug where database view would not load if some computers had not performed a sync yet.
- Added handling to deal with shares having different case on local xbmc profile. Handling only can deal with ASCII cases, not unicode.
- Must delete xbmcsyncmaster.db and recreate from advanced menu (reset sync data, update with replace on one system, update without affecting on all others)
0.1 - Initial release
Reply
#2
Main Menu:
Image Image

File Info View:
Image Image

Database View:
Image Image
Reply
#3
Menu to set up links between files:
Image Image

Settings set up through script instead of text files:
Image Image

What the sync itself looks like:
Image Image
Reply
#4
There is a bug with case sensitivity. I recreated the libraries on my systems from scratch, deleting my sources.xml files, and noticed that one system created its sources.xml and therefore its internal database paths in a different case than my other systems (actually only one character was off).

I will update either the code or the master database definitions to evaluate everything case insensitive. As of right now case differences in either the path or filename will appear as separate files in the sync, which is not the desired behavior.

You can test whether each system's path and filename cases match the master database (and therefore other computers) by running a database info command (from the main menu) on a video file you know is already in the master (sync script) database. If the file is reported as not in the database this means the system you are checking from has a different case for its paths than the system originally used to create the master database.

You can use the same sources.xml files in your systems to try to ensure the paths are represented uniformly with regard to case.

Posted a new version which should prevent this issue
Reply
#5
I tried this yesterday and honestly I got kinda confused to what or how to use it.
Reply
#6
Yeah it's kind of a beast. Writing a decent instruction list or manual will be a beast too.

Do you store your media files on a nas / share files over the network?
Can you set up a FTP server on the computer that shares the files?

More instructions:
1) Set up an FTP server. You should allow anonymous access on the ftp server to make set up easier.

There are freeware windows FTP servers from what I'm aware. I use server 2008 so just configured the FTP server that is part of IIS. Setting an ftp server would be simple in linux.

2) Turn on the web interface on the xbmc systems you want to sync to. The password should not be set.
My settings windows is below:

Image

3) Figure out the ip address or names of your systems running XBMC. The three computers I am syncing have the names "kmak", "minik" and "kapkac" I can ping these names on any computer in my network because DNS works in my network. You can enter ip addresses but the ip addresses must not change for each computer (probably not a condition that is true because of dhcp).

4) Install the script on each computer.

5) Run the script. It will ask you for the name or address of the computer that it is currently running on. It defaults to the name it gets from OS. Whatever you enter here, other computers must be able to access/ping that system from the address/name you enter.

6) Enter the ftp server information. The defaults for user name and password will work for systems that allow anonymous ftp access.

7) Select run sync from the main menu

8) The script will ask for the address/name of another running XBMC system you wish to sync to.

9) Install the script on other systems. Do steps 5-7 on these systems. Enter the local address on each system specific to that system.
Reply
#7
First of all let me say.. Much Gratitude..

This has been something i, and i am sure many others, have wanted on XBMC for a very long time.

I keep getting the "Python Failed" error when i try to run it.

Apple scripts and SVN Repo run fine on all my systems.


My Setup

2 ATVs 2.3, 1 PC Vista, 1 Macbook Pro 10.6 - - All with the latest XBMC version
5TB OpenNAS Linux as the content server.

Any ideas?
Reply
#8
Can you post or send me a debug log on one of your systems? The log file would give the most definitive reason for the error.
Reply
#9
wow.. sorry for the late reply.. i forgot to turn on subscribe to the thread.

yeah i can get you a debug log.. where can i find it. looking all over my mac and cant seem to find it.
Reply
#10
I think its: Home Folder/Library/Application Support/XBMC/

it will be called xmbc.log or something like that.
Reply
#11
i have looked everywhere for a error log file or general log file.

do i have to enable "debugging" somewhere to get this file output?
Reply
#12
@kkampen
See this page how to produce a debug log and where to find it...
http://www.xbmc.org/wiki/?title=HOW-TO_S...Bug_Report
Reply
#13
Awesome work skaymakca! I think this is just the program I was looking for! Question for you. I have the following xbmc setup;

bedroom - ubuntu xbmc setup - shares set up as smb://...
living room - win7 xbmc setup - shares set up as X:// ...
Server - win2008 with 2 Raid5 configs shared out

At the top you mention that both configs need to be the same, do SMB shares work ok on a windows box now? Will the script work if maybe the source names are the same? Just wondering before I bork something up, thank you again!
Reply
#14
Is this still in active development?
1: Nvidia Shield TV (2017) 16GB - 2: Beelink MinixMXIII II - 3: Beelink MinixMXIII II - 4: Beelink MinixMXIII II
NAS: unRAID 6.3 Pro • Case (NZXT H440) • MB (MBD-X7SBE with SIM1U+) • CPU (Xeon X3360) • RAM (4x2GB DDR2) • SATA (6 On MB, 8 AOC-SAT2-MV8) • PSU (EVGA SUPERNOVA 650 G2) • HDD (2 x Toshiba 3TB parity, 6 x WD Red 3TB xfs, 1 x 512GB SSD cache)  • UPS (APC BR1000G)
Reply
#15
I'm wondering that too...

This seems to be INCREDIBLY useful.
Reply

Logout Mark Read Team Forum Stats Members Help
[BETA] - XBMC Sync Script0