Refresh progress bar for every single item
This commit is contained in:
parent
85c5e15b91
commit
bfef7a346e
1 changed files with 6 additions and 12 deletions
|
@ -4,7 +4,7 @@ from logging import getLogger
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
|
||||||
from . import common
|
from . import common
|
||||||
from .. import backgroundthread, utils, variables as v
|
from .. import backgroundthread, utils
|
||||||
|
|
||||||
LOG = getLogger('PLEX.sync.process_metadata')
|
LOG = getLogger('PLEX.sync.process_metadata')
|
||||||
|
|
||||||
|
@ -49,9 +49,7 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
|
||||||
self.dialog = None
|
self.dialog = None
|
||||||
super(ProcessMetadata, self).__init__()
|
super(ProcessMetadata, self).__init__()
|
||||||
|
|
||||||
def update(self):
|
def update_progressbar(self):
|
||||||
"""
|
|
||||||
"""
|
|
||||||
if self.show_dialog:
|
if self.show_dialog:
|
||||||
try:
|
try:
|
||||||
progress = int(float(self.current) / float(self.total) * 100.0)
|
progress = int(float(self.current) / float(self.total) * 100.0)
|
||||||
|
@ -61,8 +59,6 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
|
||||||
self.section_name,
|
self.section_name,
|
||||||
'%s/%s: %s'
|
'%s/%s: %s'
|
||||||
% (self.current, self.total, self.title))
|
% (self.current, self.total, self.title))
|
||||||
common.update_kodi_library(video=self.is_video,
|
|
||||||
music=not self.is_video)
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
|
@ -78,15 +74,14 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
|
||||||
self.queue.task_done()
|
self.queue.task_done()
|
||||||
if section is None:
|
if section is None:
|
||||||
return
|
return
|
||||||
while self.isCanceled() is False:
|
while not self.isCanceled():
|
||||||
if section is None:
|
if section is None:
|
||||||
break
|
break
|
||||||
self.current = 0
|
self.current = 0
|
||||||
self.total = section.total
|
self.total = section.total
|
||||||
self.section_name = section.name
|
self.section_name = section.name
|
||||||
self.is_video = section.plex_type in v.PLEX_VIDEOTYPES
|
|
||||||
with section.context(self.last_sync) as context:
|
with section.context(self.last_sync) as context:
|
||||||
while self.isCanceled() is False:
|
while not self.isCanceled():
|
||||||
# grabs item from queue. This will block!
|
# grabs item from queue. This will block!
|
||||||
item = self.queue.get()
|
item = self.queue.get()
|
||||||
if isinstance(item, InitNewSection) or item is None:
|
if isinstance(item, InitNewSection) or item is None:
|
||||||
|
@ -102,9 +97,8 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
|
||||||
utils.ERROR(txt='process_metadata crashed',
|
utils.ERROR(txt='process_metadata crashed',
|
||||||
notify=True,
|
notify=True,
|
||||||
cancel_sync=True)
|
cancel_sync=True)
|
||||||
if self.current % 20 == 0:
|
|
||||||
self.title = item['xml'][0].get('title')
|
self.title = item['xml'][0].get('title')
|
||||||
self.update()
|
self.update_progressbar()
|
||||||
self.current += 1
|
self.current += 1
|
||||||
self.queue.task_done()
|
self.queue.task_done()
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in a new issue