Skip to content

Commit

Permalink
feat(apto): add support for dry runs
Browse files Browse the repository at this point in the history
  • Loading branch information
streambinder committed Jan 21, 2025
1 parent e20dd67 commit 2c605f1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions media/apto/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# auxiliary functions

function help() {
echo -e "Usage:\n\t$(basename "$0") <path> [-e/--exif|-f/--fs|-n/--name|-s/--smart]"
echo -e "Usage:\n\t$(basename "$0") <path> [-e/--exif|-f/--fs|-n/--name|-s/--smart] [-d/--dry-run]"
}

function install_media_file() {
Expand Down Expand Up @@ -42,6 +42,7 @@ set -euo pipefail
# arguments parsing

MODE=interactive
DRY_RUN=0
TARGETS=()
EXTS=(
3gp
Expand All @@ -67,6 +68,9 @@ while [[ $# -gt 0 ]]; do
help
exit 0
;;
-d | --dry-run)
DRY_RUN=1
;;
-e | --exif)
MODE=exif
_modes="$((_modes + 1))"
Expand Down Expand Up @@ -97,6 +101,10 @@ if [ "${_modes}" -gt 1 ]; then
exit 1
fi

if [ "${DRY_RUN}" = 1 ] && [ "${MODE}" = "interactive" ]; then
MODE=smart
fi

# effective script

exts="${EXTS[*]}"
Expand Down Expand Up @@ -176,7 +184,8 @@ while read -r fname <&3; do
exit 1
fi

echo "Chosen date: ${final_timestamp}"
echo "Chosen date for ${fname}: ${final_timestamp}"
[ "${DRY_RUN}" = 1 ] && continue

# compute timestamp formats
final_exif_timestamp="${final_timestamp}"
Expand Down

0 comments on commit 2c605f1

Please sign in to comment.