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" = volmod ]; then
161 cmdline=("${cmdline[@]}" -af volume="$arg")
162 elif [ "$par" = alang ]; then
165 elif [ "$par" = aid ]; then
168 elif [ "$par" = slang ]; then
171 elif [ "$par" = sid ]; then
180 if [ -n "$alang" ]; then
181 cmdline=("${cmdline[@]}" -alang "$alang")
182 elif [ -n "$aid" ]; then
183 cmdline=("${cmdline[@]}" -aid "$aid")
185 if [ -n "$slang" ]; then
186 cmdline=("${cmdline[@]}" -slang "$slang")
187 elif [ -n "$sid" ]; then
188 cmdline=("${cmdline[@]}" -sid "$sid")
191 if [ "`hostname`" = pc6 -o "`hostname`" = pc7 -a "$DISPLAY" = :1 ]; then chwp=y; fi
193 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
194 "${cmdline[@]}" "$file"
196 if [ "$nextep" = y ]; then
197 echo "0. Save and continue (or Space)"
198 echo "1. Continue without saving"
199 echo "2. Save and exit (or Enter)"
200 echo "3. Exit without saving (or any key)"
216 if [ "$save" = y ]; then
220 if [ "$cont" = y ]; then
221 exec "${origargs[@]}"