From 3dccd2056ebee4be0ef62054abb6a6260f9e5d0f Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Sun, 27 Jan 2013 21:48:05 +0100 Subject: [PATCH] Shell: audio tc fixes. --- .shell.d/funs_transcode | 17 +++++++++-------- .shell.d/titlecase.awk | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.shell.d/funs_transcode b/.shell.d/funs_transcode index 0e1e1506..d7912c06 100644 --- a/.shell.d/funs_transcode +++ b/.shell.d/funs_transcode @@ -226,7 +226,7 @@ EOF ## These ones are not cli-options either, but this could be easily changed. local OUTPUT local OUTPUT_FILE - OUTPUT='$TC_AUDIO_DEST/$OUTPUT_ARTIST/${OUTPUT_ALBUM:+${OUTPUT_YEAR:+$OUTPUT_YEAR - }$OUTPUT_ALBUM/}' + OUTPUT='$TC_AUDIO_DEST/$OUTPUT_ARTIST/${OUTPUT_ALBUM:+${OUTPUT_DATE:+$OUTPUT_DATE - }$OUTPUT_ALBUM/}' OUTPUT_FILE='$OUTPUT$OUTPUT_ARTIST - ${OUTPUT_PADDEDTRACK:+$OUTPUT_PADDEDTRACK - }$OUTPUT_TITLE' while getopts ":a:b:d:g:l:n:t:hps" opt; do @@ -374,13 +374,10 @@ EOF OUTPUT_DATE="$TYER_REG" fi - ## Only reencode if not in OGG and if SKIP not set. - [ $SKIP -ne 0 ] && OGG_PARAM="" && OUTPUT_FORMAT="$FORMAT" - [ "$FORMAT" = "ogg" ] && OGG_PARAM="" - ## QUALITY - ## TODO: test if table is useful at all. + ## If bitrate argumument is not provided, we use BITRATE value. [ $OUTPUT_BITRATE -eq 0 ] && OUTPUT_BITRATE=${BITRATE} + ## TODO: test if table is useful at all. # if [ $OUTPUT_BITRATE -eq 0 ]; then # [ $BITRATE -le 45 ] && OUTPUT_BITRATE=45k # [ $BITRATE -gt 45 ] && OUTPUT_BITRATE=64k @@ -396,6 +393,11 @@ EOF # [ $BITRATE -gt 320 ] && OUTPUT_BITRATE=500k # fi + ## Only reencode if not in OGG and if SKIP not set. + OGG_PARAM="-c:a libvorbis -b:a ${OUTPUT_BITRATE}k" + [ $SKIP -ne 0 ] && OGG_PARAM="" && OUTPUT_FORMAT="$FORMAT" + [ "$FORMAT" = "ogg" ] && OGG_PARAM="" + ## Make sure track number has two digits for file name only. local OUTPUT_PADDEDTRACK OUTPUT_PADDEDTRACK=$OUTPUT_TRACK @@ -489,13 +491,12 @@ EOF unset OLDIFS ## Zsh compatibility. We need it otherwise word splitting of parameter like - ## TC_SAMPLE will not work. + ## OGG_PARAM will not work. local STATUS STATUS="$(set -o | grep 'shwordsplit' | awk '{print $2}')" [ "$STATUS" = "off" ] && set -o shwordsplit ## TAG/RECODE - # ffmpeg -i "$1" -c:a libvorbis -b:a ${OUTPUT_BITRATE}k \ ffmpeg -i "$1" $OGG_PARAM \ -metadata title="$OUTPUT_TITLE" \ -metadata artist="$OUTPUT_ARTIST" \ diff --git a/.shell.d/titlecase.awk b/.shell.d/titlecase.awk index 190abafa..c242add6 100644 --- a/.shell.d/titlecase.awk +++ b/.shell.d/titlecase.awk @@ -53,7 +53,7 @@ BEGIN { #-----ABBREVIATIONS TO BE SET IN SOLID CAPS----- # Other abbreviations - add to this list as needed other = "AIDS ASCII CD DHTML DNA DVD FBI GNU GPL IBM IRS ISBN ISSN " - other = other "PHP ROM SSN TV FM BYOB MGMT DJ AC-DC JBX KLASSX " + other = other "PHP ROM SSN TV FM BYOB MGMT DJ AC-DC JBX RZA DMX " # build array of words to keep uppercase split(other, keep_upper, " ")