Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
keyaloding committed Jul 15, 2024
1 parent c1c925c commit c8e8ab0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sleap_io/io/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def from_filename(
dataset: Optional[str] = None,
grayscale: Optional[bool] = None,
keep_open: bool = True,
_frame_rate: Optional[bool] = None,
**kwargs,
) -> VideoBackend:
"""Create a VideoBackend from a filename.
Expand Down Expand Up @@ -191,9 +190,10 @@ def frames(self) -> int:
def frame_rate(self) -> Optional[float]:
"""Frames per second of the video."""
video_extensions = ["mp4", "avi", "mov", "mj2", "mkv", "slp"]
if isinstance(self.filename, str):
if any(self.filename.endswith(ext) for ext in video_extensions):
return cv2.VideoCapture(self.filename).get(cv2.CAP_PROP_FPS)
if isinstance(self.filename, str) and any(
self.filename.endswith(ext) for ext in video_extensions
):
return cv2.VideoCapture(self.filename).get(cv2.CAP_PROP_FPS)
return self._frame_rate

def __len__(self) -> int:
Expand Down

0 comments on commit c8e8ab0

Please sign in to comment.