From 4fb4643ac06c5129fc6c1b783bcc01cd1e24ff4a Mon Sep 17 00:00:00 2001 From: croneter Date: Mon, 24 Dec 2018 17:44:52 +0100 Subject: [PATCH] Add-on paths: don't fail playback with an empty video --- empty_video.mp4 | Bin 262 -> 0 bytes resources/lib/app/playstate.py | 7 ------- resources/lib/kodimonitor.py | 9 ++------- resources/lib/playback.py | 14 -------------- resources/lib/variables.py | 6 ------ 5 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 empty_video.mp4 diff --git a/empty_video.mp4 b/empty_video.mp4 deleted file mode 100644 index 299de0ff6ec3a618ea543e786a2d9fcfe746a97d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 262 zcmZQzU{FXasVvAW&d+6FU}6B#Kx~v)mTZ_?U}DI?z`&7Kl$r{nb5jyafb_N8{QNQ? zos(OZkpiTV0P_nlhmnB+h!6mU0~AK%J0MhIV=(~*lS)%c5`lD7ZYr1tsZ-2I$teOc xKp;0Ivna8kAP2&Okh+;U#UKZ(t}MyV2hy@Y_k#=pTkn%tmS$?9XJ`OK1^^C7B=rCQ diff --git a/resources/lib/app/playstate.py b/resources/lib/app/playstate.py index 4c104cac..c99aeafa 100644 --- a/resources/lib/app/playstate.py +++ b/resources/lib/app/playstate.py @@ -62,10 +62,3 @@ class PlayState(object): self.force_transcode = False # Which Kodi player is/has been active? (either int 1, 2 or 3) self.active_players = set() - - # Failsafe for throwing an empty video back to Kodi's setResolvedUrl to set - # up our own playlist from the very beginning - self.pkc_caused_stop = False - # Flag if the 0 length PKC video has already failed so we can start resolving - # playback (set in player.py) - self.pkc_caused_stop_done = True diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 79327a45..8fc2fd37 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -82,16 +82,11 @@ class KodiMonitor(xbmc.Monitor): with app.APP.lock_playqueues: self._hack_addon_paths_replay_video() elif data.get('end'): - if app.PLAYSTATE.pkc_caused_stop is True: - app.PLAYSTATE.pkc_caused_stop = False - LOG.debug('PKC caused this playback stop - ignoring') - else: - with app.APP.lock_playqueues: - _playback_cleanup(ended=True) + with app.APP.lock_playqueues: + _playback_cleanup(ended=True) else: with app.APP.lock_playqueues: _playback_cleanup() - app.PLAYSTATE.pkc_caused_stop_done = True app.SYNC.suspend_sync = False elif method == 'Playlist.OnAdd': with app.APP.lock_playqueues: diff --git a/resources/lib/playback.py b/resources/lib/playback.py index 30376793..79e6d52d 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -204,14 +204,6 @@ def _playback_init(plex_id, plex_type, playqueue, pos): else: trailers = True LOG.debug('Playing trailers: %s', trailers) - if RESOLVE: - # Sleep a bit to let setResolvedUrl do its thing - bit ugly - sleep_timer = 0 - while not app.PLAYSTATE.pkc_caused_stop_done: - app.APP.monitor.waitForAbort(0.05) - sleep_timer += 1 - if sleep_timer > 100: - break playqueue.clear() if plex_type != v.PLEX_TYPE_CLIP: # Post to the PMS to create a playqueue - in any case due to Companion @@ -268,14 +260,8 @@ def _ensure_resolve(abort=False): will be destroyed. """ if RESOLVE: - LOG.debug('Passing dummy path to Kodi') - # if not state.CONTEXT_MENU_PLAY: - # Because playback won't start with context menu play - app.PLAYSTATE.pkc_caused_stop = True - app.PLAYSTATE.pkc_caused_stop_done = False if not abort: result = pickler.Playback_Successful() - result.listitem = PKCListItem(path=v.NULL_VIDEO) pickler.pickle_me(result) else: # Shows PKC error message diff --git a/resources/lib/variables.py b/resources/lib/variables.py index 241fdfa9..f7cd3aba 100644 --- a/resources/lib/variables.py +++ b/resources/lib/variables.py @@ -120,12 +120,6 @@ EXTERNAL_SUBTITLE_TEMP_PATH = try_decode(xbmc.translatePath( # Multiply Plex time by this factor to receive Kodi time PLEX_TO_KODI_TIMEFACTOR = 1.0 / 1000.0 -# We're "failing" playback with a video of 0 length -NULL_VIDEO = os.path.join(ADDON_FOLDER, - 'addons', - ADDON_ID, - 'empty_video.mp4') - # Playlist stuff PLAYLIST_PATH = os.path.join(KODI_PROFILE, 'playlists') PLAYLIST_PATH_MIXED = os.path.join(PLAYLIST_PATH, 'mixed')