From 7ce157accd969691e9feffddd48edae235534f31 Mon Sep 17 00:00:00 2001 From: croneter Date: Thu, 15 Feb 2018 20:15:53 +0100 Subject: [PATCH] Wipe all resume points before resyncing them --- resources/lib/kodidb_functions.py | 6 ++++++ resources/lib/librarysync.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index 2d7cc34e..6d53b142 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -970,6 +970,12 @@ class Kodidb_Functions(): resume = None return resume + def delete_all_playstates(self): + """ + Entirely resets the table bookmark and thus all resume points + """ + self.cursor.execute("DELETE FROM bookmark") + def addPlaystate(self, fileid, resume_seconds, total_seconds, playcount, dateplayed): # Delete existing resume point query = ' '.join(( diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 61128f6e..d9c37a6f 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -247,6 +247,9 @@ class LibrarySync(Thread): # Set views. Abort if unsuccessful if not self.maintainViews(): return False + # Delete all existing resume points first + with kodidb.GetKodiDB('video') as kodi_db: + kodi_db.delete_all_playstates() process = { 'movies': self.PlexMovies,