From 55cbf5824d21546fef0804780dac385bd0692c8a Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Fri, 8 Apr 2016 09:24:28 +0200 Subject: [PATCH] Kill sync threads if library gets suspended - E.g. user switch --- resources/lib/itemtypes.py | 5 ++--- resources/lib/librarysync.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 90838315..1325feb5 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -83,6 +83,8 @@ class Items(object): heading=self.addonName, line1=string(39031) + url, line2=string(39032)) + if resp: + utils.window('suspend_LibraryThread', value="true") return resp def itemsbyId(self, items, process, pdialog=None): @@ -1051,7 +1053,6 @@ class TVShows(Items): not xbmcvfs.exists(path.encode('utf-8'))): # Validate the path is correct with user intervention if self.askToValidate(playurl): - utils.window('emby_shouldStop', value="true") return False utils.window('emby_pathverified', value="true") if doIndirect: @@ -1334,7 +1335,6 @@ class TVShows(Items): not xbmcvfs.exists(playurl.encode('utf-8'))): # Validate the path is correct with user intervention if self.askToValidate(playurl): - utils.window('emby_shouldStop', value="true") return False if "\\" in playurl: # Local path @@ -2086,7 +2086,6 @@ class Music(Items): not xbmcvfs.exists(playurl.encode('utf-8'))): # Validate the path is correct with user intervention if self.askToValidate(playurl): - utils.window('emby_shouldStop', value="true") return False if "\\" in playurl: # Local path diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index cfb59e50..d9e0c29a 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -27,7 +27,7 @@ import PlexAPI @utils.logging -@utils.ThreadMethodsAdditionalStop('emby_shouldStop') +@utils.ThreadMethodsAdditionalStop('suspend_LibraryThread') @utils.ThreadMethods class ThreadedGetMetadata(Thread): """ @@ -114,7 +114,7 @@ class ThreadedGetMetadata(Thread): self.terminateNow() -@utils.ThreadMethodsAdditionalStop('emby_shouldStop') +@utils.ThreadMethodsAdditionalStop('suspend_LibraryThread') @utils.ThreadMethods class ThreadedProcessMetadata(Thread): """ @@ -186,7 +186,7 @@ class ThreadedProcessMetadata(Thread): self.terminateNow() -@utils.ThreadMethodsAdditionalStop('emby_shouldStop') +@utils.ThreadMethodsAdditionalStop('suspend_LibraryThread') @utils.ThreadMethods class ThreadedShowSyncInfo(Thread): """