Skip to content

Commit

Permalink
Merge pull request #11 from humphrem/issue-5
Browse files Browse the repository at this point in the history
Give better error messages if user passes no files, or incorrect filenames
  • Loading branch information
humphrem authored Aug 25, 2023
2 parents 12ca6c3 + 61b72b0 commit 3426c33
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion action.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
loading and managing resources, and processing detections into clips.
"""


import os
import sys
import time
import logging
Expand Down Expand Up @@ -211,6 +211,10 @@ def main(args):
environment = args.environment

# Validate argument parameters from user before using them
if len(video_paths) < 1:
logger.error("Error: you must specify one or more video filenames to process")
sys.exit(1)

if buffer_seconds < 0.0:
logger.error("Error: minimum buffer cannot be negative")
sys.exit(1)
Expand Down Expand Up @@ -238,6 +242,11 @@ def main(args):

# Loop over all the video file paths and process each one
for i, video_path in enumerate(video_paths, start=1):
# Make sure this video path actually exists before we try to use it
if not os.path.exists(video_path):
logger.info(f"Video path {video_path} does not exist, skipping.")
continue

file_start_time = time.time()

# If the user requests it via -d flag, remove old clips first
Expand Down

0 comments on commit 3426c33

Please sign in to comment.