-
Notifications
You must be signed in to change notification settings - Fork 0
/
card2disk.sh
executable file
·44 lines (40 loc) · 1 KB
/
card2disk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
export PYTHONLOGLEVEL=info
STUDIO=`mktemp --directory`
source=`mktemp --directory --tmpdir=$STUDIO`
while getopts 'a:d:s:vh' option; do
case $option in
a) adjust=$OPTARG ;;
d) destination=$OPTARG ;;
s)
ln --symbolic "`realpath "$OPTARG"`" $source/`uuid -v4`
;;
v) videos="--with-videos" ;;
h)
cat <<EOF
Usage: $0
-s Source
-d Destination
-v Also archive video
-a Adjust picture timestamp: [+|-]=[H:MM]
This argument is passed directly to exiftool's -AllDates
option; remember to quote! See the exiftool manpage.
EOF
exit 0
;;
*)
echo -e Unrecognized option \"$option\"
exit 1
;;
esac
done
if [ -n "$adjust" ]; then
tmp=`mktemp --directory --tmpdir=$STUDIO`
exiftool -recurse -AllDates"${adjust}" -out $tmp $source
source=$tmp
fi
caffeinate -i bash <<EOF
exiftool -recurse -csv -quiet $source \
| python card2disk.py $videos --destination $destination
rm --recursive --force $STUDIO
EOF