New extension handling.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sun, 10 Jun 2007 02:29:04 +0000 (02:29 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sun, 10 Jun 2007 02:29:04 +0000 (02:29 +0000)
Usable.

git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@1070 959494ce-11ee-0310-bf91-de5d638817bd

planime

diff --git a/planime b/planime
index 731a467..41332ae 100755 (executable)
--- a/planime
+++ b/planime
@@ -96,39 +96,19 @@ if [ "$nextep" = y -a -r nextep ]; then
 fi
 file="$(findfile "$base - " "$ep" "$qual")"
 
-if [ -z "$file" ]; then
+if [ -z "$file" -o ! -r "$file" ]; then
     echo "planime: no matching file found" >&2
     exit 1
 fi
 
-echo "$file"
-exit 0
-
-if [ ! -r "$ep" ]; then
-    if [ -z "$qual" ]; then
-       ep="$(basename "$(pwd)") - ${ep}"
-    else
-       ep="$(basename "$(pwd)") ${qual} - ${ep}"
-    fi
-    if [ -r "${ep}.ogm" ]; then
-       ep="${ep}.ogm"
+case "${file##*.}" in
+    ogm)
        defopts=(-aid 1 -sid 0)
-    elif [ -r "${ep}.mkv" ]; then
-       ep="${ep}.mkv"
+       ;;
+    mkv)
        defopts=(-slang eng -alang jpn)
-    elif [ -r "${ep}.mpg" ]; then
-       ep="${ep}.mpg"
-    elif [ -r "${ep}.mp4" ]; then
-       ep="${ep}.mp4"
-    elif [ -r "${ep}.avi" ]; then
-       ep="${ep}.avi"
-    fi
-fi
-
-if [ ! -r "$ep" ]; then
-    echo "no such episode: $ep" >&2
-    exit 1
-fi
+       ;;
+esac
 
 ifile=".${ep}.info"
 
@@ -153,4 +133,4 @@ fi
 if [ "`hostname`" = pc6 ]; then chwp=y; fi
 
 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
-"${cmdline[@]}" "$ep"
+"${cmdline[@]}" "$file"