2019-11-08, 18:40
Quick&dirty script to mark your rated movies on imdb as watched:
Save the script, (s)cp your current .kodi/userdata/addon_data/service.watchedlist/watchedlist.db next it to, same with your ratings.csv (exported from your imdb account) and run the script. Rated movies will be marked as watched. (s)cp watchedlist.db back, and just run the addon.
Maybe some
Code:
#!/usr/bin/env python3
import sqlite3
import csv
import datetime
q_select = '''select * from movie_watched where idMovieImdb=?'''
q_insert = '''insert into movie_watched ('idMovieImdb','playCount','lastChange','lastPlayed','title') values (?,?,?,?,?)'''
db = sqlite3.connect('watchedlist.db')
c = db.cursor()
f = open('ratings.csv', encoding = 'iso8859')
f.readline()
csv = csv.reader(f, delimiter = ',', quotechar = '"')
for i in csv:
iid = int(i[0][2:])
d = datetime.datetime.fromisoformat(i[2]).timestamp()
title = i[3]
c.execute(q_select, (iid,))
if c.fetchone() != None:
print('skipping', iid, title)
continue
print('adding', iid, title)
c.execute(q_insert, (int(i[0][2:]), 1, d, d, i[3]))
db.commit()
c.close()
Save the script, (s)cp your current .kodi/userdata/addon_data/service.watchedlist/watchedlist.db next it to, same with your ratings.csv (exported from your imdb account) and run the script. Rated movies will be marked as watched. (s)cp watchedlist.db back, and just run the addon.
Maybe some