Skip to content

Commit

Permalink
Actually remove the timeline race condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwalton3 committed Jan 15, 2020
1 parent 30bbe9e commit 1f79dc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions jellyfin_mpv_shim/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,7 @@ def get_timeline_options(self):
"PlaybackStartTimeTicks": int(self.start_time * 1000) * 10000,
"SubtitleStreamIndex": none_fallback(self._video.sid, -1),
"AudioStreamIndex": none_fallback(self._video.aid, -1),
"BufferedRanges":[{
"start": int(safe_pos * 1000) * 10000,
"end": int(((player.duration - safe_pos * none_fallback(player.cache_buffering_state, 0) / 100) + safe_pos) * 1000) * 10000
}],
"BufferedRanges":[],
"PlayMethod": "Transcode" if self._video.is_transcode else "DirectPlay",
"PlaySessionId": self._video.playback_info["PlaySessionId"],
"PlaylistItemId": self._video.parent.queue[self._video.parent.seq]["PlaylistItemId"],
Expand All @@ -431,6 +428,11 @@ def get_timeline_options(self):
"ItemId": self._video.item_id,
"NowPlayingQueue": self._video.parent.queue,
}
if player.duration is not None:
options["BufferedRanges"] = [{
"start": int(safe_pos * 1000) * 10000,
"end": int(((player.duration - safe_pos * none_fallback(player.cache_buffering_state, 0) / 100) + safe_pos) * 1000) * 10000
}]
return options

@synchronous('_tl_lock')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='jellyfin-mpv-shim',
version='1.1.2',
version='1.1.3',
author="Ian Walton",
author_email="[email protected]",
description="Cast media from Jellyfin Mobile and Web apps to MPV. (Unofficial)",
Expand Down

0 comments on commit 1f79dc7

Please sign in to comment.