mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 12:16:12 +00:00
Fix resume/start from beginning
Also fix seek verification (kodi seek does not seem to trigger expected built-in functions)
This commit is contained in:
parent
2c0f6a16a0
commit
df306e69d7
2 changed files with 24 additions and 14 deletions
|
@ -91,15 +91,14 @@ class Actions(object):
|
||||||
seektime = window('emby.resume.bool')
|
seektime = window('emby.resume.bool')
|
||||||
window('emby.resume', clear=True)
|
window('emby.resume', clear=True)
|
||||||
|
|
||||||
if item['Type'] != 'Audio':
|
if item['MediaType'] == 'Video':
|
||||||
|
|
||||||
if get_play_action() == "Resume":
|
|
||||||
seektime = True
|
|
||||||
|
|
||||||
if transcode and not seektime:
|
|
||||||
resume = item['UserData'].get('PlaybackPositionTicks')
|
resume = item['UserData'].get('PlaybackPositionTicks')
|
||||||
|
|
||||||
if resume:
|
if resume:
|
||||||
|
if get_play_action() == "Resume":
|
||||||
|
seektime = True
|
||||||
|
|
||||||
|
if transcode and not seektime and resume:
|
||||||
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:
|
||||||
|
@ -143,8 +142,7 @@ class Actions(object):
|
||||||
|
|
||||||
play = playutils.PlayUtils(intro, False, self.server_id, self.server)
|
play = playutils.PlayUtils(intro, False, self.server_id, self.server)
|
||||||
source = play.select_source(play.get_sources())
|
source = play.select_source(play.get_sources())
|
||||||
self.set_listitem(intro, listitem)
|
self.set_listitem(intro, listitem, intro=True)
|
||||||
listitem.setProperty('embyintro', "true")
|
|
||||||
listitem.setPath(intro['PlaybackInfo']['Path'])
|
listitem.setPath(intro['PlaybackInfo']['Path'])
|
||||||
playutils.set_properties(intro, intro['PlaybackInfo']['Method'], self.server_id)
|
playutils.set_properties(intro, intro['PlaybackInfo']['Method'], self.server_id)
|
||||||
|
|
||||||
|
@ -176,7 +174,7 @@ class Actions(object):
|
||||||
|
|
||||||
''' Play a list of items. Creates a new playlist.
|
''' Play a list of items. Creates a new playlist.
|
||||||
'''
|
'''
|
||||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
playlist = self.get_playlist(items[0])
|
||||||
started = False
|
started = False
|
||||||
|
|
||||||
if clear:
|
if clear:
|
||||||
|
@ -211,7 +209,7 @@ class Actions(object):
|
||||||
started = True
|
started = True
|
||||||
xbmc.Player().play(playlist)
|
xbmc.Player().play(playlist)
|
||||||
|
|
||||||
def set_listitem(self, item, listitem, db_id=None, seektime=None):
|
def set_listitem(self, item, listitem, db_id=None, seektime=None, intro=False):
|
||||||
|
|
||||||
objects = Objects()
|
objects = Objects()
|
||||||
API = api.API(item, self.server)
|
API = api.API(item, self.server)
|
||||||
|
@ -233,9 +231,13 @@ class Actions(object):
|
||||||
obj = objects.map(item, 'BrowseVideo')
|
obj = objects.map(item, 'BrowseVideo')
|
||||||
obj['DbId'] = db_id
|
obj['DbId'] = db_id
|
||||||
obj['Artwork'] = API.get_all_artwork(objects.map(item, 'ArtworkParent'), True)
|
obj['Artwork'] = API.get_all_artwork(objects.map(item, 'ArtworkParent'), True)
|
||||||
|
|
||||||
|
if intro:
|
||||||
|
obj['Artwork']['Primary'] = "&KodiCinemaMode=true"
|
||||||
|
|
||||||
self.listitem_video(obj, listitem, item, seektime)
|
self.listitem_video(obj, listitem, item, seektime)
|
||||||
|
|
||||||
if 'PlaybackInfo' in item:
|
if 'PlaybackInfo' in item and seektime:
|
||||||
item['PlaybackInfo']['CurrentPosition'] = obj['Resume']
|
item['PlaybackInfo']['CurrentPosition'] = obj['Resume']
|
||||||
|
|
||||||
listitem.setContentLookup(False)
|
listitem.setContentLookup(False)
|
||||||
|
@ -709,7 +711,7 @@ def special_listener():
|
||||||
if control == 1002: # Start from beginning
|
if control == 1002: # Start from beginning
|
||||||
|
|
||||||
LOG.info("Resume dialog: Start from beginning selected.")
|
LOG.info("Resume dialog: Start from beginning selected.")
|
||||||
window('emby.resume', clear=True)
|
window('emby.resume.bool', False)
|
||||||
else:
|
else:
|
||||||
LOG.info("Resume dialog: Resume selected.")
|
LOG.info("Resume dialog: Resume selected.")
|
||||||
window('emby.resume.bool', True)
|
window('emby.resume.bool', True)
|
||||||
|
|
|
@ -239,6 +239,9 @@ class Player(xbmc.Player):
|
||||||
LOG.debug("--<[ paused ]")
|
LOG.debug("--<[ paused ]")
|
||||||
|
|
||||||
def onPlayBackSeek(self, time, seekOffset):
|
def onPlayBackSeek(self, time, seekOffset):
|
||||||
|
|
||||||
|
''' Does not seem to work??
|
||||||
|
'''
|
||||||
current_file = self.getPlayingFile()
|
current_file = self.getPlayingFile()
|
||||||
|
|
||||||
if current_file in self.played:
|
if current_file in self.played:
|
||||||
|
@ -249,6 +252,7 @@ class Player(xbmc.Player):
|
||||||
def report_playback(self, report=True):
|
def report_playback(self, report=True):
|
||||||
|
|
||||||
''' Report playback progress to emby server.
|
''' Report playback progress to emby server.
|
||||||
|
Check if the user seek.
|
||||||
'''
|
'''
|
||||||
current_file = self.getPlayingFile()
|
current_file = self.getPlayingFile()
|
||||||
|
|
||||||
|
@ -258,8 +262,12 @@ class Player(xbmc.Player):
|
||||||
item = self.played[current_file]
|
item = self.played[current_file]
|
||||||
|
|
||||||
if not report:
|
if not report:
|
||||||
|
|
||||||
|
previous = item['CurrentPosition']
|
||||||
item['CurrentPosition'] = int(self.getTime())
|
item['CurrentPosition'] = int(self.getTime())
|
||||||
|
|
||||||
|
if (item['CurrentPosition'] - previous) < 30:
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
result = JSONRPC('Application.GetProperties').execute({'properties': ["volume", "muted"]})
|
result = JSONRPC('Application.GetProperties').execute({'properties': ["volume", "muted"]})
|
||||||
|
|
Loading…
Reference in a new issue