Restore MySQL Watched Flags (Windows)
#1
So it seems like every so often something goes wrong with my MySQL library and I end up starting over. In the process I either loosing all my watched tags or having to manually go through the library and create a list of watched episodes and/or movies. Although I believe you can restore them from your nfo's, those are not always up-to-date or even exist.

After spending some time researching MySQL to identify where it stores the watched flag, I was able to create a script that would restore the watched flags from one MySQL database to another. The script will also allow you to backup and restore MySQL databases either manually or automatically (through use of a scheduler).

There are a couple of caveats.....The first being that I just wrote this yesterday and while it *appears* to be working, I'm sure there will be some bugs. The other is I only tested this on MySQL Server 5.5 with a xbmc frodo library. I am not sure if the library table and columns that contain the watched tags are different between xbmc generations. This means that it may or may not work when migrating watched tags between generations or on libraries prior to frodo. However, the database backup and restore functions should work on any xbmc library generation. And of course, I do not offer any guarantees either explicit or inferred. USE AT YOUR OWN RISK.

myUpdate.vbs is a command line tool. It can be automated through scripts and/or batch files. While I considered writing it in VB.net, I assumed some would not have .net installed and other users may like to tinker with the code/concept. You are welcome to view and alter any of the code, however, please do not redistribute without contacting me first. By the way, this will only work with MySQL databases, not xbmc's integrated databases.

Hopefully you will find myUpdate.vbs to be useful and fairly straight forward.

To use it, open cmd (in XP: click start and then run, type cmd and press enter; in 7: click start, type cmd in the search box, and press enter).

In cmd, type:

cd desktop (if you copied myUpdate.vbs to your desktop, otherwise, cd <path-to-myUpdate>)
cscript myUpdate.vbs (will list the help page for usage syntax)

You must run setup first (cscript myUpdate.vbs /S <path-to-mysql.exe> <user name> <password>). This will create a registry key in HKLM\Software\myUpdate.vbs with the path, user name, and password. You do not need to do this every time. myUpdate will read the registry keys at launch. However, if your user name and/or password changes, or your MySQL path changes, you will need to run setup again.


1/29/2013 - A new version is available. The only difference is now the /W command will preserve existing watched flags in the database being updated.

Download: myUpdate.vbs
Reply

Logout Mark Read Team Forum Stats Members Help
Restore MySQL Watched Flags (Windows)0