]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/cached-converter.sh
temporarily slow down file conversion a bit (sleep 0.25) to keep server load down
[xonotic/xonotic.git] / misc / tools / cached-converter.sh
index 0eab3d6946f5ae9fc10048afd7704ffb38a35c97..d7bf5864a212a5e3cf323874f9e67d01509622fb 100755 (executable)
@@ -41,6 +41,7 @@ cached()
        if ! $flag; then
                return 0
        fi
+       sleep 0.25
        if [ x"$infile1" = x"$outfile1" ]; then
                keep=true
        fi
@@ -49,9 +50,9 @@ cached()
                sum=$lastinfileshash
        else
                if [ -n "$git_src_repo" ]; then
-                       sum=`( cd "$git_src_repo"; git rev-parse HEAD:"$infile1" )`
+                       sum=`( cd "$git_src_repo"; git rev-parse --revs-only HEAD:"${infile1#./}" | grep . ) || git hash-object "$infile1"`
                        if [ -n "$infile2" ]; then
-                               sum=`( cd "$git_src_repo"; git rev-parse HEAD:"$infile2" )`
+                               sum=$sum`( cd "$git_src_repo"; git rev-parse --revs-only HEAD:"${infile2#./}" | grep . ) || git hash-object "$infile2"`
                        fi
                else
                        sum=`git hash-object "$infile1"`
@@ -113,10 +114,10 @@ reduce_ogg_ogg()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       tags=`vorbiscomment -R -l "$i"`
+       tags=`vorbiscomment -R -l "$i" || true`
        oggdec -o "$tmpdir/x.wav" "$i" && \
        oggenc -q"$1" -o "$o" "$tmpdir/x.wav"
-       echo "$tags" | vorbiscomment -R -w "$o"
+       echo "$tags" | vorbiscomment -R -w "$o" || true
 }
 
 reduce_wav_ogg()