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 echo "usage: planime [-ht] [-s PAR VAL] [NAME-QUAL] [EP|.] [TYPE-QUAL]" >&2
48 cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
59 base="$(basename "$(pwd)")"
65 elif [ $# -eq 1 ]; then
69 if findfile "$base - " "$1" >/dev/null; then
76 elif [ $# -eq 2 ]; then
77 if findfile "$base - " "$1" "$2" >/dev/null; then
89 if [ "$ep" = . ]; then nextep=y; fi
90 if [ "$nextep" = y -a -r nextep ]; then
92 if ! isnum "$ep"; then
93 echo "planime: nextep is non-numeric" >&2
97 file="$(findfile "$base - " "$ep" "$qual")"
99 if [ -z "$file" ]; then
100 echo "planime: no matching file found" >&2
107 if [ ! -r "$ep" ]; then
108 if [ -z "$qual" ]; then
109 ep="$(basename "$(pwd)") - ${ep}"
111 ep="$(basename "$(pwd)") ${qual} - ${ep}"
113 if [ -r "${ep}.ogm" ]; then
115 defopts=(-aid 1 -sid 0)
116 elif [ -r "${ep}.mkv" ]; then
118 defopts=(-slang eng -alang jpn)
119 elif [ -r "${ep}.mpg" ]; then
121 elif [ -r "${ep}.mp4" ]; then
123 elif [ -r "${ep}.avi" ]; then
128 if [ ! -r "$ep" ]; then
129 echo "no such episode: $ep" >&2
135 if [ -n "$savepar" ]; then
136 if [ -r "$ifile" ]; then
137 egrep -v "^${savepar}:" "$ifile" >"$ifile.new"
138 mv -f "$ifile.new" "$ifile"
140 echo "$savepar: $saveval" >>"$ifile"
146 if [ -r "$ifile" ]; then
147 delay="`sed -n 's/delay *: *\([^ ]*\)$/\1/p' <"$ifile"`"
148 cmdline=("${cmdline[@]}" -delay "$delay")
150 cmdline=("${cmdline[@]}" "${defopts[@]}")
153 if [ "`hostname`" = pc6 ]; then chwp=y; fi
155 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
156 "${cmdline[@]}" "$ep"