Dolda2000 GitWeb
/
utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
planime: Use an mpv profile to get host-local TV output options instead of hardcoding...
[utils.git]
/
planime
diff --git
a/planime
b/planime
index
0ecb770
..
c53a425
100755
(executable)
--- a/
planime
+++ b/
planime
@@
-73,62
+73,67
@@
findfile() {
origargs=("$0" "$@")
cmdline=(mpv -fs)
debug=
origargs=("$0" "$@")
cmdline=(mpv -fs)
debug=
+log=y
unset pretend printfile
unset pretend printfile
-while [ "${1:0:1}" = - ]; do
- a="$1"
- shift
- case "$a" in
- -h)
- echo "usage: planime [-fdhtC] [-A PLAYER-ARGS... ;] [-s PAR VAL] [--] [NAME-QUAL] [EP|.] [TYPE-QUAL]" >&2
+usage() {
+ echo "usage: planime [-fdhtCL] [-A PLAYER-ARGS... ;] [-s PAR=VAL] [--] [NAME-QUAL] [EP|.] [TYPE-QUAL]"
+}
+
+while getopts hdtCLA:s:fv opt; do
+ case "$opt" in
+ h)
+ usage
exit 0
;;
exit 0
;;
-
-
d)
+ d)
debug=y
;;
debug=y
;;
-
-
t)
- cmdline=("${cmdline[@]}" -
ao 'alsa:device=[hw:3,7]'
)
+ t)
+ cmdline=("${cmdline[@]}" -
profile tv
)
DISPLAY=:1
chwp=y
;;
DISPLAY=:1
chwp=y
;;
-
-
C)
+ C)
pretend=y
;;
pretend=y
;;
- -A)
- while :; do
- if [ $# -lt 1 ]; then
+ L)
+ log=
+ ;;
+ A)
+ while [ "$OPTARG" != \; ]; do
+ cmdline+=("$OPTARG")
+ if [ "$OPTIND" -gt $# ]; then
echo "planime: unterminated argument list" >&2
exit 1
fi
echo "planime: unterminated argument list" >&2
exit 1
fi
- a="$1"
- shift
- if [ "$a" = \; ]; then
- break;
- fi
- cmdline=("${cmdline[@]}" "$a")
+ OPTARG="${!OPTIND}"
+ let OPTIND++
done
;;
done
;;
- -s)
- savepar="$1"
- shift
- saveval="$1"
- shift
+ s)
+ p="$(expr index "$OPTARG" =)"
+ if [ "$p" -le 0 ]; then
+ usage >&2
+ exit 1
+ fi
+ savepar="${OPTARG:0:p}"
+ let p++
+ saveval="${OPTARG:p}"
;;
;;
-
-
f)
+ f)
printfile=y
;;
printfile=y
;;
- -v)
- cmdline=("${cmdline[@]}" -v)
- ;;
- --)
- break
+ v)
+ cmdline+=(-v)
;;
*)
;;
*)
- echo "planime: unknown option \`$a'"
+ usage >&2
exit 1
;;
esac
done
exit 1
;;
esac
done
+shift $((OPTIND - 1))
dirbase="$(basename "$(pwd)")"
base=.
dirbase="$(basename "$(pwd)")"
base=.
@@
-258,6
+263,11
@@
elif [ -n "$printfile" ]; then
echo "$file"
else
if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
echo "$file"
else
if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
+ if [ "$log" = y ]; then
+ if [ -d $HOME/.anime ]; then
+ echo "$(date) $(basename "$file")" >>$HOME/.anime/plog
+ fi
+ fi
"${cmdline[@]}" "$file"
if [ "$nextep" = y ]; then
"${cmdline[@]}" "$file"
if [ "$nextep" = y ]; then