Kodi Community Forum

Full Version: [RELEASE] Export Watched Data - Backup your watched status
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
This script is exactly, what I was looking for, but it doesn't work out for me.

Export tells me 465 flags found and saved.
After import all movies are marked as watched.

What happened?
I have all my videos as DVD rips on my HDD, means they are sorted in:

Moviename
> Video_TS
>> Video_ts.ifo

Now there are 465 entries in the XML export file, all with Video_ts.ifo as movie name.
So after importing, all DVDs were marked as watched.

Is there a way to handle it?
(2012-08-28, 14:30)MicF Wrote: [ -> ]This script is exactly, what I was looking for, but it doesn't work out for me.

Export tells me 465 flags found and saved.
After import all movies are marked as watched.

What happened?
I have all my videos as DVD rips on my HDD, means they are sorted in:

Moviename
> Video_TS
>> Video_ts.ifo

Now there are 465 entries in the XML export file, all with Video_ts.ifo as movie name.
So after importing, all DVDs were marked as watched.

Is there a way to handle it?

That is a limitation with this backup script, as it uses the filename, which doesn't work properly in your case. I developed my own script (unreleased) which handles all this issue based on on a standard database backup.
are you going to release it?
I didn't know about this, but I've kept track of watched status w/in the NFOs.
Then I used a vb script I wrote to manually update the SQL tables (from the NFOs), but also found out there is a xml setting to tell it to read that value from the NFO too.
transcender if you use nfo for all your files then you can use the built in system, this is built more for people that don't.
MicF I think you might get better response if you ask him in a PM Wink

Now please let this thread sleep unless there are questions about the old script.

The new thread for the working addon is here: http://forum.xbmc.org/showthread.php?tid=129448
(2012-09-08, 00:23)MicF Wrote: [ -> ]are you going to release it?

You can find it here:

script.movies.importwatched.zip

Please note: tested only for private purpose by now.


thanx, will try.
I had to rebuild my db this week. Trakt utility can do this now also fyi if you want an alternative
(2012-10-05, 13:53)MicF Wrote: [ -> ]thanx, will try.

Any Feedback if it worked?
(2012-10-05, 12:32)thica Wrote: [ -> ]
(2012-09-08, 00:23)MicF Wrote: [ -> ]are you going to release it?

You can find it here:

script.movies.importwatched.zip

Please note: tested only for private purpose by now.

hi, will this work on the latest frodo beta?

thanks!
(2012-12-12, 14:17)bigbear77 Wrote: [ -> ]hi, will this work on the latest frodo beta?

thanks!

I didn't Install any betas, so I can't confirm or deny

doesnt work in frodo because there is no more Http
okay, thanks for the info saitoh183!
Here is a Python script that I quickly whipped up when I saw the current script is not compatible with FRODO.

This script is for interacting with a MySQL implementation ONLY however you can easily change it to talk to the local SQlite database instead, SQL queries will be the same.

This will basically do the same thing, query all files that are "watched", save the play count, date watched and name to a file then when you import lookup each file by name and mark it as watched - simple!

You will need MySQL connector for python.

http://pastebin.com/gNvK2LNg

Code:
import MySQLdb as mdb
import sys
import cPickle

# change to import for import and export for export
MODE = "import"

try:
    #enter your MySQL server ip address here and your username/password will be xbmc/xbmc if you used guide on the wiki
    con = mdb.connect('192.168.1.10', 'xbmc', 'xbmc');
    cur = con.cursor()
    
    if MODE == "export":
        cur.execute('SELECT strFileName, lastPlayed, playCount FROM mainvideo75.files WHERE playCount >= 1 and strFileName != "";')
        rows = cur.fetchall()
        for row in rows:
            print row
        cPickle.dump(rows, open('watchedItems.p', 'wb'))
        print "Exported"
    else:
        rows = cPickle.load(open('watchedItems.p', 'rb'))
        for row in rows:
            qu = "UPDATE `mainvideo75`.`files` SET playCount = {}, lastPlayed = '{}' WHERE strFileName= '{}';".format(row[2],con.escape_string(row[1]),con.escape_string(row[0]))
            cur.execute(qu)
            print con.info() ,", Command ::> ", qu
        con.commit()
        print "Imported"
        print con.info()
        
except mdb.Error, e:
    print "Error %d: %s" % (e.args[0],e.args[1])
    sys.exit(1)
    
finally:    
    if con:    
        con.close()

Enjoy!

Tom
About the same thing, but import only, and in Ruby: https://github.com/JustinAiken/xbmc_watc...s_importer
Pages: 1 2 3 4 5 6 7