X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=planime;h=3dab1dd4c5d4c588bb5e106f9178a691280b4872;hb=c5f010d44d71cb874e5aaf80c51c6cadaf9cfe98;hp=dfb8d64ad4293068c4d7ef641b2b9a1180ff3987;hpb=9fc0aa3b64b75da6ea44b8cba44c72f253fee6d5;p=utils.git diff --git a/planime b/planime index dfb8d64..3dab1dd 100755 --- a/planime +++ b/planime @@ -15,6 +15,7 @@ scorefile() { } 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 @@ -45,27 +46,33 @@ findfile() { 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 [ -n "$debug" ]; then echo "using \`$file'" >&2; fi 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) - 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 ;; + -d) + debug=y + ;; -t) cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1) ;; @@ -88,6 +95,16 @@ while [ "${1:0:1}" = - ]; do saveval="$1" shift ;; + -f) + printfile=y + ;; + --) + break + ;; + *) + echo "planime: unknown option \`$a'" + exit 1 + ;; 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" +elif [ -n "$printfile" ]; then + echo "$file" else if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi "${cmdline[@]}" "$file"