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)
41 while [ "${1:0:1}" = - ]; do
46 echo "usage: planime [-htC] [-s PAR VAL] [NAME-QUAL] [EP|.] [TYPE-QUAL]" >&2
50 cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
59 if [ "$a" = \; ]; then
62 cmdline=("${cmdline[@]}" "$a")
74 base="$(basename "$(pwd)")"
80 if [ -r curser ]; then
81 base="$base $(<curser)"
83 elif [ $# -eq 1 ]; then
87 if findfile "$base - " "$1" >/dev/null; then
94 elif [ $# -eq 2 ]; then
95 if findfile "$base - " "$1" "$2" >/dev/null; then
99 if [ "$1" = . -a -r curser ]; then
100 base="$base $(<curser)"
107 if [ "$1" = . -a -r curser ]; then
108 base="$base $(<curser)"
115 if [ "$ep" = . ]; then nextep=y; fi
116 if [ "$nextep" = y -a -r nextep ]; then
118 if ! isnum "$ep"; then
119 echo "planime: nextep is non-numeric" >&2
123 if [ -z "$file" ]; then
124 file="$(findfile "$base - " "$ep" "$tqual")"
127 if [ -z "$file" -o ! -r "$file" ]; then
128 echo "planime: no matching file found" >&2
132 case "${file##*.}" in
143 ifile=".${file}.info"
145 if [ -n "$savepar" ]; then
146 if [ -r "$ifile" ]; then
147 egrep -v "^${savepar} " "$ifile" >"$ifile.new"
148 mv -f "$ifile.new" "$ifile"
150 echo "$savepar $saveval" >>"$ifile"
156 if [ -r "$ifile" ]; then
159 while read par arg; do
160 if [ "$par" = delay ]; then
161 cmdline=("${cmdline[@]}" -delay "$arg")
162 elif [ "$par" = aspect ]; then
163 cmdline=("${cmdline[@]}" -aspect "$arg")
164 elif [ "$par" = volmod ]; then
165 cmdline=("${cmdline[@]}" -af volume="$arg")
166 elif [ "$par" = alang ]; then
169 elif [ "$par" = aid ]; then
172 elif [ "$par" = slang ]; then
175 elif [ "$par" = sid ]; then
184 if [ -n "$alang" ]; then
185 cmdline=("${cmdline[@]}" -alang "$alang")
186 elif [ -n "$aid" ]; then
187 cmdline=("${cmdline[@]}" -aid "$aid")
189 if [ -n "$slang" ]; then
190 cmdline=("${cmdline[@]}" -slang "$slang")
191 elif [ -n "$sid" ]; then
192 cmdline=("${cmdline[@]}" -sid "$sid")
195 if [ "`hostname`" = pc6 -o "`hostname`" = pc7 -a "$DISPLAY" = :1 ]; then chwp=y; fi
197 if [ -n "$pretend" ]; then
198 echo "${cmdline[@]}" "$file"
200 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
201 "${cmdline[@]}" "$file"
203 if [ "$nextep" = y ]; then
204 echo "0. Save and continue (or Space)"
205 echo "1. Continue without saving"
206 echo "2. Save and exit (or Enter)"
207 echo "3. Exit without saving (or any key)"
223 if [ "$save" = y ]; then
227 if [ "$cont" = y ]; then
228 exec "${origargs[@]}"