From da7d871af84bd90e63539ca66fc07e96f65a8598 Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 9 Nov 2018 15:05:17 +0100 Subject: [PATCH] Add Plex type to sync progress bar --- resources/lib/library_sync/process_metadata.py | 6 ++++-- resources/lib/variables.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/resources/lib/library_sync/process_metadata.py b/resources/lib/library_sync/process_metadata.py index f0c467a5..54fd8632 100644 --- a/resources/lib/library_sync/process_metadata.py +++ b/resources/lib/library_sync/process_metadata.py @@ -8,7 +8,7 @@ from pstats import Stats from StringIO import StringIO from . import common -from .. import backgroundthread, utils +from .. import backgroundthread, utils, variables as v LOG = getLogger('PLEX.sync.process_metadata') @@ -66,7 +66,7 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin): except ZeroDivisionError: progress = 0 self.dialog.update(progress, - self.section_name, + '%s: %s' % (self.section_type_text, self.section_name), '%s/%s: %s' % (self.current, self.total, self.title)) @@ -93,6 +93,8 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin): self.processed = 0 self.total = section.total self.section_name = section.name + self.section_type_text = utils.lang( + v.TRANSLATION_FROM_PLEXTYPE[section.plex_type]) profile = Profile() profile.enable() with section.context(self.last_sync) as context: diff --git a/resources/lib/variables.py b/resources/lib/variables.py index a8ef0e16..887477fd 100644 --- a/resources/lib/variables.py +++ b/resources/lib/variables.py @@ -332,6 +332,17 @@ REMAP_TYPE_FROM_PLEXTYPE = { } +TRANSLATION_FROM_PLEXTYPE = { + PLEX_TYPE_MOVIE: 342, + PLEX_TYPE_EPISODE: 20360, + PLEX_TYPE_SEASON: 20373, + PLEX_TYPE_SHOW: 20343, + PLEX_TYPE_SONG: 134, + PLEX_TYPE_ARTIST: 133, + PLEX_TYPE_ALBUM: 132, + PLEX_TYPE_PHOTO: 1, +} + REMAP_TYPE_FROM_PLEXTYPE = { 'movie': 'movie', 'show': 'tv',