degoogle: Add dynamic renaming for videos

This commit is contained in:
Harzo 2023-05-28 16:18:44 +02:00
parent 0bfbcbe82b
commit 938f8f76fd
1 changed files with 13 additions and 3 deletions

View File

@ -12,10 +12,10 @@ for filename in $argv
while test $attempt -le 200 while test $attempt -le 200
if test -f $targetname if test -f $targetname
set attempt (math $attempt + 1) set attempt (math $attempt + 1)
set targetname "$dirname/$rootname-$attempt.png" set targetname "$dirname/$rootname ($attempt).png"
continue continue
end end
convert "$filename" "$targetname" convert $filename $targetname
break break
end end
case '*.webm' case '*.webm'
@ -24,7 +24,17 @@ for filename in $argv
set -l rootname (echo $basename | string split -f 1 -m 1 -r .) set -l rootname (echo $basename | string split -f 1 -m 1 -r .)
set -l targetname "$dirname/$rootname.mp4" set -l targetname "$dirname/$rootname.mp4"
ffmpeg -i $filename -c:v libx264 -crf 24 $targetname set attempt 0
while test $attempt -le 200
if test -f $targetname
set attempt (math $attempt + 1)
set targetname "$dirname/$rootname ($attempt).png"
continue
end
ffmpeg -i $filename -c:v libx264 -crf 24 $targetname
break
end
case '*' case '*'
echo "Neither webp nor webm, skipping." echo "Neither webp nor webm, skipping."
end end