Skip to content

Commit

Permalink
Return the filename to the handler script
Browse files Browse the repository at this point in the history
  • Loading branch information
waldoj committed Mar 3, 2024
1 parent 5a8a46f commit 828db85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bin/get_video.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,5 +354,5 @@ function delete($message)
$log->put('Stored new ' . ucfirst($video->chamber) . ' ' . $video->type . ' video, for '
. date('M d, Y', strtotime($video->date)) . ': ' . $video->path, 4);

// Return the video ID to be captured by the Bash script
//echo $video_handler->id;
// Return the filename to be captured by the Bash handler
echo $video->filename;
8 changes: 4 additions & 4 deletions bin/handler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mkdir -p "$VIDEO_DIR"
# Retrieve the video, saving it to a file and S3 (but not MySQL). The PHP script sends to stderr a
# 1 in case of failure and 2 if there are no further videos in the queue.
cd "$VIDEO_DIR" || exit 1
VIDEO_ID=$(php ../bin/get_video.php)
FILENAME=$(php ../bin/get_video.php)
GOT_VIDEO=$?
if [ $GOT_VIDEO -eq 1 ]; then
exit 1
Expand Down Expand Up @@ -74,12 +74,12 @@ if [ "$step_all" = true ] || [ "$step_all" = "1" ]; then
fi

# Define the name of the directory that will store the extracted chyrons and screenshots
export output_dir="${filename/.mp4/}"
export output_dir="${FILENAME/.mp4/}"
mkdir "$VIDEO_DIR$output_dir"

# Save the video to the database
cd ..
export VIDEO_ID="$(php bin/save_metadata.php "$filename" "$output_dir")" || exit $?
export VIDEO_ID="$(php bin/save_metadata.php "$FILENAME" "$output_dir")" || exit $?

# Make sure that we got a valid video ID.
if [[ "$VIDEO_ID" =~ ^[0-9]+$ ]]; then
Expand All @@ -91,7 +91,7 @@ fi

# OCR the video.
if [ "$step_ocr_chyrons" = true ]; then
../bin/ocr.py "$VIDEO_ID" "$output_dir" "$filename"
../bin/ocr.py "$VIDEO_ID" "$output_dir" "$FILENAME"
fi

# Generate screenshots and thumbnails.
Expand Down

0 comments on commit 828db85

Please sign in to comment.