Skip to content

Commit

Permalink
seek to percentage instead of seconds
Browse files Browse the repository at this point in the history
seeking to seconds below 60 will be interpreted as absolute time - higher values as incremental, so its better to use a percent value.
  • Loading branch information
Sandmann79 committed Apr 11, 2020
1 parent c2a35f8 commit 590183e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin.video.amazon-test/addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<extension point="xbmc.service" library="service.py" start="startup" />
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<reuselanguageinvoker>false</reuselanguageinvoker>
<reuselanguageinvoker>true</reuselanguageinvoker>
<summary lang="en_GB">Amazon Prime Video Streaming</summary>
<summary lang="de_DE">Amazon Prime Instant Video</summary>
<description lang="en_GB">Movies and Television Shows for Prime Members</description>
Expand Down
7 changes: 4 additions & 3 deletions plugin.video.amazon-test/resources/lib/playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ def _IStreamPlayback(asin, name, streamtype, isAdult, extern):
return True

skip = timecodes.get('skipElements')
Log(skip, Log.DEBUG)

cj_str = ';'.join(['%s=%s' % (k, v) for k, v in cookie.items()])
opt = '|Content-Type=application%2Fx-www-form-urlencoded&Cookie=' + quote_plus(cj_str)
Expand Down Expand Up @@ -706,9 +707,9 @@ def hide(self):

def onControl(self, control):
if control.getId() == self.skip_button.getId() and self.player.isPlayingVideo():
Log('Seeking to (+3): {}'.format(self.seek_time), Log.DEBUG)
tc = int(self.seek_time - self.player.getTime())
jsonRPC('Player.Seek', param={'playerid': 1, 'value': {'seconds': tc}})
perc = self.seek_time * 100 / self.player.getTotalTime()
Log('Seeking to (+3): {} / {}%'.format(self.seek_time, perc), Log.DEBUG)
jsonRPC('Player.Seek', param={'playerid': 1, 'value': {'percentage': perc}})
sleep(0.5)
Log('Position: {}'.format(self.player.getTime()), Log.DEBUG)
self.hide()
Expand Down

0 comments on commit 590183e

Please sign in to comment.