Merge pull request #1253 from croneter/fix-suspension
Fix suspension of artwork caching and PKC becoming unresponsive
This commit is contained in:
commit
17d84c1f29
1 changed files with 4 additions and 4 deletions
|
@ -82,7 +82,7 @@ class ImageCachingThread(backgroundthread.KillableThread):
|
||||||
for url in self._url_generator(kind, kodi_type):
|
for url in self._url_generator(kind, kodi_type):
|
||||||
if self.should_suspend() or self.should_cancel():
|
if self.should_suspend() or self.should_cancel():
|
||||||
return False
|
return False
|
||||||
cache_url(url)
|
cache_url(url, self.should_suspend)
|
||||||
# Toggles Image caching completed to Yes
|
# Toggles Image caching completed to Yes
|
||||||
utils.settings('plex_status_image_caching', value=utils.lang(107))
|
utils.settings('plex_status_image_caching', value=utils.lang(107))
|
||||||
return True
|
return True
|
||||||
|
@ -95,7 +95,7 @@ class ImageCachingThread(backgroundthread.KillableThread):
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def cache_url(url):
|
def cache_url(url, should_suspend=None):
|
||||||
url = double_urlencode(url)
|
url = double_urlencode(url)
|
||||||
sleeptime = 0
|
sleeptime = 0
|
||||||
while True:
|
while True:
|
||||||
|
@ -113,11 +113,11 @@ def cache_url(url):
|
||||||
# download. All is well
|
# download. All is well
|
||||||
break
|
break
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
if app.APP.stop_pkc:
|
if app.APP.stop_pkc or (should_suspend and should_suspend()):
|
||||||
# Kodi terminated
|
|
||||||
break
|
break
|
||||||
# Server thinks its a DOS attack, ('error 10053')
|
# Server thinks its a DOS attack, ('error 10053')
|
||||||
# Wait before trying again
|
# Wait before trying again
|
||||||
|
# OR: Kodi refuses Webserver connection (no password set)
|
||||||
if sleeptime > 5:
|
if sleeptime > 5:
|
||||||
LOG.error('Repeatedly got ConnectionError for url %s',
|
LOG.error('Repeatedly got ConnectionError for url %s',
|
||||||
double_urldecode(url))
|
double_urldecode(url))
|
||||||
|
|
Loading…
Reference in a new issue