From 2341854de8d724544d259cff27e8679e32acaf6b Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sun, 28 Jan 2018 02:14:38 -0600 Subject: [PATCH] Fix intros --- resources/lib/playbackutils.py | 20 +++++++++++++++++--- resources/lib/player.py | 6 +++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index 8f544421..0fa887e6 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -52,6 +52,16 @@ class PlaybackUtils(object): else: self.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) + def _detect_widgets(self): + + if (not xbmc.getCondVisibility('Window.IsMedia') and + ((self.item['Type'] == "Audio" and not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(music),1)')) or + not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(video),1)'))): + + return True + + return False + def play(self, item_id, dbid=None, force_transcode=False): listitem = xbmcgui.ListItem() @@ -98,9 +108,7 @@ class PlaybackUtils(object): # Stack: [(url, listitem), (url, ...), ...] self.stack[0][1].setPath(self.stack[0][0]) try: - if (not xbmc.getCondVisibility('Window.IsMedia') and - ((self.item['Type'] == "Audio" and not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(music),1)')) or - not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(video),1)'))): + if self._detect_widgets(): # widgets do not fill artwork correctly log.info("Detected widget.") raise IndexError @@ -158,6 +166,12 @@ class PlaybackUtils(object): url = putils.PlayUtils(intro, listitem).get_play_url() log.info("Adding Intro: %s", url) + pb = PlaybackUtils(intro) + pb.set_artwork(listitem, intro['Type']) + + if self._detect_widgets(): + pb.set_listitem(listitem) + self.stack.append([url, listitem]) window('emby.skip.%s' % self.item['Id'], value="true") diff --git a/resources/lib/player.py b/resources/lib/player.py index 8dfc71ea..2d488fbd 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -136,6 +136,9 @@ class Player(xbmc.Player): #self.set_audio_subs(item.get('forcedaudio'), item.get('forcedsubs')) + # Prevent manually mark as watched in Kodi monitor + window('emby.skip.%s' % item_id, value="true") + customseek = window('emby_customPlaylist.seektime') if window('emby_customPlaylist') == "true" and customseek: # Start at, when using custom playlist (play to Kodi from webclient) @@ -455,9 +458,6 @@ class Player(xbmc.Player): media_type = data['Type'] playMethod = data['playmethod'] - # Prevent manually mark as watched in Kodi monitor - window('emby.skip.%s' % itemid, value="true") - self.stopPlayback(data) if currentPosition and runtime: