diff --git a/anime_scripts/subtitle-converter.sh b/anime_scripts/subtitle-converter.sh index 713b910..9286e60 100755 --- a/anime_scripts/subtitle-converter.sh +++ b/anime_scripts/subtitle-converter.sh @@ -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