]> git.plutz.net Git - serve0/commitdiff
avoid thumb and meta generation of incomplete files
authorPaul Hänsch <paul@plutz.net>
Tue, 22 Sep 2020 22:45:32 +0000 (00:45 +0200)
committerPaul Hänsch <paul@plutz.net>
Tue, 22 Sep 2020 22:45:32 +0000 (00:45 +0200)
indexmeta.sh
thumbnail.sh

index 2da085f9a0bf86fcdb630f8fd98443df7d99c423..e478324647de9c44239016b37e884095012caeca 100644 (file)
@@ -15,6 +15,7 @@ meta_name() {
 meta_line() {
   local video l w h
   video="$1"
+  [ "${video%.part}" = "$video" -a -s "$video" ] || return 0
 
   read l h w <<__EOF
   $(printf '' \
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
 }