Get resume from Kodi arguments

This commit is contained in:
Abby Gourlay 2020-07-31 23:51:26 +01:00
parent 65225cba9e
commit 6f00779d73
3 changed files with 6 additions and 18 deletions

View file

@ -70,6 +70,7 @@ class Events(object):
elif mode == 'play': elif mode == 'play':
item = TheVoid('GetItem', {'Id': params['id'], 'ServerId': server}).get() item = TheVoid('GetItem', {'Id': params['id'], 'ServerId': server}).get()
item["resumePlayback"] = sys.argv[3].split(":")[1] == "true"
Actions(server).play(item, params.get('dbid'), params.get('transcode') == 'true', playlist=params.get('playlist') == 'true') Actions(server).play(item, params.get('dbid'), params.get('transcode') == 'true', playlist=params.get('playlist') == 'true')
elif mode == 'playlist': elif mode == 'playlist':

View file

@ -414,7 +414,7 @@ class Service(xbmc.Monitor):
properties = [ # TODO: review properties = [ # TODO: review
"jellyfin_state", "jellyfin_serverStatus", "jellyfin_currUser", "jellyfin_state", "jellyfin_serverStatus", "jellyfin_currUser",
"jellyfin_play", "jellyfin_online", "jellyfin.connected", "jellyfin.resume", "jellyfin_startup", "jellyfin_play", "jellyfin_online", "jellyfin.connected", "jellyfin_startup",
"jellyfin.external", "jellyfin.external_check", "jellyfin_deviceId", "jellyfin_db_check", "jellyfin_pathverified", "jellyfin.external", "jellyfin.external_check", "jellyfin_deviceId", "jellyfin_db_check", "jellyfin_pathverified",
"jellyfin_sync" "jellyfin_sync"
] ]

View file

@ -86,8 +86,7 @@ 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 = window('jellyfin.resume.bool') seektime = None
window('jellyfin.resume', clear=True)
if item['MediaType'] in ('Video', 'Audio'): if item['MediaType'] in ('Video', 'Audio'):
resume = item['UserData'].get('PlaybackPositionTicks') resume = item['UserData'].get('PlaybackPositionTicks')
@ -448,7 +447,7 @@ class Actions(object):
listitem.setProperty('IsPlayable', 'true') listitem.setProperty('IsPlayable', 'true')
listitem.setProperty('IsFolder', 'false') listitem.setProperty('IsFolder', 'false')
if obj['Resume'] and seektime is not False: if obj['Resume'] and item.get("resumePlayback"):
listitem.setProperty('resumetime', str(obj['Resume'])) listitem.setProperty('resumetime', str(obj['Resume']))
listitem.setProperty('StartPercent', str(((obj['Resume'] / obj['Runtime']) * 100) - 0.40)) listitem.setProperty('StartPercent', str(((obj['Resume'] / obj['Runtime']) * 100) - 0.40))
else: else:
@ -807,19 +806,7 @@ def special_listener():
is_playing = player.isPlaying() is_playing = player.isPlaying()
count = int(window('jellyfin.external_count') or 0) count = int(window('jellyfin.external_count') or 0)
if (not is_playing and xbmc.getCondVisibility('Window.IsVisible(DialogContextMenu.xml)') and xbmc.getInfoLabel('Control.GetLabel(1002)') == xbmc.getLocalizedString(12021)): if is_playing and not window('jellyfin.external_check'):
control = int(xbmcgui.Window(10106).getFocusId())
if control == 1002: # Start from beginning
LOG.info("Resume dialog: Start from beginning selected.")
window('jellyfin.resume.bool', False)
else:
LOG.info("Resume dialog: Resume selected.")
window('jellyfin.resume.bool', True)
elif is_playing and not window('jellyfin.external_check'):
time = player.getTime() time = player.getTime()
if time > 1: # Not external player. if time > 1: # Not external player.