Add-on paths: don't fail playback with an empty video
This commit is contained in:
parent
a9f51f9ac4
commit
4fb4643ac0
5 changed files with 2 additions and 34 deletions
BIN
empty_video.mp4
BIN
empty_video.mp4
Binary file not shown.
|
@ -62,10 +62,3 @@ class PlayState(object):
|
||||||
self.force_transcode = False
|
self.force_transcode = False
|
||||||
# Which Kodi player is/has been active? (either int 1, 2 or 3)
|
# Which Kodi player is/has been active? (either int 1, 2 or 3)
|
||||||
self.active_players = set()
|
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
|
|
||||||
|
|
|
@ -82,16 +82,11 @@ class KodiMonitor(xbmc.Monitor):
|
||||||
with app.APP.lock_playqueues:
|
with app.APP.lock_playqueues:
|
||||||
self._hack_addon_paths_replay_video()
|
self._hack_addon_paths_replay_video()
|
||||||
elif data.get('end'):
|
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:
|
with app.APP.lock_playqueues:
|
||||||
_playback_cleanup(ended=True)
|
_playback_cleanup(ended=True)
|
||||||
else:
|
else:
|
||||||
with app.APP.lock_playqueues:
|
with app.APP.lock_playqueues:
|
||||||
_playback_cleanup()
|
_playback_cleanup()
|
||||||
app.PLAYSTATE.pkc_caused_stop_done = True
|
|
||||||
app.SYNC.suspend_sync = False
|
app.SYNC.suspend_sync = False
|
||||||
elif method == 'Playlist.OnAdd':
|
elif method == 'Playlist.OnAdd':
|
||||||
with app.APP.lock_playqueues:
|
with app.APP.lock_playqueues:
|
||||||
|
|
|
@ -204,14 +204,6 @@ def _playback_init(plex_id, plex_type, playqueue, pos):
|
||||||
else:
|
else:
|
||||||
trailers = True
|
trailers = True
|
||||||
LOG.debug('Playing trailers: %s', trailers)
|
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()
|
playqueue.clear()
|
||||||
if plex_type != v.PLEX_TYPE_CLIP:
|
if plex_type != v.PLEX_TYPE_CLIP:
|
||||||
# Post to the PMS to create a playqueue - in any case due to Companion
|
# 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.
|
will be destroyed.
|
||||||
"""
|
"""
|
||||||
if RESOLVE:
|
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:
|
if not abort:
|
||||||
result = pickler.Playback_Successful()
|
result = pickler.Playback_Successful()
|
||||||
result.listitem = PKCListItem(path=v.NULL_VIDEO)
|
|
||||||
pickler.pickle_me(result)
|
pickler.pickle_me(result)
|
||||||
else:
|
else:
|
||||||
# Shows PKC error message
|
# Shows PKC error message
|
||||||
|
|
|
@ -120,12 +120,6 @@ EXTERNAL_SUBTITLE_TEMP_PATH = try_decode(xbmc.translatePath(
|
||||||
# Multiply Plex time by this factor to receive Kodi time
|
# Multiply Plex time by this factor to receive Kodi time
|
||||||
PLEX_TO_KODI_TIMEFACTOR = 1.0 / 1000.0
|
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 stuff
|
||||||
PLAYLIST_PATH = os.path.join(KODI_PROFILE, 'playlists')
|
PLAYLIST_PATH = os.path.join(KODI_PROFILE, 'playlists')
|
||||||
PLAYLIST_PATH_MIXED = os.path.join(PLAYLIST_PATH, 'mixed')
|
PLAYLIST_PATH_MIXED = os.path.join(PLAYLIST_PATH, 'mixed')
|
||||||
|
|
Loading…
Reference in a new issue