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
38 cmdline=(mplayer -fs -ass)
40 while [ "${1:0:1}" = - ]; do
45 echo "usage: planime [-ht] [-s PAR VAL] [NAME-QUAL] [EP|.] [TYPE-QUAL]" >&2
49 cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
55 if [ "$a" = \; ]; then
58 cmdline=("${cmdline[@]}" "$a")
70 base="$(basename "$(pwd)")"
76 if [ -r curser ]; then
77 base="$base $(<curser)"
79 elif [ $# -eq 1 ]; then
83 if findfile "$base - " "$1" >/dev/null; then
90 elif [ $# -eq 2 ]; then
91 if findfile "$base - " "$1" "$2" >/dev/null; then
95 if [ "$1" = . -a -r curser ]; then
96 base="$base $(<curser)"
103 if [ "$1" = . -a -r curser ]; then
104 base="$base $(<curser)"
111 if [ "$ep" = . ]; then nextep=y; fi
112 if [ "$nextep" = y -a -r nextep ]; then
114 if ! isnum "$ep"; then
115 echo "planime: nextep is non-numeric" >&2
119 if [ -z "$file" ]; then
120 file="$(findfile "$base - " "$ep" "$tqual")"
123 if [ -z "$file" -o ! -r "$file" ]; then
124 echo "planime: no matching file found" >&2
128 case "${file##*.}" in
139 ifile=".${file}.info"
141 if [ -n "$savepar" ]; then
142 if [ -r "$ifile" ]; then
143 egrep -v "^${savepar} " "$ifile" >"$ifile.new"
144 mv -f "$ifile.new" "$ifile"
146 echo "$savepar $saveval" >>"$ifile"
152 if [ -r "$ifile" ]; then
155 while read par arg; do
156 if [ "$par" = delay ]; then
157 cmdline=("${cmdline[@]}" -delay "$arg")
158 elif [ "$par" = aspect ]; then
159 cmdline=("${cmdline[@]}" -aspect "$arg")
160 elif [ "$par" = alang ]; then
163 elif [ "$par" = aid ]; then
166 elif [ "$par" = slang ]; then
169 elif [ "$par" = sid ]; then
178 if [ -n "$alang" ]; then
179 cmdline=("${cmdline[@]}" -alang "$alang")
180 elif [ -n "$aid" ]; then
181 cmdline=("${cmdline[@]}" -aid "$aid")
183 if [ -n "$slang" ]; then
184 cmdline=("${cmdline[@]}" -slang "$slang")
185 elif [ -n "$sid" ]; then
186 cmdline=("${cmdline[@]}" -sid "$sid")
189 if [ "`hostname`" = pc6 ]; then chwp=y; fi
191 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
192 "${cmdline[@]}" "$file"
194 if [ "$nextep" = y ]; then
195 echo "0. Save and continue (or Space)"
196 echo "1. Continue without saving"
197 echo "2. Save and exit (or Enter)"
198 echo "3. Exit without saving (or any key)"
214 if [ "$save" = y ]; then
218 if [ "$cont" = y ]; then
219 exec "${origargs[@]}"