Merge pull request #197 from druscoe/fix_empty_download_thread_list

Move the responsibility of the maximum number of threads to the UI.
This commit is contained in:
mcarlton00 2020-02-18 20:03:44 -05:00 committed by GitHub
commit de70d9ac60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -23,7 +23,7 @@ from jellyfin import Jellyfin
################################################################################################## ##################################################################################################
LOG = logging.getLogger("JELLYFIN." + __name__) LOG = logging.getLogger("JELLYFIN." + __name__)
LIMIT = min(int(settings('limitIndex') or 50), 50) LIMIT = int(settings('limitIndex') or 15)
DTHREADS = int(settings('limitThreads') or 3) DTHREADS = int(settings('limitThreads') or 3)
MEDIA = { MEDIA = {
'Movie': Movies, 'Movie': Movies,
@ -138,7 +138,8 @@ class Library(threading.Thread):
if not self.player.isPlayingVideo() or settings('syncDuringPlay.bool') or xbmc.getCondVisibility('VideoPlayer.Content(livetv)'): if not self.player.isPlayingVideo() or settings('syncDuringPlay.bool') or xbmc.getCondVisibility('VideoPlayer.Content(livetv)'):
self.worker_downloads() while self.worker_downloads():
pass
self.worker_sort() self.worker_sort()
self.worker_updates() self.worker_updates()
@ -224,6 +225,7 @@ class Library(threading.Thread):
''' Get items from jellyfin and place them in the appropriate queues. ''' Get items from jellyfin and place them in the appropriate queues.
''' '''
added_threads = False
for queue in ((self.updated_queue, self.updated_output), (self.userdata_queue, self.userdata_output)): for queue in ((self.updated_queue, self.updated_output), (self.userdata_queue, self.userdata_output)):
if queue[0].qsize() and len(self.download_threads) < DTHREADS: if queue[0].qsize() and len(self.download_threads) < DTHREADS:
@ -231,6 +233,8 @@ class Library(threading.Thread):
new_thread.start() new_thread.start()
LOG.info("-->[ q:download/%s ]", id(new_thread)) LOG.info("-->[ q:download/%s ]", id(new_thread))
self.download_threads.append(new_thread) self.download_threads.append(new_thread)
added_threads = True
return added_threads
def worker_sort(self): def worker_sort(self):

View file

@ -25,8 +25,8 @@
<setting label="30511" id="useDirectPaths" type="enum" lvalues="33036|33037" default="1" /> <setting label="30511" id="useDirectPaths" type="enum" lvalues="33036|33037" default="1" />
<setting label="33175" type="lsep" /> <setting label="33175" type="lsep" />
<setting label="30515" id="limitIndex" type="number" default="15" option="int" /> <setting label="30515" id="limitIndex" type="slider" default="15" range="1, 1, 100" option="int" />
<setting label="33174" id="limitThreads" type="number" default="3" option="int" /> <setting label="33174" id="limitThreads" type="slider" default="3" range="1, 1, 50" option="int" />
<setting label="33176" type="lsep" /> <setting label="33176" type="lsep" />
<setting label="30512" id="enableTextureCache" type="bool" default="true" /> <setting label="30512" id="enableTextureCache" type="bool" default="true" />
<setting label="30157" id="enableCoverArt" type="bool" default="true" /> <setting label="30157" id="enableCoverArt" type="bool" default="true" />