diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index e0a8dbb2..10f94bcc 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -2160,10 +2160,10 @@ class API(): Output: each track contains a dictionaries { - 'video': videotrack-list, 'videocodec', 'height', 'width', - 'aspectratio', 'video3DFormat' - 'audio': audiotrack-list, 'audiocodec', 'channels', - 'audiolanguage' + 'video': videotrack-list, 'codec', 'height', 'width', + 'aspect', 'video3DFormat' + 'audio': audiotrack-list, 'codec', 'channels', + 'language' 'subtitle': list of subtitle languages (or "Unknown") } """ @@ -2186,16 +2186,16 @@ class API(): type = int(mediaStream['streamType']) if type == 1: # Video streams videotrack = {} - videotrack['videocodec'] = mediaStream['codec'].lower() - if "msmpeg4" in videotrack['videocodec']: - videotrack['videocodec'] = "divx" - elif "mpeg4" in videotrack['videocodec']: + videotrack['codec'] = mediaStream['codec'].lower() + if "msmpeg4" in videotrack['codec']: + videotrack['codec'] = "divx" + elif "mpeg4" in videotrack['codec']: # if "simple profile" in profile or profile == "": - # videotrack['videocodec'] = "xvid" + # videotrack['codec'] = "xvid" pass - elif "h264" in videotrack['videocodec']: + elif "h264" in videotrack['codec']: if container in ("mp4", "mov", "m4v"): - videotrack['videocodec'] = "avc1" + videotrack['codec'] = "avc1" videotrack['height'] = mediaStream.get('height') videotrack['width'] = mediaStream.get('width') # TODO: 3d Movies?!? @@ -2205,22 +2205,22 @@ class API(): except KeyError: if not aspectratio: aspectratio = round(float(videotrack['width'] / videotrack['height']), 6) - videotrack['aspectratio'] = aspectratio + videotrack['aspect'] = aspectratio # TODO: Video 3d format videotrack['video3DFormat'] = None videotracks.append(videotrack) elif type == 2: # Audio streams audiotrack = {} - audiotrack['audiocodec'] = mediaStream['codec'].lower() + audiotrack['codec'] = mediaStream['codec'].lower() profile = mediaStream['codecID'].lower() - if "dca" in audiotrack['audiocodec'] and "dts-hd ma" in profile: - audiotrack['audiocodec'] = "dtshd_ma" + if "dca" in audiotrack['codec'] and "dts-hd ma" in profile: + audiotrack['codec'] = "dtshd_ma" audiotrack['channels'] = mediaStream.get('channels') try: - audiotrack['audiolanguage'] = mediaStream.get('language') + audiotrack['language'] = mediaStream.get('language') except KeyError: - audiotrack['audiolanguage'] = 'unknown' + audiotrack['language'] = 'unknown' audiotracks.append(audiotrack) elif type == 3: # Subtitle streams diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index fef7bf1f..434cdc6b 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -1258,6 +1258,7 @@ class TVShows(Items): kodicursor.execute(query, (title, plot, rating, writer, premieredate, runtime, director, season, episode, title, airsBeforeSeason, airsBeforeEpisode, seasonid, episodeid)) + self.logMsg("Checkpoint 1", 2) else: query = ' '.join(( @@ -1271,8 +1272,10 @@ class TVShows(Items): airsBeforeEpisode, episodeid)) # Update the checksum in emby table + self.logMsg("Checkpoint 2", 2) emby_db.updateReference(itemid, checksum) # Update parentid reference + self.logMsg("Checkpoint 3", 2) emby_db.updateParentId(itemid, seasonid) ##### OR ADD THE EPISODE ##### @@ -1324,7 +1327,7 @@ class TVShows(Items): "WHERE idPath = ?" )) kodicursor.execute(query, (path, None, None, 1, pathid)) - + self.logMsg("Checkpoint 4", 2) # Update the file query = ' '.join(( @@ -1333,18 +1336,24 @@ class TVShows(Items): "WHERE idFile = ?" )) kodicursor.execute(query, (pathid, filename, dateadded, fileid)) - + self.logMsg("Checkpoint 5", 2) # Process cast people = API.getPeopleList() kodi_db.addPeople(episodeid, people, "episode") # Process artwork + self.logMsg("Checkpoint 6", 2) artworks = API.getAllArtwork() + self.logMsg("Checkpoint 7", 2) artwork.addOrUpdateArt(artworks['Primary'], episodeid, "episode", "thumb", kodicursor) + self.logMsg("Checkpoint 8", 2) # Process stream details streams = API.getMediaStreams() + self.logMsg("Checkpoint 9", 2) kodi_db.addStreams(fileid, streams, runtime) + self.logMsg("Checkpoint 7", 2) # Process playstates kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed) + self.logMsg("Checkpoint 8", 2) if not self.directpath and resume: # Create additional entry for widgets. This is only required for plugin/episode. temppathid = kodi_db.getPath("plugin://plugin.video.plexkodiconnect.tvshows/") @@ -1355,6 +1364,7 @@ class TVShows(Items): "SET idPath = ?, strFilename = ?, dateAdded = ?", "WHERE idFile = ?" )) + self.logMsg("Checkpoint 9", 2) kodicursor.execute(query, (temppathid, filename, dateadded, tempfileid)) kodi_db.addPlaystate(tempfileid, resume, runtime, playcount, dateplayed) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 0234c025..3635e05b 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -49,6 +49,10 @@ class ThreadedGetMetadata(threading.Thread): self.addonName = clientinfo.ClientInfo().getAddonName() threading.Thread.__init__(self) + def logMsg(self, msg, lvl=1): + className = self.__class__.__name__ + utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) + def run_internal(self): plx = PlexAPI.PlexAPI() global getMetadataCount @@ -112,6 +116,10 @@ class ThreadedProcessMetadata(threading.Thread): self.addonName = clientinfo.ClientInfo().getAddonName() threading.Thread.__init__(self) + def logMsg(self, msg, lvl=1): + className = self.__class__.__name__ + utils.logMsg("%s %s" % (self.addonName, className), msg, lvl) + def run_internal(self): # Constructs the method name, e.g. itemtypes.Movies itemFkt = getattr(itemtypes, self.itemType) @@ -386,12 +394,12 @@ class LibrarySync(threading.Thread): self.maintainViews() # Sync video library - process = { + # process = { - 'movies': self.movies, - 'musicvideos': self.musicvideos, - 'tvshows': self.tvshows - } + # 'movies': self.movies, + # 'musicvideos': self.musicvideos, + # 'tvshows': self.tvshows + # } process = { 'movies': self.PlexMovies, diff --git a/resources/lib/videonodes.py b/resources/lib/videonodes.py index 112cd292..ac60b7c1 100644 --- a/resources/lib/videonodes.py +++ b/resources/lib/videonodes.py @@ -124,7 +124,7 @@ class VideoNodes(object): } mediatypes = { # label according to nodetype per mediatype - 'movies': + 'movie': { '1': tagname, '2': 30174, @@ -136,7 +136,7 @@ class VideoNodes(object): '11': 30230 }, - 'tvshows': + 'show': { '1': tagname, '2': 30170,