[Release] - QuickSync - Syncronize watched status across multiple XBMC installations.
#1
Brick 
QuickSync syncronizes watched status for files in video libraries on multiple xbmc installations through a common watched.txt file. The service can run on a timer, after a video is played, and/or be started manually. I wrote QuickSync as an alternative to having one centralized MySQL database (as outlined in lifehacker - http://lifehacker.com/5634515/how-to-syn...-the-house) or using Plex (which I found to be vastly inferior to xbmc), but still be able to have watched flags consistent across installations. This script does NOT move/copy/alter any of the other metadata such as associated images, show descriptions, bookmarks, etc.

QuickSync needs to be installed and configured on all xbmc installations that are to be synced and can syncronize across installations on different operating systems. For example, in my house I have a windows 7 HTPC, a windows 7 laptop and a Ubuntu 11.10 HTPC with the service/script installed on all 3 machines and all pointed to the directory \\MyServer\Media\XMBCstuff\Sync.

The initial code was based on the script "Import/Export Flag" see thread (http://forum.xbmc.org/showthread.php?t=6...t%2Fexport) and works in a similar fashion, just automated across multiple machines, with increased speed and redundancy to avoid lost watched flags. The time for the script to execute depends on the number of entries that have to be set in the database. If there are only 2 new watched flags since the last sync, the script is fast (a few seconds). If there are 1000 new watched flags (the first time you run the script on a new machine/profile) it may take a minute or two. If there are a large number of entries, I recommend manually running the script for the first sync. The time the script takes is directly proportional to the number of database changes that need to be made.

For proper functioning, files must be in the XBMC library - however, not all files need to be present in all installations.

Multiple profiles are supported. Just point QuickSync in each profile that you want synced across different installations to a different directory. For example: Master profile on each machine could be pointed to \\server\xbmcstuff\master and profile runningeric could be pointed to \\server\xbmcstuff\runningeric. This will keep the watched status and bookmarks for each profile synced across the different machines.

NOTE: If you have multiple files with the same name QuickSync will not work for you. For example if you have two files: /TV/Lost/s01e01.avi and /TV/FamilyGuy/s01e01.avi and one is watched, the sync process will cause both to be marked as watched after and import. The sync process keeps track of what files are watched by their name (in this example s01e01.avi).

Configuration:
Run Sync On Startup?: If set to true, script runs in background 4 seconds after the start of xbmc.
Run After Video Played?: Runs script whenever a video is exited.
Run Script Every __ Hours: Script can be run either 1,3,6,12 or 24 hours. The value "--" keeps the script from running on a schedule.
Remote Directory For watched.txt and bookmark.txt: Point all installations to be synced to the same directory that will store the watched.txt and bookmark.txt files. Your XBMC installations must be able to read/write from this directory.
Debug Mode: Turn on debug mode before posting xbmc.log with errors.

Suggested Configuration:
I would suggest having "Run After Video Played?" set to true, so that as soon as data is changed, the remote file is updated. Also, have the script run before you will use a particular XBMC installation. This can either be done manually, on startup (if you don't leave xbmc running), or automatically every few hours (1,3,6, etc.) if you leave XBMC on all the time. I tend to use all of the options. I have the QuickSync run after a video is played, and then every 3 hours on each machine. Also, it runs when I start an xbmc installation.

Notes:
QuickSync works with pre-eden xbmc builds only. I haven't tested it with Dharma and doubt it works. EDIT: Works with the final 11.0 Eden release. Smile
QuickSync has been tested with Windows 7 and Linux (Ubuntu 11.0). It should work with OSX, as the code is platform agnositic and uses the xbmc file copy libraries, but please let me know in the comments if you have success and/or failure on these platforms (and post your logs for failures!).
File sharing has been tested using mapped networked drives (in windows), direct server paths (\\Server\Folder\), and samba sharing. QuickSync works as long as you have read/write permission to the remote directory. File accesss is done with xbmc libraries and should support all file sharing options in XBMC.
Making files go from watched to unwatched after they have been scanned into multiple installations is non-trivial. The easiest method is to change the file name (add another period or dash, etc) and rescan it into your xbmc libraries.

For bug reports, please use a pastebin service (http://pastebin.com/) to post your xbmc.log with debug mode on, the nature of the problem, your operating system, xbmc build and how reproducible the issue is.

Download file here: script.quicksync.xplat.zip (version 1.0)

Please comment, share, update and distribute code as you see fit.

Thanks!
Eric
Reply
#2
Hi, thanks for the plugin. I have (probably a ridiculous question/request) - could this be made to inform a Plex server of watched status? I only have one XBMC on an atv2, but I have a couple of iOS and Android systems which I use Plex on.
Reply
#3
Information 
(2012-03-23, 19:45)dukevim Wrote: Hi, thanks for the plugin. I have (probably a ridiculous question/request) - could this be made to inform a Plex server of watched status? I only have one XBMC on an atv2, but I have a couple of iOS and Android systems which I use Plex on.

You currently have a couple of options (at least that I am aware of) if you want everywhere (mobile phones, tablets and ATV2) you are watching media to show the same watched information:

1) Using pleXBMC from hippojay would allow your XBMC installation to interact with your plex database (http://forum.xbmc.org/showthread.php?tid...ht=plexBMC)

2) Use plex on your ATV2 (http://wiki.plexapp.com/index.php/PlexNine_Client_ATV)

3) Scrobble everything to a service like trakt.tv (which has plex and xbmc apps/services).

....I think that functionality would be a bit out of scope for this plug-in (which I tried to keep as straight forward as possible). A separate plug-in could be made that only ran when you watched a show or that ran on both XBMC and PLEX (so a QuickSync plug-in as well for PLEX that checked against the watched.txt file that is generated), but I lack sufficient time to do so.

Thanks,
Eric
Reply
#4
Hi, very nice addon it's just what I needed because MySQL doesn't work for me because I use xbmc also on a laptop that I carry along with me.
I have only one request would it be possible to add the function for resuming a video. So when you stopt watching on one xbmc it sync's with the other xbmc and I can resume there. That would be a very nice feature
Reply
#5
This looks promising, but i cant get it to work. I am using Eden (Win7 64bit). I enter some config details, like the path to save the watched.txt file, but this is not being saved. When I return to the config page, the path is empty.
I cant activate debug mode, because the settings are not being saved.
File locations I have tried include mapped netork drives, and local system folders, including My Documents.

In any case, when I try to run the script by clicking on it, it starts an Import, not an Export.

Any idea how to get this to work?
Reply
#6
I understand your scripts compares just filenames. Could it be modified to work also (or instead) with IDs?

So, for example, if I have "the shawsank redemption (1994).mkv" (IMDB ID tt0111161) in english but also "cadena perpetua (1994).avi", whichever version I watch, the other one will be marked as watched. That will work also if I rename something (maybe I substitute a file with a higher resolution version, for example, and extension changes from .avi to .mkv).

Is it possible, in addition of other options, to run the script after updating the database? the best option would be to update an specific item (and only that one) watched status right after adding it to the database. That could be extremely fast and would make moving files around the different sources almost transparent.
Reply
#7
To follow up my earlier post, I'm not sure why the file directory wasn't being saved earlier, but now, a few days and a couple of reboots later, I gave it another try and it is working.

The puzzling thing though: to test it, I did the following:

I ran it on machine 1, where it created the watched.txt file.
Then I ran it on machine 2, and it imported watched ratings.
I then ran it again on machine 1.

I then checked the library statistics widget in my skin: both machines reported different numbers of episodes watched.

So, I then changed the sync location on both machines, and ran the script once on each each to produce different watched.txt files.
At this point, both machines should have the same number of shows watched, but the watched.txt for one machine has 400 more entries than the other, and importing that file into both machines doesn't change things.

Any idea what's going on?

Note: both machines have exactly the same video sources.
Reply
#8
To reply to my own post:

It seems there's something funky going on with one of my XBMC setups. The discrepancy above is mostly due to the fact that the library on one machine isn't seeing some of my tv shows, for some reason. I dont think it's a problem with quicksync.
Reply
#9
Hi, great script! I've noticed a bug though: it crashes on filenames with special characters like é and ñ.

Also, and I'm not 100% sure about this, I suspect this script is causing xbmc to hang once in a while.
Reply
#10
Is this script already unsupported?
Reply
#11
I wanted to ask how to use this script. Is there a install guide somewhere?

Thank you.
Reply
#12
Are there any new updates to this script?
Reply
#13
Hi all.
I've installed this plugin in my Asus tablet but something is happening and it doesn't work.
My problem is that xbmc doesn't write the txt file and doesn't read it when my other xbmc instance write it.
I've checked the rights and everything seems to be OK.
I've also tried to set the folder with a local path inside the tablet but nothing.
Can someone help me?
Ask me for further info.
Thx.
Reply
#14
Any chance of updating this to work with Frodo?
Reply
#15
would love to try this adddon for frodo.
Reply

Logout Mark Read Team Forum Stats Members Help
[Release] - QuickSync - Syncronize watched status across multiple XBMC installations.0