--- /dev/null
+#!/bin/sh
+
+cmdline=(mplayer -fs)
+
+while [ "${1:0:1}" = - ]; do
+ a="$1"
+ shift
+ case "$a" in
+ -t)
+ cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
+ ;;
+ -s)
+ savepar="$1"
+ shift
+ saveval="$1"
+ shift
+ ;;
+ esac
+done
+
+if [ $# -lt 1 ]; then
+ echo "usage: planime [QUAL] EPNUM" >&2
+ exit 1
+fi
+if [ $# -eq 1 ]; then
+ ep="$1"
+ unset qual
+elif [ $# -eq 2 ]; then
+ qual="$1"
+ ep="$2"
+fi
+
+if [ ! -r "$ep" ]; then
+ if [ -z "$qual" ]; then
+ ep="$(basename "$(pwd)") - ${ep}"
+ else
+ ep="$(basename "$(pwd)") ${qual} - ${ep}"
+ fi
+ if [ -r "${ep}.ogm" ]; then
+ ep="${ep}.ogm"
+ defopts=(-aid 1 -sid 0)
+ elif [ -r "${ep}.mkv" ]; then
+ ep="${ep}.mkv"
+ defopts=(-slang eng -alang jpn)
+ elif [ -r "${ep}.mpg" ]; then
+ ep="${ep}.mpg"
+ elif [ -r "${ep}.mp4" ]; then
+ ep="${ep}.mp4"
+ elif [ -r "${ep}.avi" ]; then
+ ep="${ep}.avi"
+ fi
+fi
+
+if [ ! -r "$ep" ]; then
+ echo "no such episode: $ep" >&2
+ exit 1
+fi
+
+ifile=".${ep}.info"
+
+if [ -n "$savepar" ]; then
+ if [ -r "$ifile" ]; then
+ exec 3<"$ifile"
+ rm "$ifile"
+ egrep -v "^${savepar}:" 0<&3 >"$ifile"
+ exec 3<&-
+ fi
+ echo "$savepar: $saveval" >>"$ifile"
+ exit 0
+fi
+
+unset delay
+
+if [ -r "$ifile" ]; then
+ delay="`sed -n 's/delay *: *\([^ ]*\)$/\1/p' <"$ifile"`"
+ cmdline=("${cmdline[@]}" -delay "$delay")
+else
+ cmdline=("${cmdline[@]}" "${defopts[@]}")
+fi
+
+if [ "`hostname`" = pc6 ]; then chwp=y; fi
+
+if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
+"${cmdline[@]}" "$ep"