From b0fbb3ac099d17430d75814ba456dac67d02d224 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 5 Oct 2019 12:43:12 +0200 Subject: [PATCH 1/2] Fix regression: labeling of playmethods --- resources/lib/kodimonitor.py | 2 +- resources/lib/playback.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index a7b615ab..42717962 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -456,7 +456,7 @@ def _playback_cleanup(ended=False): # Remember the last played item later app.PLAYSTATE.old_player_states[playerid] = copy.deepcopy(status) # Stop transcoding - if status['playmethod'] == 'Transcode': + if status['playmethod'] == v.PLAYBACK_METHOD_TRANSCODE: LOG.debug('Tell the PMS to stop transcoding') DU().downloadUrl( '{server}/video/:/transcode/universal/stop', diff --git a/resources/lib/playback.py b/resources/lib/playback.py index f32b0297..6d71b7d8 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -473,9 +473,10 @@ def _conclude_playback(playqueue, pos): _ensure_resolve() return listitem.setPath(item.file.encode('utf-8')) - if item.playmethod == 'DirectStream': + if item.playmethod == v.PLAYBACK_METHOD_DIRECT_PLAY: listitem.setSubtitles(api.cache_external_subs()) - elif item.playmethod == 'Transcode': + elif item.playmethod in (v.PLAYBACK_METHOD_DIRECT_STREAM, + v.PLAYBACK_METHOD_TRANSCODE): playutils.audio_subtitle_prefs(listitem) _set_resume(listitem, item, api) transfer.send(listitem) @@ -518,7 +519,7 @@ def process_indirect(key, offset, resolve=True): playqueue.clear() item = PL.playlist_item_from_xml(xml[0]) item.offset = offset - item.playmethod = 'DirectStream' + item.playmethod = v.PLAYBACK_METHOD_DIRECT_PLAY # Need to get yet another xml to get the final playback url try: From 2f0767d086b2720a8496e1463e67a7713a99b75b Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 5 Oct 2019 12:44:40 +0200 Subject: [PATCH 2/2] Fix NameError when transcoding --- resources/lib/playback.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index 6d71b7d8..786d2735 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -19,7 +19,7 @@ from . import playlist_func as PL from . import playqueue as PQ from . import json_rpc as js from . import transfer -from .playback_decision import set_playurl +from .playback_decision import set_playurl, audio_subtitle_prefs from . import variables as v from . import app @@ -477,7 +477,7 @@ def _conclude_playback(playqueue, pos): listitem.setSubtitles(api.cache_external_subs()) elif item.playmethod in (v.PLAYBACK_METHOD_DIRECT_STREAM, v.PLAYBACK_METHOD_TRANSCODE): - playutils.audio_subtitle_prefs(listitem) + audio_subtitle_prefs(api, listitem) _set_resume(listitem, item, api) transfer.send(listitem) LOG.info('Done concluding playback')