X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/673d85e4aace04805fe958bbe8cb741b21ccbc1b..7f5aa3b85debad0a5642cc5c57cc5b967093ff3e:/lib/python/Screens/InfoBarGenerics.py diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 195f6d0a..84d04f92 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -540,7 +540,20 @@ class InfoBarSeek: iPlayableService.evEOF: self.__evEOF, iPlayableService.evSOF: self.__evSOF, }) - self["SeekActions"] = HelpableActionMap(self, "InfobarSeekActions", + + class InfoBarSeekActionMap(HelpableActionMap): + def __init__(self, screen, *args, **kwargs): + HelpableActionMap.__init__(self, screen, *args, **kwargs) + self.screen = screen + + def action(self, contexts, action): + if action[:5] == "seek:": + time = int(action[5:]) + self.screen.seekRelative(time * 90000) + else: + HelpableActionMap.action(self, contexts, action) + + self["SeekActions"] = InfoBarSeekActionMap(self, "InfobarSeekActions", { "pauseService": (self.pauseService, "pause"), "unPauseService": (self.unPauseService, "continue"), @@ -769,7 +782,7 @@ class InfoBarSeek: if self.seekstate != self.SEEK_STATE_PLAY: self.setSeekState(self.SEEK_STATE_PAUSE) # HACK - self.getSeek().seekRelative(1, -90000) + #self.getSeek().seekRelative(1, -90000) self.setSeekState(self.SEEK_STATE_PLAY) else: self.setSeekState(self.SEEK_STATE_PAUSE) @@ -781,7 +794,7 @@ class InfoBarSeek: def seekRelative(self, diff): seekable = self.getSeek() if seekable is not None: - seekable.seekRelative(0, diff) + seekable.seekRelative(1, diff) from Screens.PVRState import PVRState @@ -1232,7 +1245,7 @@ class InfoBarCueSheetSupport: return None return service.seek() - def __getCurrentPosition(self): + def cueGetCurrentPosition(self): seek = self.__getSeekable() if seek is None: return None @@ -1242,7 +1255,7 @@ class InfoBarCueSheetSupport: return long(r[1]) def jumpPreviousNextMark(self, cmp, alternative=None): - current_pos = self.__getCurrentPosition() + current_pos = self.cueGetCurrentPosition() if current_pos is None: return mark = self.getNearestCutPoint(current_pos, cmp=cmp) @@ -1274,17 +1287,18 @@ class InfoBarCueSheetSupport: nearest = cp return nearest - def toggleMark(self): - current_pos = self.__getCurrentPosition() + def toggleMark(self, onlyremove=False, onlyadd=False, tolerance=5*90000): + current_pos = self.cueGetCurrentPosition() if current_pos is None: print "not seekable" return nearest_cutpoint = self.getNearestCutPoint(current_pos) - if nearest_cutpoint is not None and abs(nearest_cutpoint[0] - current_pos) < 5*90000: - self.removeMark(nearest_cutpoint) - else: + if nearest_cutpoint is not None and abs(nearest_cutpoint[0] - current_pos) < tolerance: + if not onlyadd: + self.removeMark(nearest_cutpoint) + elif not onlyremove: self.addMark((current_pos, self.CUT_TYPE_MARK)) def addMark(self, point):