From 3ecf89732e03be1f0cd18a6682201b9239d812d8 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Fri, 5 Feb 2021 23:28:39 +0100 Subject: [PATCH] porting visto del vecchio db nel nuovo --- service.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/service.py b/service.py index 9cf9adfd..0ea82430 100644 --- a/service.py +++ b/service.py @@ -451,6 +451,24 @@ if __name__ == "__main__": # handling old autoexec method if config.is_autorun_enabled(): config.enable_disable_autorun(True) + # port old db to new + old_db_name = filetools.join(config.get_data_path(), "kod_db.sqlite") + if filetools.isfile(old_db_name): + import sqlite3 + from core import db + + old_db_conn = sqlite3.connect(old_db_name, timeout=15) + old_db = old_db_conn.cursor() + old_db.execute('select * from viewed') + + for ris in old_db.fetchall(): + if ris[1]: # tvshow + show = db['viewed'].get(ris[0], {}) + show[str(ris[1]) + 'x' + str(ris[2])] = ris[3] + db['viewed'][ris[0]] = show + else: # film + db['viewed'][ris[0]] = ris[3] + filetools.remove(old_db_name) monitor = AddonMonitor() # mark as stopped all downloads (if we are here, probably kodi just started)