From ccdaaf5b4e48e6fa957a3131f9f7aa5be6eedc77 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 3 Mar 2016 09:04:15 +0100 Subject: [PATCH] Fixed video nodes --- resources/lib/librarysync.py | 61 ++++++++++++++++++------------------ resources/lib/videonodes.py | 18 ++++++++--- resources/settings.xml | 2 +- 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index ae61e5c2..da7098c1 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -413,7 +413,7 @@ class LibrarySync(Thread): nodes = self.nodes[mediatype] # Prevent duplicate for playlists of the same type playlists = self.playlists[mediatype] - sorted_views = self.sorted_views[mediatype] + sorted_views = self.sorted_views folderid = folder['key'] foldername = folder['title'] @@ -456,7 +456,6 @@ class LibrarySync(Thread): # Remove views that are still valid to delete rest later try: - # View is still valid self.old_views.remove(folderid) except ValueError: # View was just created, nothing to remove @@ -550,9 +549,6 @@ class LibrarySync(Thread): self.logMsg("Error download PMS views, abort maintainViews", -1) return False - # total nodes for window properties - vnodes.clearProperties() - totalnodes = 0 # For whatever freaking reason, .copy() or dict() does NOT work?!?!?! self.nodes = { 'movie': [], @@ -564,16 +560,17 @@ class LibrarySync(Thread): 'show': [], 'artist': [] } - self.sorted_views = { - 'movie': [], - 'show': [], - 'artist': [] - } + self.sorted_views = [] for view in sections: itemType = view.attrib['type'] if itemType in ('movie', 'show'): # and NOT artist for now - self.sorted_views[itemType].append(view.attrib['title']) + self.sorted_views.append(view.attrib['title']) + self.logMsg('Sorted views: %s' % self.sorted_views, 1) + + # total nodes for window properties + vnodes.clearProperties() + totalnodes = len(self.sorted_views) with embydb.GetEmbyDB() as emby_db: # Backup old views to delete them later, if needed (at the end @@ -585,26 +582,28 @@ class LibrarySync(Thread): kodi_db, emby_db, totalnodes) - else: - # Add video nodes listings - # Plex: there seem to be no favorites/favorites tag - # vnodes.singleNode(totalnodes, - # "Favorite movies", - # "movies", - # "favourites") - # totalnodes += 1 - # vnodes.singleNode(totalnodes, - # "Favorite tvshows", - # "tvshows", - # "favourites") - # totalnodes += 1 - vnodes.singleNode(totalnodes, - "channels", - "movies", - "channels") - totalnodes += 1 - # Save total - utils.window('Emby.nodes.total', str(totalnodes)) + # Add video nodes listings + # Plex: there seem to be no favorites/favorites tag + # vnodes.singleNode(totalnodes, + # "Favorite movies", + # "movies", + # "favourites") + # totalnodes += 1 + # vnodes.singleNode(totalnodes, + # "Favorite tvshows", + # "tvshows", + # "favourites") + # totalnodes += 1 + # vnodes.singleNode(totalnodes, + # "channels", + # "movies", + # "channels") + # totalnodes += 1 + with kodidb.GetKodiDB('music') as kodi_db: + pass + + # Save total + utils.window('Emby.nodes.total', str(totalnodes)) # Reopen DB connection to ensure that changes were commited before with embydb.GetEmbyDB() as emby_db: diff --git a/resources/lib/videonodes.py b/resources/lib/videonodes.py index 7b0f1702..40865369 100644 --- a/resources/lib/videonodes.py +++ b/resources/lib/videonodes.py @@ -42,6 +42,16 @@ class VideoNodes(object): def viewNode(self, indexnumber, tagname, mediatype, viewtype, viewid, delete=False): + # Plex: reassign mediatype due to Kodi inner workings + mediatypes = { + 'movie': 'movies', + 'show': 'tvshows', + 'photo': 'photos', + 'homevideo': 'homevideos', + 'musicvideos': 'musicvideos' + } + mediatype = mediatypes[mediatype] + window = utils.window kodiversion = self.kodiversion @@ -116,7 +126,7 @@ class VideoNodes(object): } mediatypes = { # label according to nodetype per mediatype - 'movie': + 'movies': { '1': tagname, '2': 30174, @@ -128,7 +138,7 @@ class VideoNodes(object): '11': 30230 }, - 'show': + 'tvshows': { '1': tagname, '2': 30170, @@ -141,14 +151,14 @@ class VideoNodes(object): '11': 30230 }, - 'homevideos': + 'homevideoss': { '1': tagname, '2': 30251, '11': 30253 }, - 'photo': + 'photos': { '1': tagname, '2': 30252, diff --git a/resources/settings.xml b/resources/settings.xml index 177dadf2..7f19bc21 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -85,7 +85,7 @@ - +