From 02fa0eb7cb243f1a99a49bbc33beda8f7f8e15b0 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sun, 7 Feb 2016 13:26:28 +0100 Subject: [PATCH] Updated logging --- resources/lib/playbackutils.py | 11 ++++++++--- resources/lib/playlist.py | 3 ++- resources/lib/playutils.py | 7 ++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index 7b259eb0..bf912e18 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -72,10 +72,13 @@ class PlaybackUtils(): # Close DB embyconn.close() - self.logMsg("Playlist size now: %s" % self.playlist.size(), 1) + self.logMsg("Playlist size now: %s. Files before deletion:" + % self.playlist.size(), 2) + for i in range(self.playlist.size()): + self.logMsg(self.playlist[i].getfilename(), 2) # Kick off playback if startPlayer: - self.logMsg("Starting up a new xbmc.Player() instance", 1) + self.logMsg("Starting up a new xbmc.Player() instance", 2) self.logMsg("Starting position: %s" % self.startPos, 1) Player = xbmc.Player() Player.play(self.playlist, startpos=self.startPos) @@ -85,10 +88,12 @@ class PlaybackUtils(): except: self.logMsg("Error, could not resume", -1) else: - self.logMsg("xbmc.Player() instance already up", 1) + self.logMsg("xbmc.Player() instance already up. Files playing:", 2) # Delete the last playlist item because we have added it already filename = self.playlist[-1].getfilename() self.playlist.remove(filename) + for i in range(self.playlist.size()): + self.logMsg(self.playlist[i].getfilename(), 2) xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitems[0]) def AddMediaItemToPlaylist(self, item, emby_db): diff --git a/resources/lib/playlist.py b/resources/lib/playlist.py index 2cef9655..663d085e 100644 --- a/resources/lib/playlist.py +++ b/resources/lib/playlist.py @@ -164,7 +164,8 @@ class Playlist(): 'method': "Playlist.GetItems", 'params': { - 'playlistid': 1 + 'playlistid': 1, + 'properties': ['title', 'file'] } } result = xbmc.executeJSONRPC(json.dumps(pl)) diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py index a73a9ef7..7d514a97 100644 --- a/resources/lib/playutils.py +++ b/resources/lib/playutils.py @@ -156,10 +156,15 @@ class PlayUtils(): Returns True if we need to transcode """ videoCodec = self.API.getVideoCodec() + self.logMsg("videoCodec: %s" % videoCodec, 2) codec = videoCodec['videocodec'] resolution = videoCodec['resolution'] h265 = self.getH265() - if not ('h265' in codec or 'hevc' in codec) or (h265 is None): + try: + if not ('h265' in codec or 'hevc' in codec) or (h265 is None): + return False + # E.g. trailers without a codec of None + except TypeError: return False if resolution >= h265: