Skip to content

Commit

Permalink
refactor: simplify _seek_closest_stored_position with max
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixAbrahamsson authored and samedii committed Jun 15, 2021
1 parent 77ae197 commit 6530404
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions kw6/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ def _seek_closest_stored_position(self, frame_index: types.FRAME_INDEX):
if position <= frame_index
]
if len(available_positions) > 0:
closest_position = min(
available_positions,
key=lambda position: frame_index - position,
)
self.stream.seek(self.cached_positions[closest_position])
self.stream.seek(self.cached_positions[max(available_positions)])

def __iter__(self):
'''Iterate over positions and cameras in the file from current stream position'''
Expand Down

0 comments on commit 6530404

Please sign in to comment.