-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamtool
More file actions
executable file
·49 lines (42 loc) · 784 Bytes
/
Copy pathcamtool
File metadata and controls
executable file
·49 lines (42 loc) · 784 Bytes
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
45
46
47
48
49
#!/usr/bin/env sh
MNT="/tmp/CamMount"
die(){
echo [0m[31m$@ >&2[0m
unmount
exit 1
}
pull_all() {
shopt -s globstar
set -x
rsync --verbose --progress --remove-source-files --no-relative --no-implied-dirs \
"$(mount)"/** ${1:-"."} &&
set +x
unmount
}
mount() {
mkdir -p $MNT &&
gphotofs $MNT &&
while ! ls $MNT >/dev/null
do sleep 1
done
echo $MNT
}
unmount() {
fusermount -u $MNT
rmdir $MNT
}
get_newest() {
set -x
find "$(mount)" -type f -iname '*.JPG' | xargs ls -t | head -1 | xargs cat | magick jpg:- -identify -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG latest.jpg &&
dragon latest.jpg &&
unmount
}
show_help() {
echo "Available Commands:"
declare -F | awk '{print "- "$3}'
exit 1
}
test -z "$1" && show_help
cmd=$1
shift
$cmd $@