]> git.plutz.net Git - serve0/blobdiff - thumbnail.sh
avoid thumb and meta generation of incomplete files
[serve0] / thumbnail.sh
index 143077640c049f1c35dbfbc0584607855cf6986a..f6d212ca8bedb5845d2841ed2151aa31206ff61f 100644 (file)
@@ -6,7 +6,7 @@ include_thumbnails="$0"
 gen_thumb(){
   file="$1"; thumb="$2";
 
-  if [ ! -e "$thumb" ] && [ -f "$file" ]; then
+  if [ "${file%.part}" = "${file}" ] && [ ! -s "$thumb" ] && [ -s "$file" ]; then
     l="$(
       printf '' \
       | mplayer -input nodefault-bindings -nosound -vo null -identify -frames 0 "$file" 2>&- \
@@ -35,8 +35,5 @@ gen_thumb(){
   
     mv "${tmp}/00000001.jpg" "$thumb"
     rm -r "${tmp}"
-  
-  elif [ ! -e "$thumb" ]; then
-    touch "$thumb"
   fi
 }