From 3b2176574af276c1e278b7c44774376349d4b32d Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Mon, 11 Jan 2016 15:56:56 +0100 Subject: [PATCH] Video nodes finally working --- resources/lib/itemtypes.py | 30 +++++++++++------------------- resources/lib/videonodes.py | 15 +++++++++++---- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 7b9df1c0..48e39b8c 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -310,11 +310,10 @@ class Movies(Items): kodicursor.execute("select coalesce(max(idMovie),0) from movie") movieid = kodicursor.fetchone()[0] + 1 - - # if not viewtag or not viewid: - # # Get view tag from emby - # viewtag, viewid, mediatype = self.emby.getView_embyId(itemid) - # self.logMsg("View tag found: %s" % viewtag, 2) + if not viewtag or not viewid: + # Get view tag from emby + viewtag, viewid, mediatype = self.emby.getView_embyId(itemid) + self.logMsg("View tag found: %s" % viewtag, 2) # fileId information checksum = API.getChecksum() @@ -472,13 +471,13 @@ class Movies(Items): # Process studios kodi_db.addStudios(movieid, studios, "movie") # Process tags: view, emby tags - # tags = [viewtag] + tags = [viewtag] # tags.extend(item['Tags']) # if userdata['Favorite']: - # tags.append("Favorite movies") - # kodi_db.addTags(movieid, tags, "movie") + # tags.append("Favorite movies") + kodi_db.addTags(movieid, tags, "movie") # Process playstates - # resume = API.adjustResume(userdata['Resume']) + resume = API.adjustResume(userdata['Resume']) kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed) def updateUserdata(self, item): @@ -1191,10 +1190,7 @@ class TVShows(Items): update_item = False self.logMsg("showid: %s not found." % itemid, 2) - # if viewtag is None or viewid is None: - # # Get view tag from emby - # viewtag, viewid, mediatype = emby.getView_embyId(itemid) - # self.logMsg("View tag found: %s" % viewtag, 2) + self.logMsg("View tag found: %s" % viewtag, 2) # fileId information checksum = API.getChecksum() @@ -1326,12 +1322,8 @@ class TVShows(Items): # Process studios kodi_db.addStudios(showid, studios, "tvshow") # Process tags: view, emby tags - # tags = [viewtag] - # tags.extend(item['Tags']) - # if userdata['Favorite']: - # tags.append("Favorite tvshows") - # kodi_db.addTags(showid, tags, "tvshow") - # Process seasons + tags = [viewtag] + kodi_db.addTags(showid, tags, "tvshow") def refreshSeasonEntry(self, item, showid): API = PlexAPI.API(item) diff --git a/resources/lib/videonodes.py b/resources/lib/videonodes.py index 90ef4acf..03e5a837 100644 --- a/resources/lib/videonodes.py +++ b/resources/lib/videonodes.py @@ -56,6 +56,13 @@ class VideoNodes(object): kodiversion = self.kodiversion + # mediatype conversion + # LEFT: Plex wording, right: Kodi wording + mediaTypeConversion = { + 'movie': 'movies', + 'show': 'tvshows' + } + mediatype = mediaTypeConversion[mediatype] if mediatype == "homevideos": # Treat homevideos as movies mediatype = "movies" @@ -68,7 +75,7 @@ class VideoNodes(object): path = xbmc.translatePath("special://profile/library/video/").decode('utf-8') nodepath = xbmc.translatePath( - "special://profile/library/video/plex-%s/" % dirname).decode('utf-8') + "special://profile/library/video/plex%s/" % dirname).decode('utf-8') # Verify the video directory if not xbmcvfs.exists(path): @@ -93,7 +100,7 @@ class VideoNodes(object): # Create index entry nodeXML = "%sindex.xml" % nodepath # Set windows property - path = "library://video/plex-%s/" % dirname + path = "library://video/plex%s/" % dirname for i in range(1, indexnumber): # Verify to make sure we don't create duplicates if utils.window('Emby.nodes.%s.index' % i) == path: @@ -124,7 +131,7 @@ class VideoNodes(object): } mediatypes = { # label according to nodetype per mediatype - 'movie': { + 'movies': { '1': tagname, '2': 30174, '4': 30177, @@ -134,7 +141,7 @@ class VideoNodes(object): '10': 30229, '11': 30230}, - 'show': { + 'tvshows': { '1': tagname, '2': 30170, '3': 30175,