Fix Kodi crashing on low powered devices

- Fixes #126
This commit is contained in:
tomkat83 2016-10-17 22:34:15 +02:00
parent e001be5840
commit cd65a93989
6 changed files with 25 additions and 12 deletions

View file

@ -306,7 +306,7 @@
<string id="30540">Download movie set/collection art from FanArtTV</string>
<string id="30541">Don't ask to pick a certain stream/quality</string>
<string id="30542">Always pick best quality for trailers</string>
<string id="30543">Sleep between art downloads [ms]</string>
<string id="30543">Kodi runs on a low-power device (e.g. Raspberry Pi)</string>
<string id="30544">Artwork</string>
<!-- service add-on -->

View file

@ -32,7 +32,7 @@
<string id="30540">FanArtTV Film-Sets/Collections Bilder herunterladen</string>
<string id="30541">Nicht fragen, welcher Stream/Qualität gespielt wird</string>
<string id="30542">Trailer immer in der besten Qualität abspielen</string>
<string id="30543">Wartezeit zwischen Bilder downloads [ms]</string>
<string id="30543">Kodi läuft auf langsamer Hardware (z.B. Raspberry Pi)</string>
<string id="30544">Artwork</string>
<string id="30014">Verbindung</string>

View file

@ -132,7 +132,14 @@ def double_urldecode(text):
class Image_Cache_Thread(Thread):
xbmc_host = 'localhost'
xbmc_port, xbmc_username, xbmc_password = setKodiWebServerDetails()
sleep_between = int(settings('sleep_between_art_downloads'))
sleep_between = 50
if settings('low_powered_device') == 'true':
# Low CPU, potentially issues with limited number of threads
# Hence let Kodi wait till download is successful
timeout = (35.1, 35.1)
else:
# High CPU, no issue with limited number of threads
timeout = (0.01, 0.01)
def __init__(self, queue):
self.queue = queue
@ -164,7 +171,7 @@ class Image_Cache_Thread(Thread):
url="http://%s:%s/image/image://%s"
% (self.xbmc_host, self.xbmc_port, url),
auth=(self.xbmc_username, self.xbmc_password),
timeout=(0.01, 0.01))
timeout=self.timeout)
except requests.Timeout:
# We don't need the result, only trigger Kodi to start the
# download. All is well

View file

@ -417,6 +417,14 @@ class InitialSetup():
if settings('InstallQuestionsAnswered') == 'true':
return
# Is your Kodi installed on a low-powered device like a Raspberry Pi?
# If yes, then we will reduce the strain on Kodi to prevent it from
# crashing.
if dialog.yesno(heading=addonName, line1=lang(39072)):
settings('low_powered_device', value="true")
else:
settings('low_powered_device', value="false")
# Additional settings where the user needs to choose
# Direct paths (\\NAS\mymovie.mkv) or addon (http)?
goToSettings = False
@ -463,10 +471,6 @@ class InitialSetup():
log.debug("User opted to use FanArtTV")
settings('FanartTV', value="true")
# Is your Kodi installed on a low-powered device like a Raspberry Pi?
# If yes, then we will reduce the strain on Kodi to prevent it from
# crashing.
# Make sure that we only ask these questions upon first installation
settings('InstallQuestionsAnswered', value='true')

View file

@ -43,11 +43,11 @@
<category label="30506"><!-- Sync Options -->
<setting type="lsep" label="30537" /><!-- Restart if you make changes -->
<setting id="syncEmptyShows" type="bool" label="30508" default="false" visible="false"/>
<setting id="dbSyncIndicator" label="30507" type="bool" default="true" />
<setting type="sep" /><!-- show syncing progress -->
<setting id="limitindex" type="number" label="30515" default="200" option="int" /><!-- Maximum items to request from the server at once -->
<setting id="dbSyncIndicator" label="30507" type="bool" default="true" /><!-- show syncing progress -->
<setting type="sep" />
<setting id="low_powered_device" type="bool" label="30543" default="true" /> <!-- Installation on low-powered device? (e.g. Raspberry Pi) -->
<setting id="syncThreadNumber" type="slider" label="39003" default="5" option="int" range="1,1,20"/>
<setting id="sleep_between_art_downloads" type="slider" label="30543" default="50" option="int" range="100,100,5000" visible="eq(-1,true)"/> <!-- Sleep between art downloads [ms] -->
<setting id="limitindex" type="number" label="30515" default="200" option="int" /><!-- Maximum items to request from the server at once -->
<setting type="lsep" label="39052" /><!-- Background Sync -->
<setting id="enableBackgroundSync" type="bool" label="39026" default="true" visible="true"/>
<setting id="saftyMargin" type="slider" label="39051" default="60" option="int" range="10,1,300" visible="eq(-1,true)"/>

View file

@ -85,6 +85,8 @@ class Service():
log.warn("%s Version: %s" % (addonName, self.clientInfo.getVersion()))
log.warn("Using plugin paths: %s"
% (settings('useDirectPaths') != "true"))
log.warn("Using a low powered device: %s"
% settings('low_powered_device'))
log.warn("Log Level: %s" % logLevel)
# Reset window props for profile switch