Skip to content

Commit

Permalink
[InfoBarGenerics] fix jumpPreviousMark
Browse files Browse the repository at this point in the history
  • Loading branch information
teamblue-e2 committed May 15, 2024
1 parent 415c480 commit f737802
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/python/Screens/InfoBarGenerics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3589,11 +3589,11 @@ def cueGetEndCutPosition(self):
isin = True
return ret

def jumpPreviousNextMark(self, _cmp, start=False):
def jumpPreviousNextMark(self, cmp, start=False):
current_pos = self.cueGetCurrentPosition()
if current_pos is None:
return False
mark = self.getNearestCutPoint(current_pos, _cmp=_cmp, start=start)
mark = self.getNearestCutPoint(current_pos, cmp=cmp, start=start)
if mark is not None:
pts = mark[0]
else:
Expand All @@ -3611,21 +3611,21 @@ def jumpNextMark(self):
if not self.jumpPreviousNextMark(lambda x: x - 90000):
self.doSeek(-1)

def getNearestCutPoint(self, pts, _cmp=abs, start=False):
def getNearestCutPoint(self, pts, cmp=abs, start=False):
# can be optimized
beforecut = True
nearest = None
bestdiff = -1
instate = True
if start:
bestdiff = (0 > pts) - (0 < pts)
bestdiff = cmp(0 - pts)
if bestdiff >= 0:
nearest = [0, False]
for cp in self.cut_list:
if beforecut and cp[1] in (self.CUT_TYPE_IN, self.CUT_TYPE_OUT):
beforecut = False
if cp[1] == self.CUT_TYPE_IN: # Start is here, disregard previous marks
diff = (cp[0] > pts) - (cp[0] < pts)
diff = cmp(cp[0] - pts)
if start and diff >= 0:
nearest = cp
bestdiff = diff
Expand All @@ -3637,7 +3637,7 @@ def getNearestCutPoint(self, pts, _cmp=abs, start=False):
elif cp[1] == self.CUT_TYPE_OUT:
instate = False
elif cp[1] in (self.CUT_TYPE_MARK, self.CUT_TYPE_LAST):
diff = (cp[0] > pts) - (cp[0] < pts)
diff = cmp(cp[0] - pts)
if instate and diff >= 0 and (nearest is None or bestdiff > diff):
nearest = cp
bestdiff = diff
Expand Down

0 comments on commit f737802

Please sign in to comment.