From f646e81c11dd8f90340550ae97403d73129bf05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sat, 9 Jul 2022 21:18:29 +0200 Subject: [PATCH] update sub_extract_convert --- sub_extract_convert | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sub_extract_convert b/sub_extract_convert index 97b8921..42d0b73 100755 --- a/sub_extract_convert +++ b/sub_extract_convert @@ -1,7 +1,7 @@ #!/usr/bin/env bash # usage: $scriptname $files $output_sub_format output_sub_format=${@: -1} -for i in $@ +for i in "$@" do if [ ! -e "$i" ]; then @@ -9,16 +9,16 @@ do continue fi index=$(ffprobe -v 8 -show_streams -select_streams s "$i" | grep index | cut --delimiter="=" -f 2) - if [ -z $index ]; + if [ -z "$index" ]; then echo "No subtitle streams found." exit fi ffprobe -v 8 -show_streams -select_streams "$i" filename=${i%.*} - mkvextract "$i" tracks $index:"${filename}.en.ass" - if [ ! -z $1 ]; + mkvextract "$i" tracks "$index":"${filename}.en.ass" + if [ -n "$1" ]; then - subtitleedit /convert "${filename}.en.ass" $output_sub_format 2>/dev/null | grep --color=none ass + subtitleedit /convert "${filename}.en.ass" "$output_sub_format" 2>/dev/null | grep --color=none ass fi done \ No newline at end of file