Enable library sync threads to crash correctly
This commit is contained in:
parent
40c02395a2
commit
0f73bf1840
1 changed files with 24 additions and 2 deletions
|
@ -46,9 +46,10 @@ class ThreadedGetMetadata(threading.Thread):
|
|||
self.lock = lock
|
||||
self.userStop = userStop
|
||||
self._shouldstop = threading.Event()
|
||||
self.addonName = clientinfo.ClientInfo().getAddonName()
|
||||
threading.Thread.__init__(self)
|
||||
|
||||
def run(self):
|
||||
def run_internal(self):
|
||||
plx = PlexAPI.PlexAPI()
|
||||
global getMetadataCount
|
||||
while self.stopped() is False:
|
||||
|
@ -72,6 +73,16 @@ class ThreadedGetMetadata(threading.Thread):
|
|||
# signals to queue job is done
|
||||
self.queue.task_done()
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.run_internal()
|
||||
except Exception as e:
|
||||
xbmcgui.Dialog().ok(self.addonName,
|
||||
"A sync thread has exited! "
|
||||
"You should restart Kodi now. "
|
||||
"Please report this on the forum.")
|
||||
raise
|
||||
|
||||
def stopThread(self):
|
||||
self._shouldstop.set()
|
||||
|
||||
|
@ -98,9 +109,10 @@ class ThreadedProcessMetadata(threading.Thread):
|
|||
self.itemType = itemType
|
||||
self.userStop = userStop
|
||||
self._shouldstop = threading.Event()
|
||||
self.addonName = clientinfo.ClientInfo().getAddonName()
|
||||
threading.Thread.__init__(self)
|
||||
|
||||
def run(self):
|
||||
def run_internal(self):
|
||||
# Constructs the method name, e.g. itemtypes.Movies
|
||||
itemFkt = getattr(itemtypes, self.itemType)
|
||||
global processMetadataCount
|
||||
|
@ -132,6 +144,16 @@ class ThreadedProcessMetadata(threading.Thread):
|
|||
# signals to queue job is done
|
||||
self.queue.task_done()
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.run_internal()
|
||||
except Exception as e:
|
||||
xbmcgui.Dialog().ok(self.addonName,
|
||||
"A sync thread has exited! "
|
||||
"You should restart Kodi now. "
|
||||
"Please report this on the forum.")
|
||||
raise
|
||||
|
||||
def stopThread(self):
|
||||
self._shouldstop.set()
|
||||
|
||||
|
|
Loading…
Reference in a new issue