diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index 0f4b1cb7..1bb27ab1 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -82,12 +82,6 @@ def mark_auto_as_watched(item): nextdialog.close() break - # if item.options['continue']: - if (marked and total_time < 20) or not marked: - item.disableAutoplay=True - platformtools.serverWindow(item, itemlist) - - platformtools.set_played_time(item) # Silent sync with Trakt if sync and config.get_setting("trakt_sync"): sync_trakt_kodi() @@ -95,6 +89,11 @@ def mark_auto_as_watched(item): while platformtools.is_playing(): xbmc.sleep(300) + if (marked and total_time < 20) or not marked: + platformtools.set_played_time(item.clone(played_time=actual_time)) + item.disableAutoplay=True + platformtools.serverWindow(item, itemlist) + if next_episode and next_episode.next_ep and config.get_setting('next_ep') < 3: from platformcode.launcher import run xbmc.sleep(1000) diff --git a/specials/globalsearch.py b/specials/globalsearch.py index bef82a3b..bc1dfaad 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -23,6 +23,7 @@ close_action = False update_lock = threading.Lock() moduleDict = {} searchActions = [] +thread = None def busy(state): @@ -78,6 +79,7 @@ EPISODESLIST = 200 SERVERLIST = 300 class SearchWindow(xbmcgui.WindowXML): + global thread def start(self, item, thActions=None): logger.debug() self.exit = False @@ -538,8 +540,8 @@ class SearchWindow(xbmcgui.WindowXML): if self.item.type: self.item.mode = self.item.type self.item.text = scrapertools.title_unify(self.item.text) - self.thread = Thread(target=self.search) - self.thread.start() + thread = Thread(target=self.search) + thread.start() elif self.item.mode in ['movie', 'tvshow', 'person_']: self.select() elif self.item.mode in ['person']: @@ -738,11 +740,11 @@ class SearchWindow(xbmcgui.WindowXML): def Close(self): self.exit = True - if self.thread: + if thread and thread.is_alive(): busy(True) for th in self.search_threads: th.cancel() - self.thread.join() + thread.join() busy(False) self.close()