Skip to content

Commit

Permalink
Use specific exceptions catching
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs committed Aug 8, 2023
1 parent d0bfd1a commit 622513a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions roop/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ def run_ffmpeg(args: List[str]) -> bool:
try:
subprocess.check_output(commands, stderr=subprocess.STDOUT)
return True
except Exception:
pass
return False
except subprocess.CalledProcessError:
return False


def detect_fps(target_path: str) -> float:
Expand All @@ -37,9 +36,8 @@ def detect_fps(target_path: str) -> float:
try:
numerator, denominator = map(int, output)
return numerator / denominator
except Exception:
pass
return 30
except (ValueError, ZeroDivisionError):
return 30


def extract_frames(target_path: str, fps: float = 30) -> bool:
Expand Down

0 comments on commit 622513a

Please sign in to comment.