also handle wav-to-ogg
authorRudolf Polzer <divVerent@alientrap.org>
Thu, 5 Aug 2010 13:33:03 +0000 (15:33 +0200)
committerRudolf Polzer <divVerent@alientrap.org>
Thu, 5 Aug 2010 13:33:03 +0000 (15:33 +0200)
misc/tools/cached-converter.sh

index 99800c53a1441c3b620fef8a1d8752f246095677..7cd23ff70e4ddc762db89d29cf60df121fe9630a 100755 (executable)
@@ -100,7 +100,7 @@ reduce_jpeg_jpeg()
        cp "$i" "$o" && jpegoptim --strip-all -m"$1" "$o"
 }
 
-reduce_ogg()
+reduce_ogg_ogg()
 {
        i=$1; shift; shift
        o=$1; shift; shift
@@ -108,6 +108,13 @@ reduce_ogg()
        oggenc -q"$1" -o "$o" "$tmpdir/x.wav"
 }
 
+reduce_wav_ogg()
+{
+       i=$1; shift; shift
+       o=$1; shift; shift
+       oggenc -q"$1" -o "$o" "$i"
+}
+
 reduce_rgba_dds()
 {
        i=$1; shift; shift
@@ -165,7 +172,9 @@ for F in "$@"; do
                        # handle in *.jpg case
 
                        # they always got converted, I assume
-                       conv=true
+                       if $do_dds || $do_jpeg; then
+                               conv=true
+                       fi
                        keep=$do_jpeg
                        ;;
                *.jpg)
@@ -192,7 +201,10 @@ for F in "$@"; do
                        rm -f "$F.hasalpha"
                        ;;
                *.ogg)
-                       cached "$do_ogg" reduce_ogg "$F" "" "$F" "" "$ogg_qual"
+                       cached "$do_ogg" reduce_ogg_ogg "$F" "" "$F" "" "$ogg_qual"
+                       ;;
+               *.wav)
+                       cached "$do_ogg" reduce_wav_ogg "$F" "" "$F" "" "$ogg_qual"
                        ;;
        esac
        if $del_src; then