Created
November 20, 2022 14:01
-
-
Save toresbe/6db3faf2d98afcd0a8028340d8f739e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ENDPOINT_URL=http://10.102.38.194 | |
S4_ARGS="--endpoint-url $ENDPOINT_URL " | |
cd /mnt/media | |
for file in */original/*; do | |
VIDEO_ID=$(echo "${file}" | cut -f1 -d/) | |
TARGET_PATH="s3://${BUCKET}/${VIDEO_ID}_O_$(basename "${file}")" | |
if s4cmd $S4_ARGS put "${file}" "${TARGET_PATH}"; then | |
echo -n "Successfully copied: " | |
echo $VIDEO_ID,${TARGET_PATH} | tee -a ~/copied_videos | |
else | |
echo -n "ERROR COPYING: " | |
echo $VIDEO_ID,${TARGET_PATH} | tee -a ~/not_copied_videos | |
fi | |
done | |
for file in */broadcast/*; do | |
VIDEO_ID=$(echo "${file}" | cut -f1 -d/) | |
TARGET_PATH="s3://${BUCKET}/${VIDEO_ID}_B_$(basename "${file}")" | |
if grep -e ^${VIDEO_ID}, ~/copied_videos; then | |
echo "Skipping broadcast of video ${VIDEO_ID} as the original was copied" | |
echo $VIDEO_ID | tee -a ~/skipped_videos | |
fi | |
if s4cmd $S4_ARGS put "${file}" "${TARGET_PATH}"; then | |
echo -n "Successfully copied: " | |
echo $VIDEO_ID,${TARGET_PATH} | tee -a ~/copied_videos | |
else | |
echo -n "ERROR COPYING: " | |
echo $VIDEO_ID,${TARGET_PATH} | tee -a ~/not_copied_videos | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment