Fixed playback time selection for forced transcodes

This commit is contained in:
Abby Gourlay 2020-08-01 00:14:31 +01:00
parent 6f00779d73
commit d8a7e43070

View file

@ -86,23 +86,22 @@ class Actions(object):
Detect the seektime for video type content. Detect the seektime for video type content.
Verify the default video action set in Kodi for accurate resume behavior. Verify the default video action set in Kodi for accurate resume behavior.
''' '''
seektime = None
if item['MediaType'] in ('Video', 'Audio'): if item['MediaType'] in ('Video', 'Audio'):
resume = item['UserData'].get('PlaybackPositionTicks') resume = item['UserData'].get('PlaybackPositionTicks')
if resume and transcode and not seektime: if resume and transcode:
choice = self.resume_dialog(api.API(item, self.server).adjust_resume((resume or 0) / 10000000.0)) choice = self.resume_dialog(api.API(item, self.server).adjust_resume((resume or 0) / 10000000.0))
if choice is None: if choice is None:
raise Exception("User backed out of resume dialog.") raise Exception("User backed out of resume dialog.")
seektime = False if not choice else True item["resumePlayback"] = False if not choice else True
if settings('enableCinema.bool') and not seektime: if settings('enableCinema.bool') and not item["resumePlayback"]:
self._set_intros(item) self._set_intros(item)
self.set_listitem(item, listitem, db_id, seektime) self.set_listitem(item, listitem, db_id, None)
playutils.set_properties(item, item['PlaybackInfo']['Method'], self.server_id) playutils.set_properties(item, item['PlaybackInfo']['Method'], self.server_id)
self.stack.append([item['PlaybackInfo']['Path'], listitem]) self.stack.append([item['PlaybackInfo']['Path'], listitem])
@ -452,6 +451,7 @@ class Actions(object):
listitem.setProperty('StartPercent', str(((obj['Resume'] / obj['Runtime']) * 100) - 0.40)) listitem.setProperty('StartPercent', str(((obj['Resume'] / obj['Runtime']) * 100) - 0.40))
else: else:
listitem.setProperty('resumetime', '0') listitem.setProperty('resumetime', '0')
listitem.setProperty('StartPercent', '0')
for track in obj['Streams']['video']: for track in obj['Streams']['video']:
listitem.addStreamInfo('video', { listitem.addStreamInfo('video', {