Working so far

This commit is contained in:
Skylar Grant 2024-06-23 16:14:55 -04:00
parent 29ae482d46
commit d04c38a6ed
1 changed files with 3 additions and 66 deletions

View File

@ -133,43 +133,8 @@ create_folders_mac() {
fi
}
# Create and open NAS folders.
create_folders_nas() {
# Check if the parent ingest directory doesn't exist
if [[ ! -d "$NAS_MOUNT_POINT/$NAS_INGEST_PATH" ]]; then
echo "Creating ingest directories at $NAS_INGEST_PATH/{ARW,JPG,MP4}..."
# Since the parent doesn't exist, we create it and all children at once
mkdir -p "$NAS_MOUNT_POINT/$NAS_INGEST_PATH"/{ARW,JPG,MP4}
# $? is the exit status of the last commmand, with 0 being success
if [[ $? -eq 0 ]]; then
echo "Success!"
else
echo "Failed to create directories at $NAS_MOUNT_POINT/$NAS_INGEST_PATH"
exit 1
fi
else
# The parent directory exists, but do the children?
echo "Parent ingest directory already exists. Checking for subdirectories..."
# Iterate over each folder name
for folder in ARW JPG MP4; do
# If the subdir doesn't exist
if [[ ! -d "$NAS_MOUNT_POINT/$NAS_INGEST_PATH/$folder" ]]; then
echo "Subdirectory $folder is missing, creating..."
# Create the missing subdir
mkdir -p "$NAS_MOUNT_POINT/$NAS_INGEST_PATH/$folder"
# $? is the exit status of the last commmand, with 0 being success
if [[ $? -eq 0 ]]; then
echo "Successfully created $NAS_MOUNT_POINT/$NAS_INGEST_PATH/$folder"
else
echo "Failed to create $NAS_MOUNT_POINT/$NAS_INGEST_PATH/$folder"
exit 1
fi
fi
done
fi
}
# Cleanup images on camera SD.
# TODO: Update this for the new combined script
clean_sd() {
# Check if the SD card is mounted
if mount | grep -q "/Volumes/NO NAME"; then
@ -204,8 +169,7 @@ clean_sd() {
read -n 1 -s
}
# Camera->Mac Ingest
# TODO: Add file type arrays, this won't work for the drone right now
# SD->Mac Ingest
ingest_mac() {
local src="${SD_MOUNT_POINT[$INGEST_MODE]}/${SD_SRC_PATH[$INGEST_MODE]}"
create_folders_mac
@ -257,7 +221,7 @@ ingest_mac() {
read -n 1 -s
}
# Mac->NAS Ingest
# Mac->NAS Sync
ingest_nas() {
local dry_run=""
# Detect if dry run
@ -272,33 +236,6 @@ ingest_nas() {
read -n 1 -s
# Sync /Volumes/voidf1sh/Pictures/Camera Ingest/ with NAS/media/Camera Ingest/
rsync -azv --progress "${MAC_INGEST_FOLDER[$INGEST_MODE]}/" "$NAS_MOUNT_POINT${NAS_INGEST_FOLDER[$INGEST_MODE]}/" $dry_run
# Copy JPG files
# jpg_files=("$MAC_INGEST_PATH/JPG/"*.JPG)
# if [[ -f "${jpg_files[0]}" ]]; then
# echo "Copying JPGs..."
# rsync -avz --progress "$MAC_INGEST_PATH/JPG/"*.JPG "$NAS_MOUNT_POINT/$NAS_INGEST_PATH/JPG/"
# else
# echo "No JPGs, skipping."
# fi
# # Copy ARW files
# arw_files=("$MAC_INGEST_PATH/ARW/"*.ARW)
# if [[ -f "${arw_files[0]}" ]]; then
# echo "Copying ARWs..."
# rsync -avz --progress "$MAC_INGEST_PATH/ARW/"*.ARW "$NAS_MOUNT_POINT/$NAS_INGEST_PATH/ARW/"
# else
# echo "No ARWs, skipping."
# fi
# # Copy MP4 files
# mp4_files=("$MAC_INGEST_PATH/MP4/"*.MP4)
# if [[ -f "${mp4_files[0]}" ]]; then
# echo "Copying MP4s..."
# rsync -avz --progress "$MAC_INGEST_PATH/MP4/"*.MP4 "$NAS_MOUNT_POINT/$NAS_INGEST_PATH/MP4/"
# else
# echo "No MP4s, skipping."
# fi
echo "Ingest complete!"
echo "Press any key to return to the menu..."
read -n 1 -s