mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +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')
|
||||
window('emby.resume', clear=True)
|
||||
|
||||
if item['Type'] != 'Audio':
|
||||
|
||||
if get_play_action() == "Resume":
|
||||
seektime = True
|
||||
|
||||
if transcode and not seektime:
|
||||
if item['MediaType'] == 'Video':
|
||||
resume = item['UserData'].get('PlaybackPositionTicks')
|
||||
|
||||
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))
|
||||
|
||||
if choice is None:
|
||||
|
@ -143,8 +142,7 @@ class Actions(object):
|
|||
|
||||
play = playutils.PlayUtils(intro, False, self.server_id, self.server)
|
||||
source = play.select_source(play.get_sources())
|
||||
self.set_listitem(intro, listitem)
|
||||
listitem.setProperty('embyintro', "true")
|
||||
self.set_listitem(intro, listitem, intro=True)
|
||||
listitem.setPath(intro['PlaybackInfo']['Path'])
|
||||
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.
|
||||
'''
|
||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||
playlist = self.get_playlist(items[0])
|
||||
started = False
|
||||
|
||||
if clear:
|
||||
|
@ -211,7 +209,7 @@ class Actions(object):
|
|||
started = True
|
||||
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()
|
||||
API = api.API(item, self.server)
|
||||
|
@ -233,9 +231,13 @@ class Actions(object):
|
|||
obj = objects.map(item, 'BrowseVideo')
|
||||
obj['DbId'] = db_id
|
||||
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)
|
||||
|
||||
if 'PlaybackInfo' in item:
|
||||
if 'PlaybackInfo' in item and seektime:
|
||||
item['PlaybackInfo']['CurrentPosition'] = obj['Resume']
|
||||
|
||||
listitem.setContentLookup(False)
|
||||
|
@ -709,7 +711,7 @@ def special_listener():
|
|||
if control == 1002: # Start from beginning
|
||||
|
||||
LOG.info("Resume dialog: Start from beginning selected.")
|
||||
window('emby.resume', clear=True)
|
||||
window('emby.resume.bool', False)
|
||||
else:
|
||||
LOG.info("Resume dialog: Resume selected.")
|
||||
window('emby.resume.bool', True)
|
||||
|
|
|
@ -239,6 +239,9 @@ class Player(xbmc.Player):
|
|||
LOG.debug("--<[ paused ]")
|
||||
|
||||
def onPlayBackSeek(self, time, seekOffset):
|
||||
|
||||
''' Does not seem to work??
|
||||
'''
|
||||
current_file = self.getPlayingFile()
|
||||
|
||||
if current_file in self.played:
|
||||
|
@ -249,6 +252,7 @@ class Player(xbmc.Player):
|
|||
def report_playback(self, report=True):
|
||||
|
||||
''' Report playback progress to emby server.
|
||||
Check if the user seek.
|
||||
'''
|
||||
current_file = self.getPlayingFile()
|
||||
|
||||
|
@ -258,8 +262,12 @@ class Player(xbmc.Player):
|
|||
item = self.played[current_file]
|
||||
|
||||
if not report:
|
||||
|
||||
previous = item['CurrentPosition']
|
||||
item['CurrentPosition'] = int(self.getTime())
|
||||
|
||||
if (item['CurrentPosition'] - previous) < 30:
|
||||
|
||||
return
|
||||
|
||||
result = JSONRPC('Application.GetProperties').execute({'properties': ["volume", "muted"]})
|
||||
|
|
Loading…
Reference in a new issue