mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2026-04-27 14:00:34 +00:00
Merge 88eee7857f into 90ef649855
This commit is contained in:
commit
1c9b911a66
1 changed files with 37 additions and 1 deletions
|
|
@ -104,7 +104,43 @@ class Events(object):
|
|||
elif mode == "play":
|
||||
|
||||
item = api_client.get_item(params["id"])
|
||||
item["resumePlayback"] = sys.argv[3].split(":")[1] == "true"
|
||||
timestamp = params.get("timestamp")
|
||||
# check that timestamp is a float
|
||||
try:
|
||||
timestamp = float(timestamp)
|
||||
except (TypeError, ValueError):
|
||||
timestamp = None
|
||||
# a timestamp of 0.0 is false-y so check for None
|
||||
if timestamp is not None:
|
||||
is_current = False
|
||||
player = xbmc.Player()
|
||||
if player.isPlayingVideo():
|
||||
try:
|
||||
playing_file = player.getPlayingFile()
|
||||
if settings( "useDirectPaths" ) == "0":
|
||||
is_current = params["id"] in playing_file
|
||||
else:
|
||||
queue = json.loads(window("jellyfin_play.json") or "[]")
|
||||
for p_item in queue:
|
||||
if p_item.get("Path") == playing_file:
|
||||
if p_item.get("Id") == params["id"]:
|
||||
is_current = True
|
||||
break
|
||||
if is_current:
|
||||
player.seekTime(timestamp)
|
||||
return
|
||||
except Exception as e:
|
||||
LOG.debug("Failed to check playing file: %s", e)
|
||||
|
||||
item["UserData"] = item.get("UserData", {})
|
||||
item["UserData"]["PlaybackPositionTicks"] = int(timestamp * 10000000.0)
|
||||
item["resumePlayback"] = True
|
||||
else:
|
||||
try:
|
||||
item["resumePlayback"] = sys.argv[3].split(":")[1] == "true"
|
||||
except IndexError:
|
||||
item["resumePlayback"] = False
|
||||
|
||||
Actions(server, api_client).play(
|
||||
item,
|
||||
params.get("dbid"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue