mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Plug in settings for threading
This commit is contained in:
parent
026095722c
commit
b35cd29bc2
3 changed files with 30 additions and 17 deletions
|
@ -849,3 +849,15 @@ msgstr ""
|
||||||
msgctxt "#33173"
|
msgctxt "#33173"
|
||||||
msgid "Forget about the previous sync? This is not recommended."
|
msgid "Forget about the previous sync? This is not recommended."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#33174"
|
||||||
|
msgid "Paging - download threads (default: 3)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#33175"
|
||||||
|
msgid "Paging tip: Each download thread requests your max items value from Emby at the same time."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#33176"
|
||||||
|
msgid "Update or repair your libraries to apply the changes below."
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -16,11 +16,14 @@ from full_sync import FullSync
|
||||||
from views import Views
|
from views import Views
|
||||||
from downloader import GetItemWorker
|
from downloader import GetItemWorker
|
||||||
from helper import _, stop, settings, window, dialog, event, progress, LibraryException
|
from helper import _, stop, settings, window, dialog, event, progress, LibraryException
|
||||||
|
from helper.utils import split_list
|
||||||
from emby import Emby
|
from emby import Emby
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
LOG = logging.getLogger("EMBY."+__name__)
|
LOG = logging.getLogger("EMBY."+__name__)
|
||||||
|
LIMIT = min(int(settings('limitIndex') or 50), 50)
|
||||||
|
DTHREADS = int(settings('limitThreads') or 3)
|
||||||
MEDIA = {
|
MEDIA = {
|
||||||
'Movie': Movies,
|
'Movie': Movies,
|
||||||
'BoxSet': Movies,
|
'BoxSet': Movies,
|
||||||
|
@ -119,7 +122,7 @@ class Library(threading.Thread):
|
||||||
threads.remove(thread)
|
threads.remove(thread)
|
||||||
|
|
||||||
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) < 5:
|
if queue[0].qsize() and len(self.download_threads) < DTHREADS:
|
||||||
|
|
||||||
new_thread = GetItemWorker(self.server, queue[0], queue[1])
|
new_thread = GetItemWorker(self.server, queue[0], queue[1])
|
||||||
new_thread.start()
|
new_thread.start()
|
||||||
|
@ -183,8 +186,10 @@ class Library(threading.Thread):
|
||||||
|
|
||||||
if xbmc.getCondVisibility('Container.Content(musicvideos)'): # Prevent cursor from moving
|
if xbmc.getCondVisibility('Container.Content(musicvideos)'): # Prevent cursor from moving
|
||||||
xbmc.executebuiltin('Container.Refresh')
|
xbmc.executebuiltin('Container.Refresh')
|
||||||
else:
|
elif not xbmc.getCondVisibility('Window.IsMedia'): # Update widgets
|
||||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||||
|
else: # Update listing
|
||||||
|
xbmc.executebuiltin('Container.Refresh')
|
||||||
|
|
||||||
def stop_client(self):
|
def stop_client(self):
|
||||||
self.stop_thread = True
|
self.stop_thread = True
|
||||||
|
@ -467,14 +472,12 @@ class Library(threading.Thread):
|
||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
|
|
||||||
for item in data:
|
items = [x['ItemId'] for x in data]
|
||||||
|
|
||||||
if item in list(self.userdata_queue.queue):
|
for item in split_list(items, LIMIT):
|
||||||
continue
|
self.userdata_queue.put(item)
|
||||||
|
|
||||||
self.userdata_queue.put(item['ItemId'])
|
LOG.info("---[ userdata:%s ]", len(items))
|
||||||
|
|
||||||
LOG.info("---[ userdata:%s ]", self.userdata_queue.qsize())
|
|
||||||
|
|
||||||
def updated(self, data):
|
def updated(self, data):
|
||||||
|
|
||||||
|
@ -483,14 +486,10 @@ class Library(threading.Thread):
|
||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
|
|
||||||
for item in data:
|
for item in split_list(data, LIMIT):
|
||||||
|
|
||||||
if item in list(self.updated_queue.queue):
|
|
||||||
continue
|
|
||||||
|
|
||||||
self.updated_queue.put(item)
|
self.updated_queue.put(item)
|
||||||
|
|
||||||
LOG.info("---[ updated:%s ]", self.updated_queue.qsize())
|
LOG.info("---[ updated:%s ]", len(data))
|
||||||
|
|
||||||
def removed(self, data):
|
def removed(self, data):
|
||||||
|
|
||||||
|
@ -506,7 +505,7 @@ class Library(threading.Thread):
|
||||||
|
|
||||||
self.removed_queue.put(item)
|
self.removed_queue.put(item)
|
||||||
|
|
||||||
LOG.info("---[ removed:%s ]", self.removed_queue.qsize())
|
LOG.info("---[ removed:%s ]", len(data))
|
||||||
|
|
||||||
|
|
||||||
class UpdatedWorker(threading.Thread):
|
class UpdatedWorker(threading.Thread):
|
||||||
|
|
|
@ -21,16 +21,18 @@
|
||||||
<category label="30506"><!-- Sync Options -->
|
<category label="30506"><!-- Sync Options -->
|
||||||
<setting label="33137" id="kodiCompanion" type="bool" default="true" />
|
<setting label="33137" id="kodiCompanion" type="bool" default="true" />
|
||||||
<setting label="30507" id="syncIndicator" type="number" default="99" visible="eq(-1,true)" subsetting="true"/>
|
<setting label="30507" id="syncIndicator" type="number" default="99" visible="eq(-1,true)" subsetting="true"/>
|
||||||
|
<setting label="30536" id="dbSyncScreensaver" type="bool" default="true" />
|
||||||
<setting label="33111" type="lsep" />
|
<setting label="33111" type="lsep" />
|
||||||
<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 type="sep" />
|
<setting label="33175" type="lsep" />
|
||||||
<setting label="30515" id="limitIndex" type="number" default="15" option="int" />
|
<setting label="30515" id="limitIndex" type="number" default="15" option="int" />
|
||||||
|
<setting label="33174" id="limitThreads" type="number" default="3" option="int" />
|
||||||
|
<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" />
|
||||||
<setting label="33116" id="compressArt" type="bool" default="false" />
|
<setting label="33116" id="compressArt" type="bool" default="false" />
|
||||||
<setting label="30508" id="syncEmptyShows" type="bool" default="false" />
|
<setting label="30508" id="syncEmptyShows" type="bool" default="false" />
|
||||||
<setting label="30536" id="dbSyncScreensaver" type="bool" default="true" />
|
|
||||||
<setting id="enableMusic" visible="false" default="false" />
|
<setting id="enableMusic" visible="false" default="false" />
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue