4 grep -xq '[0-9]\+' <<<"$1"
8 local file tail eq eqt m
13 if [ "${eq%% *}" -eq "$2" ] 2>/dev/null; then
14 if [[ "$eq" == *\ * ]]; then
20 elif [ "${eq:0:${#2}}" = "$2" ]; then
22 if [ "${eqt:0:1}" = " " -o -z "$eqt" ]; then
28 if [ "$eqt" = "$3" -o "$eqt" = "($3)" ]; then
39 while [ "${1:0:1}" = - ]; do
44 cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
56 echo "usage: planime [QUAL] EPNUM" >&2
62 elif [ $# -eq 2 ]; then
67 if [ ! -r "$ep" ]; then
68 if [ -z "$qual" ]; then
69 ep="$(basename "$(pwd)") - ${ep}"
71 ep="$(basename "$(pwd)") ${qual} - ${ep}"
73 if [ -r "${ep}.ogm" ]; then
75 defopts=(-aid 1 -sid 0)
76 elif [ -r "${ep}.mkv" ]; then
78 defopts=(-slang eng -alang jpn)
79 elif [ -r "${ep}.mpg" ]; then
81 elif [ -r "${ep}.mp4" ]; then
83 elif [ -r "${ep}.avi" ]; then
88 if [ ! -r "$ep" ]; then
89 echo "no such episode: $ep" >&2
95 if [ -n "$savepar" ]; then
96 if [ -r "$ifile" ]; then
97 egrep -v "^${savepar}:" "$ifile" >"$ifile.new"
98 mv -f "$ifile.new" "$ifile"
100 echo "$savepar: $saveval" >>"$ifile"
106 if [ -r "$ifile" ]; then
107 delay="`sed -n 's/delay *: *\([^ ]*\)$/\1/p' <"$ifile"`"
108 cmdline=("${cmdline[@]}" -delay "$delay")
110 cmdline=("${cmdline[@]}" "${defopts[@]}")
113 if [ "`hostname`" = pc6 ]; then chwp=y; fi
115 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
116 "${cmdline[@]}" "$ep"