[RELEASE] Watched Data Export/Import - Programs Addon

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Brick  [RELEASE] Watched Data Export/Import - Programs Addon
Post: #1
Watched Data Export/Import - Programs Addon

This addon creates a backup of your watched data so you can import it back in at a later time.
It saves the name of the file so even if your path changes or you unpack packed files it will still mark them as watched.

Download:
http://code.google.com/p/xbmc-watched-da...loads/list

Install:
  1. Download the latest version zip.
  2. Start XBMC.
  3. Goto System->Settings->Add-Ons->Install from zip file.
  4. Find the location of the downloaded file.
  5. Install.


Options:
  • XML-file path:
    Location for the watched data file. (default is local database folder)
  • Export file name only (for RAR archives).
    Check this to save only the file name and not the whole path. (default ON)
  • Amount of simultaneous sql inserts.
    This will speed up the process of importing watched data. (default 40)
    When turned off (slider = 0) it will import the exact amount of watched times.
  • More debug info in xbmc.log.
    Will print some debug info into the log file. (default OFF)

Other stuff:
  • If you have your tv episodes named with only season and episode number (ie. s01e01.avi) or movies without name, this addon won't work for you. Sad
  • If you get an error like "ERROR: Error Contents: invalid literal for float(): true", just go into the options and press OK.

Changelog:
Code:
1.3.4
- Fixed problem with special characters.

1.3.3
- Option to set path for the xml file. (default is local database folder)
- Fixed error when file is missing during import.

1.3.2
- Temp fix for when a filename starts with s, seems like the %% don't get all way through.

1.3.1
- Fixed missing count value in old files could lead to error.
- Added lastPlayed info.

1.3.0
- Exports playcount to the xml-file also.
- Quick import got changed so the user can set own value (default 40). If set to 0 it will import the playcount from the xml-file otherwise playcount = 1.
- Rewrote some code to clean it up a bit.

1.2.8
- Added id to the file element with the fileID from the db.

1.2.7
- Fixed error when an empty sub element was returned from ET.

1.2.6
- Fixed problems with import of ElementTree in some cases.

1.2.5
- Quick import option, makes 10 updates at once (need some more testing).

1.2.4
- Added some options, debug output and to skip the long rar paths.

1.2.2
- Hopefully fixed the UTF problem.

1.2.1
- Using the httpAPI to solve the problem with different type of databases.

1.2.0
- Cleaned out some unnecessary files in the resources folder.

1.1.2
- Should now follow the xbmc addon rules better.

1.0.1
- Made it work with nightly 20110731.

1.0.0
- ericwilkison's script portet to an addon.

The original thread started by ericwilkison can be found here:
http://forum.xbmc.org/showthread.php?tid=62874

If you find any spelling mistakes you can keep them ;)
(This post was last modified: 2012-09-20 14:52 by Fox.)
find quote
TugboatBill Offline
Posting Freak
Posts: 829
Joined: Oct 2009
Reputation: 7
Post: #2
I'm having a problem getting this to work. I'm exporting on a Dharma XBMCLive client and importing to a Eden XBMCBuntu client. I'm using the MySql database.

Export on the Dharma client worked. A quick review of the .xbmc/userdtat/Database/watched.xml file looked good.

Copied the file over to the appropriate location on the Eden client. Ran the import and it completed without errors (~1500 files imported).

Videos don't show marked as watched.

Re-ran it with the debug option. It posted data to xbmc.log showing the database update commands, but no errors.

Any ideas?
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #3
That sounds weird, never ran into something like that.
Only thing I can think of right now is if the db is write protected or something like that but then it should give an error in return.

I'm abroad atm and here I don't have a mysql setup, but I will make a virtual environment with it and do some testing.

Maybe you could turn on the full debug in XBMC and see if it gives some more useful information.

If you find any spelling mistakes you can keep them ;)
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #4
Sorry TugboatBill no luck reproducing your "error" here. I set up a mysql here and tried a few things I thought could cause it, but none gave your result. Sad
Have you had the chance to get a full debug log and see if it gives anything useful?

Some other things you could check for me...
*regular library update works?
*manually marking a video as watched works?
*did the import mark any video as watched at all?
*did you run the quick import (sql inserts > 0) or the slow one?

If you find any spelling mistakes you can keep them ;)
find quote
TugboatBill Offline
Posting Freak
Posts: 829
Joined: Oct 2009
Reputation: 7
Post: #5
I gave up trying and went with a "can't fail" approach. A pen and paper. Fortunately I only had a dozen unwatched movies and shows tended to be watched sequentially so I was able to mark things manually without too much effort. My problem probably wasn't to do with this addon as I saw the problem before when I migrated from Dharma to Eden.
find quote
Monkeysweat Offline
Member
Posts: 53
Joined: Jun 2010
Reputation: 0
Post: #6
hopefully this works, I've had 3 hard drive crashes over past year and I have to always go back and mark my watched - PITA when you got 1400 movies and 100 different series

I just got my new SSD back today and I'll be reinstalling windows (and XBMC) again

PS OCZ Vertex II not reliable,, hopefully the agility III is better.
find quote
akuiraz Offline
Member
Posts: 77
Joined: Apr 2010
Reputation: 0
Post: #7
I see that you have added file id support from the db... could you add support for using thetvdb episode id? I believe that would allow it to make episodes as watched regardless of the actual file name and extension.

an example scenario where this would be useful:

I've got Bones added to my library using an addon like IceLibrary or 1Channel... and the current season I have sickbeard downloading the episodes. I do it like this so that I have access to the older seasons using .strm file's and the new episodes are downloaded as they release. unfortunatly this causes there to be duplicates of the current season as it has boyh .strm and .mp4/.avi files...

I think adding the tvdb episode id to the export/import would solve this by marking both copies as watched when seen. thanks

[Image: widget]
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #8
Sounds very reasonable akuiraz, but from what I could find (just from a quick glance) the id from thetvdb isn't saved anywhere in the db so that would make it quite slow to do a lookup for every file to get the id.
I saw that the series id was saved so maybe I could use that combined with the season and episode number to make something useful.

I'll have a look into it and see what I can do.

If you find any spelling mistakes you can keep them ;)
find quote
MeMeMe Offline
Senior Member
Posts: 171
Joined: Sep 2011
Reputation: 5
Post: #9
I just tested this and it worked well. On one of my xbmc installs, i have two profiles with different libraries. Will this create separate watched files for each library?
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #10
No, it will create one for the whole db.
Didn't even knew you could have separate libraries in the same db, something I'll have to look into.

If you find any spelling mistakes you can keep them ;)
find quote
acandido Offline
Donor
Posts: 56
Joined: Feb 2011
Reputation: 1
Location: Toronto
Post: #11
Thanks for this!

I modified it a bit to include the lastPlayed field since I use that field to build some smart playlists. I am in no way a coder but here's my edit. This will only work if quickexec is set to 0, I was too lazy to modify the other if statement stuff.
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #12
Thanks acandido thats a good idea, the pastebin didn't work for me though. Sad
But no worries, I'll add that, I'm in the process of working out the tvshow id and stuff so I'll add the lastPlayed at the same time.

If you find any spelling mistakes you can keep them ;)
(This post was last modified: 2012-05-18 23:47 by Fox.)
find quote
Monkeysweat Offline
Member
Posts: 53
Joined: Jun 2010
Reputation: 0
Post: #13
Is it possible to have this import saved data from another pc to remote pc on same network. I just got a rasp Pi and it would be great to sync up the watched data from time to time just not every time it boots up
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #14
Sure it would be possible with a timed script or such but why don't you use a shared database instead?

If you find any spelling mistakes you can keep them ;)
find quote
Monkeysweat Offline
Member
Posts: 53
Joined: Jun 2010
Reputation: 0
Post: #15
I don't even need a times script. I have no problem triggering the sync every couple weeks. Sharing the library has been considered. But the raspberry Pi is not really fast at importing stuff and I don't know how it will affect overall usage of the system It took almost 24 hours to import the library initially. For some reason it takes the Pi a minute or two per movie and about 20 to 30 seconds per tv episode to give you an idea. Actually navigating the library isn't too bad I can say it is similar to a slower pc but playback is damn near perfect I haven't played a lot of files but haven't found anything that doesn't play from my library. This script seems to give you no option to export to another machine or to import from another machine. Is there a file created by the script that I could share between the machines that would share the watched data or is it possible to get this feature added to this script? It would obviously only work on machines working from the same files anyways
find quote
Post Reply