From d62b5fe2d0ddf55e20642610d30b8740c8c236f5 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 10 Mar 2018 04:29:21 -0600 Subject: [PATCH] Add PlayNow remote control --- resources/lib/playbackutils.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index 30b7c08d..76ccbc0d 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -61,6 +61,12 @@ class PlaybackUtils(object): log.info("Build does not require workaround for widgets?") return False + ''' + elif int(kodi_version[:2]): + log.info("Kodi Leia") + return False + ''' + ''' if not xbmc.getCondVisibility('Window.IsMedia'): log.info("Not Window.IsMedia") @@ -226,7 +232,8 @@ class PlaybackUtils(object): 'studio': " / ".join(self.API.get_studios()), 'aired': self.API.get_premiere_date(), 'rating': self.item.get('CommunityRating'), - 'votes': self.item.get('VoteCount') + 'votes': self.item.get('VoteCount'), + 'dbid': dbid or None } if mediatype == "Episode": @@ -248,11 +255,6 @@ class PlaybackUtils(object): else: metadata['mediatype'] = "video" - if dbid: - metadata['dbid'] = dbid - else: - metadata['dbid'] = None - listitem.setProperty('IsPlayable', 'true') listitem.setProperty('IsFolder', 'false') listitem.setLabel(metadata['title']) @@ -354,19 +356,13 @@ class PlaybackUtils(object): db_id = item_db[0] if item_db else None pbutils = PlaybackUtils(item) - pbutils.set_playlist(play_url, item_id, listitem, seektime if item_ids.index(item_id) == 0 else None, db_id) if item_ids.index(item_id) == 0 and seektime: - + seektime = seektime / 10000000.0 if seektime else None log.info("Seektime detected: %s", self.API.adjust_resume(seektime)) - listitem.setProperty('StartOffset', str(self.API.adjust_resume(seektime))) - - ''' - seektime_percent = ((seektime/self.API.get_runtime()) * 100) - 0.40 - log.info("seektime detected (percent): %s", seektime_percent) - listitem.setProperty('StartPercent', str(seektime_percent)) - ''' + listitem.setProperty('startoffset', str(self.API.adjust_resume(seektime))) + pbutils.set_playlist(play_url, item_id, listitem, seektime if item_ids.index(item_id) == 0 else None, db_id) index = max(pbutils.playlist.getposition(), 0) + 1 # Can return -1 for stack in pbutils.stack: @@ -384,6 +380,4 @@ class PlaybackUtils(object): player = xbmc.Player() player.play(pbutils.playlist) - if started: - return True - + return True