diff --git a/ts-to-mkv.sh b/ts-to-mkv.sh index b597bc7..d7d39ae 100644 --- a/ts-to-mkv.sh +++ b/ts-to-mkv.sh @@ -42,17 +42,11 @@ ffmpegcheck(){ ## Env ## SAVEIFS=$IFS IFS=$(echo -en "\n\b") -loglevel="-loglevel level+info" +loglevel="level+info" FFMPEG="/data/sourcecode/ffmpeg/ffmpeg-4.1.3-amd64-static/ffmpeg" if [[ ! -f "$FFMPEG" ]]; then FFMPEG=$(/usr/bin/env which ffmpeg) fi - -ffmpegcheck -if [[ "$?" == "2" ]]; then - echo "[error] ffmpeg version too low, need to use version 4.0.0 or newer." - exit 1 -fi WORKPATH="./" keepsource="0" version="2" @@ -60,7 +54,7 @@ version="2" ## Start ## echo "[info] $0 -- v$version" -while getopts d:p:fnXhkq OPT; do +while getopts d:p:fnhkq OPT; do case "$OPT" in d) if [[ -e "$OPTARG" ]]; then @@ -79,7 +73,6 @@ while getopts d:p:fnXhkq OPT; do echo "[help] -k, keep the original ts file" echo "[help] -q, disable output from ffmpeg (default: info)" echo "[help] -p, custom path to scan recursively (default: $WORKPATH)" - echo "[help] -X, dry run" exit 0 ;; k) echo "[debug] keeping the original file" @@ -95,14 +88,17 @@ while getopts d:p:fnXhkq OPT; do echo "[debug] no custom pathing; using $WORKPATH" fi ;; q) - loglevel="-loglevel quiet" + loglevel="quiet" echo "[debug] disabling ffmpeg output" ;; - X) - dryrun="1" - echo "[debug] dry run enabled";; esac done +ffmpegcheck +if [[ "$?" == "2" ]]; then + echo "[error] ffmpeg version too low, need to use version 4.0.0 or newer." + exit 1 +fi + shift $((OPTIND-1)) echo "[info] finding files" filelist="$(find "$WORKPATH" -name "*.ts")" @@ -112,12 +108,7 @@ if [[ "$filelist" ]]; then echo "[info] working on $i" INFILE="$i" echo "[debug] Infile: $INFILE" - if [[ "$dryrun" == "1" ]]; then - OUTFILE="/dev/null" - echo "[debug] overriding OUTFILE to $OUTFILE" - else - OUTFILE="${i//.ts/.mkv}" - fi + OUTFILE="${i//.ts/.mkv}" echo "[debug] Outfile: $OUTFILE" sleep 2 INFILE2="${INFILE//\'/\'\\\\\\\'\'}" @@ -130,7 +121,7 @@ if [[ "$filelist" ]]; then -codec:s srt \ -metadata:s:s:0 language=eng \ $force \ - $loglevel \ + -loglevel "$loglevel" \ "${OUTFILE}" exitcode="$?"