sumdur: New script, calculates duration for multiple media files
[sunny256-utils.git] / scrdump
blob471067078d96d70783c583d64acf1957c04d4aaa
1 #!/usr/bin/env bash
3 #=======================================================================
4 # scrdump
5 # File ID: 64a02bf2-3e32-11de-b61f-000475e441b9
7 # Screen dump in X.
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
13 progname=scrdump
14 VERSION=0.1.1
16 ARGS="$(getopt -o "\
20 " -l "\
21 help,\
22 quiet,\
23 verbose,\
24 version,\
25 " -n "$progname" -- "$@")"
26 test "$?" = "0" || exit 1
27 eval set -- "$ARGS"
29 opt_help=0
30 opt_quiet=0
31 opt_verbose=0
32 while :; do
33 case "$1" in
34 -h|--help) opt_help=1; shift ;;
35 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
36 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
37 --version) echo $progname $VERSION; exit 0 ;;
38 --) shift; break ;;
39 *) echo $progname: Internal error >&2; exit 1 ;;
40 esac
41 done
42 opt_verbose=$(($opt_verbose - $opt_quiet))
44 scrdumpdir=$HOME/annex/opptak/alt/$(date -u +"%Y/%m")
46 if test "$opt_help" = "1"; then
47 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
48 cat <<END
50 Screendump in X, place files in
51 $scrdumpdir/
53 Usage: $progname [options]
55 Options:
57 -h, --help
58 Show this help.
59 -q, --quiet
60 Be more quiet. Can be repeated to increase silence.
61 -v, --verbose
62 Increase level of verbosity. Can be repeated.
63 --version
64 Print version information.
66 END
67 exit 0
70 [ -d $scrdumpdir/. ] || mkdir -p $scrdumpdir || {
71 echo "$0: $scrdumpdir: Cannot create directory" >&2
72 exit 1
75 TZ=UTC shutter -e --full -n \
76 -o $scrdumpdir/%Y%m%dT%H%M%SZ.$(hostname)-screendump.\$wx\$h.png \
77 2>/dev/null