Update subtitle-converter.sh

This commit is contained in:
marios 2020-04-03 14:33:37 +03:00 committed by GitHub
parent 714d3c8cca
commit e5acec3513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ function convert() {
res=$(ffprobe -v error -show_entries stream=codec_type,codec_name -of compact "$1" | grep -s "subtitle");
if [[ "$res" == *"ass"* ]]; then
echo "Converting $1";
ext="${1##*.}";
ffmpeg -n -i "$1" -c:s srt "${i%.$ext}.srt" > /dev/null 2&> /dev/null;
else
echo "$1 not ASS. Skipping";
@ -14,12 +15,10 @@ if [[ -d "$1" ]]; then
cd "$1";
shopt -s globstar
for i in **/*; do
ext="${i##*.}";
convert "$i";
done
elif [[ -f "$1" ]]; then
cd $(dirname "$1");
name=$(basename "$1");
ext="${name##*.}";
convert "$name";
fi