diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-06-11 19:00:52 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-06-11 19:00:52 +0200 |
commit | f8eec08d6fa7cd1bb40a72e8c0c79ff986f6b52e (patch) | |
tree | dbb6450cff019ee9057a4a2d0d5ebea461f478b1 /odin/strm/download_youtube | |
parent | 7227b04c8fd6c1de3a824154e790fcc644eaba70 (diff) | |
download | nixos-f8eec08d6fa7cd1bb40a72e8c0c79ff986f6b52e.tar nixos-f8eec08d6fa7cd1bb40a72e8c0c79ff986f6b52e.tar.gz nixos-f8eec08d6fa7cd1bb40a72e8c0c79ff986f6b52e.tar.bz2 nixos-f8eec08d6fa7cd1bb40a72e8c0c79ff986f6b52e.tar.xz nixos-f8eec08d6fa7cd1bb40a72e8c0c79ff986f6b52e.zip |
determine success by output
Diffstat (limited to 'odin/strm/download_youtube')
-rw-r--r-- | odin/strm/download_youtube | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/odin/strm/download_youtube b/odin/strm/download_youtube index d6e41865..4d351cd5 100644 --- a/odin/strm/download_youtube +++ b/odin/strm/download_youtube | |||
@@ -293,31 +293,36 @@ printf ">>> %s <<<\n %s\n" "${msgId}" "${message}" | |||
293 | 293 | ||
294 | [[ "${bare_amp}" -ne 0 ]] && p2args+=(-af "${amp}") | 294 | [[ "${bare_amp}" -ne 0 ]] && p2args+=(-af "${amp}") |
295 | 295 | ||
296 | local success=false | 296 | transcodeStdout=$(mktemp --tmpdir "transcode.stdout.${0:t}.$$.XXXXXX") |
297 | 297 | cleanup rm -rfv -- ${transcodeStdout} | |
298 | if [[ $#prePass -gt 0 ]]; then | 298 | transcodeStderr=$(mktemp --tmpdir "transcode.stderr.${0:t}.$$.XXXXXX") |
299 | args+=(-v info -i ${tempfile}) | 299 | cleanup rm -rfv -- ${transcodeStderr} |
300 | 300 | ||
301 | oldPwd=${PWD} | 301 | ( |
302 | cd $(mktemp -d --tmpdir "transcode.${0:t}.$$.XXXXXX") | 302 | if [[ $#prePass -gt 0 ]]; then |
303 | cleanup rm -rfv -- ${PWD} | 303 | args+=(-v info -i ${tempfile}) |
304 | 304 | ||
305 | p1args+=(-an -f matroska) | 305 | oldPwd=${PWD} |
306 | print -- ${prePass} ${p1args} | 306 | cd $(mktemp -d --tmpdir "transcode.${0:t}.$$.XXXXXX") |
307 | ffmpeg ${args} ${prePass} ${p1args} -- /dev/null | 307 | cleanup rm -rfv -- ${PWD} |
308 | 308 | ||
309 | print -- ${cargs} ${p2args} | 309 | p1args+=(-an -f matroska) |
310 | ffmpeg ${args} ${cargs} ${p2args} -- "${filename}" && success=true | 310 | print -- ${prePass} ${p1args} |
311 | 311 | ffmpeg ${args} ${prePass} ${p1args} -- /dev/null | |
312 | cd ${oldPwd} | 312 | |
313 | else | 313 | print -- ${cargs} ${p2args} |
314 | args+=(-v warning -i pipe:0) | 314 | ffmpeg ${args} ${cargs} ${p2args} -- "${filename}" |
315 | 315 | ||
316 | print -- ${cargs} ${p2args} | 316 | cd ${oldPwd} |
317 | pv -N "$(trimName "trans:" ${title})" ${tempfile} | ffmpeg ${args} ${cargs} ${p2args} -- "${filename}" && success=true | 317 | else |
318 | fi | 318 | args+=(-v warning -i pipe:0) |
319 | |||
320 | print -- ${cargs} ${p2args} | ||
321 | pv -N "$(trimName "trans:" ${title})" ${tempfile} | ffmpeg ${args} ${cargs} ${p2args} -- "${filename}" | ||
322 | fi | ||
323 | ) >&1 >${transcodeStdout} 2>&2 2>${transcodeStderr} | ||
319 | 324 | ||
320 | if ${success}; then | 325 | if grep -qv "Invalid encoder type" ${transcodeStdout} ${transcodeStderr}; then |
321 | printf "Successfully transcoded using transMode=%s\n" ${transMode} | 326 | printf "Successfully transcoded using transMode=%s\n" ${transMode} |
322 | break | 327 | break |
323 | fi | 328 | fi |