mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-12-04 20:33:33 +02:00
Fix cache helper script
This commit is contained in:
parent
cb3b65de06
commit
5910987781
1 changed files with 5 additions and 3 deletions
|
@ -8,20 +8,22 @@ fi
|
||||||
total_before=0
|
total_before=0
|
||||||
total_after=0
|
total_after=0
|
||||||
for i in "$1"/*/*; do
|
for i in "$1"/*/*; do
|
||||||
if [ $(ffprobe -hide_banner -print_format json -select_streams a:0 -show_streams "$i" | jq '.streams[0].codec_name') != "vorbis" ]; then
|
if [ $(ffprobe -hide_banner -print_format json -select_streams a:0 -show_streams "$i" | jq -r '.streams[0].bit_rate') -gt 128000 ]; then
|
||||||
size_before=$(stat --format=%s "$i")
|
size_before=$(stat --format=%s "$i")
|
||||||
total_before=$(( $total_before + $size_before ))
|
total_before=$(( $total_before + $size_before ))
|
||||||
ffmpeg -hide_banner -loglevel error -i "$i" -vn "$i".ogg
|
ffmpeg -hide_banner -loglevel error -i "$i" -vn "$i".ogg
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
size_after=$(stat --format=%s "$i".ogg)
|
size_after=$(stat --format=%s "$i".ogg)
|
||||||
total_after=$(( $total_after + $size_after ))
|
total_after=$(( $total_after + $size_after ))
|
||||||
echo "before: $(echo $size_before | numfmt --to=iec) | after: $(echo $size_after | numfmt --to=iec)"
|
|
||||||
|
size_reduced=$(( $size_before - $size_after ))
|
||||||
|
echo "Reduced: $(echo $size_reduced | numfmt --to=iec)"
|
||||||
mv "$i".ogg "$i"
|
mv "$i".ogg "$i"
|
||||||
else
|
else
|
||||||
echo "$i convert failed"
|
echo "$i convert failed"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "$i already compressed good"
|
echo "$i already OK"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue