2012-03-23, 01:54
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.
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
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.
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