Dolda2000 GitWeb
/
utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Exit properly on errors in icom.
[utils.git]
/
planime
diff --git
a/planime
b/planime
index
dfb8d64
..
3dab1dd
100755
(executable)
--- a/
planime
+++ b/
planime
@@
-15,6
+15,7
@@
scorefile() {
}
findfile() {
}
findfile() {
+ if [ -n "$debug" ]; then echo "finding base='$1', ep='$2', qual='$3'" >&2; fi
local file tail eq eqt m matches max score
matches=()
for file in "$1"*; do
local file tail eq eqt m matches max score
matches=()
for file in "$1"*; do
@@
-45,27
+46,33
@@
findfile() {
max=
for m in "${matches[@]}"; do
score="$(scorefile "$m")"
max=
for m in "${matches[@]}"; do
score="$(scorefile "$m")"
+ if [ -n "$debug" ]; then echo "found \`$m': score $score" >&2; fi
if [ -z "$max" ] || [ "$score" -gt "$max" ]; then
max="$score"
file="$m"
fi
done
if [ -z "$max" ] || [ "$score" -gt "$max" ]; then
max="$score"
file="$m"
fi
done
+ if [ -n "$debug" ]; then echo "using \`$file'" >&2; fi
echo "$file"
return 0
}
origargs=("$0" "$@")
cmdline=(mplayer -fs -ass)
echo "$file"
return 0
}
origargs=("$0" "$@")
cmdline=(mplayer -fs -ass)
-unset pretend
+debug=
+unset pretend printfile
while [ "${1:0:1}" = - ]; do
a="$1"
shift
case "$a" in
-h)
while [ "${1:0:1}" = - ]; do
a="$1"
shift
case "$a" in
-h)
- echo "usage: planime [-
htC] [-s PAR VAL
] [NAME-QUAL] [EP|.] [TYPE-QUAL]" >&2
+ echo "usage: planime [-
fdhtC] [-A PLAYER-ARGS... ;] [-s PAR VAL] [--
] [NAME-QUAL] [EP|.] [TYPE-QUAL]" >&2
exit 0
;;
exit 0
;;
+ -d)
+ debug=y
+ ;;
-t)
cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
;;
-t)
cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
;;
@@
-88,6
+95,16
@@
while [ "${1:0:1}" = - ]; do
saveval="$1"
shift
;;
saveval="$1"
shift
;;
+ -f)
+ printfile=y
+ ;;
+ --)
+ break
+ ;;
+ *)
+ echo "planime: unknown option \`$a'"
+ exit 1
+ ;;
esac
done
esac
done
@@
-216,6
+233,8
@@
if [ "`hostname`" = pc6 -o "`hostname`" = pc7 -a "$DISPLAY" = :1 ]; then chwp=y;
if [ -n "$pretend" ]; then
echo "${cmdline[@]}" "$file"
if [ -n "$pretend" ]; then
echo "${cmdline[@]}" "$file"
+elif [ -n "$printfile" ]; then
+ echo "$file"
else
if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
"${cmdline[@]}" "$file"
else
if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
"${cmdline[@]}" "$file"