Skip to content

Commit

Permalink
InfoBarTimeshift: allow seeking on streams
Browse files Browse the repository at this point in the history
This commit allows seeking on streams when stream is paused.

The buttons 1,3,4,6,7,9 can be used to seek if you already pause stream.
If stream is not paused buttons are working normally by change to channel.

Long press on fast forward / rewind allows seeking by manually entering desired time.
  • Loading branch information
athoik committed Jan 26, 2018
1 parent 0188e75 commit 825e752
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
9 changes: 9 additions & 0 deletions data/keymap.xml
Expand Up @@ -371,6 +371,15 @@
<key id="KEY_PAUSE" mapto="timeshiftStart" flags="m"/>
<key id="KEY_STOP" mapto="timeshiftStop" flags="m"/>
<key id="KEY_TIME" mapto="timeshiftStart" flags="m"/>

<key id="KEY_REWIND" mapto="seekBackManual" flags="l"/>
<key id="KEY_FASTFORWARD" mapto="seekFwdManual" flags="l"/>
<key id="KEY_1" mapto="seekdef:1" flags="m"/>
<key id="KEY_3" mapto="seekdef:3" flags="m"/>
<key id="KEY_4" mapto="seekdef:4" flags="m"/>
<key id="KEY_6" mapto="seekdef:6" flags="m"/>
<key id="KEY_7" mapto="seekdef:7" flags="m"/>
<key id="KEY_9" mapto="seekdef:9" flags="m"/>
</map>

<map context="InfobarTimeshiftActivateActions">
Expand Down
24 changes: 21 additions & 3 deletions lib/python/Screens/InfoBarGenerics.py
Expand Up @@ -1774,13 +1774,21 @@ def __init__(self):
# note that a timeshift can be enabled ("recording") and
# activated (currently time-shifting).

class InfoBarTimeshift:
class InfoBarTimeshift(InfoBarSeek):
def __init__(self):
self["TimeshiftActions"] = HelpableActionMap(self, "InfobarTimeshiftActions",
{
"timeshiftStart": (self.startTimeshift, _("Start timeshift")), # the "yellow key"
"timeshiftStop": (self.stopTimeshift, _("Stop timeshift")) # currently undefined :), probably 'TV'
}, prio=1)
"timeshiftStop": (self.stopTimeshift, _("Stop timeshift")), # currently undefined :), probably 'TV'
"seekFwdManual": (self.seekFwdManual, _("Seek forward (enter time)")),
"seekBackManual": (self.seekBackManual, _("Seek backward (enter time)")),
"seekdef:1": (boundFunction(self.seekdef,1), _("Seek")),
"seekdef:3": (boundFunction(self.seekdef,3), _("Seek")),
"seekdef:4": (boundFunction(self.seekdef,4), _("Seek")),
"seekdef:6": (boundFunction(self.seekdef,6), _("Seek")),
"seekdef:7": (boundFunction(self.seekdef,7), _("Seek")),
"seekdef:9": (boundFunction(self.seekdef,9), _("Seek")),
}, prio=0)
self["TimeshiftActivateActions"] = ActionMap(["InfobarTimeshiftActivateActions"],
{
"timeshiftActivateEnd": self.activateTimeshiftEnd, # something like "rewind key"
Expand All @@ -1806,6 +1814,16 @@ def __init__(self):
iPlayableService.evEnd: self.__serviceEnd
})

def seekdef(self, key):
if self.seekstate == self.SEEK_STATE_PLAY:
return 0 # trade as unhandled action
time = (-config.seek.selfdefined_13.value, False, config.seek.selfdefined_13.value,
-config.seek.selfdefined_46.value, False, config.seek.selfdefined_46.value,
-config.seek.selfdefined_79.value, False, config.seek.selfdefined_79.value)[key-1]
self.doSeekRelative(time * 90000)
self.pvrStateDialog.show()
return 1

def getTimeshift(self):
service = self.session.nav.getCurrentService()
return service and service.timeshift()
Expand Down

0 comments on commit 825e752

Please sign in to comment.