HEADERS: print headers only when requested

master
Karchnu 2021-04-30 01:21:23 +02:00
parent f58bfdde9c
commit e8362b55da
2 changed files with 17 additions and 9 deletions

View File

@ -31,6 +31,7 @@ The `time-file` must have this format:
* **NONUMBER**: if equals to 1, do not write song number * **NONUMBER**: if equals to 1, do not write song number
* **SEPARATOR**: (default: ' - '), write song number, with this separator * **SEPARATOR**: (default: ' - '), write song number, with this separator
example with SEPARATOR='_': song names will be 01_song.opus 02_song.opus… example with SEPARATOR='_': song names will be 01_song.opus 02_song.opus…
* **HEADERS**: if equals to 1, print environment parameters (verbosity, simulation, etc.)
* **VERBOSITY** [0-3] (default: 1)\ * **VERBOSITY** [0-3] (default: 1)\
verbosity 0: no output except errors from ffmpeg\ verbosity 0: no output except errors from ffmpeg\
verbosity 1: simple indications on the current track being extracted\ verbosity 1: simple indications on the current track being extracted\

View File

@ -173,6 +173,7 @@ usage(){
echo "envvar: FORMAT [mp3,ogg,opus,…], see the ffmpeg documentation" echo "envvar: FORMAT [mp3,ogg,opus,…], see the ffmpeg documentation"
echo "envvar: SEPARATOR [separator] (default: ' - '), write song number, with this separator" echo "envvar: SEPARATOR [separator] (default: ' - '), write song number, with this separator"
echo " example with SEPARATOR='_': song names will be 01_song.opus 02_song.opus…" echo " example with SEPARATOR='_': song names will be 01_song.opus 02_song.opus…"
echo "envvar: HEADERS, if equals to 1, print environment parameters (verbosity, simulation, etc.)"
echo "envvar: VERBOSITY [0-3] (default: 1)" echo "envvar: VERBOSITY [0-3] (default: 1)"
echo " verbosity 0: no output except errors from ffmpeg" echo " verbosity 0: no output except errors from ffmpeg"
echo " verbosity 1: simple indications on the current track being extracted" echo " verbosity 1: simple indications on the current track being extracted"
@ -187,38 +188,44 @@ fi
command=$1 command=$1
shift shift
header(){
if [ "$HEADERS" = "1" ]; then
echo $*
fi
}
if [ "$FORMAT" = "" ]; then if [ "$FORMAT" = "" ]; then
echo "default FORMAT: opus" header "default FORMAT: opus"
FORMAT="opus" FORMAT="opus"
else else
echo "FORMAT: $FORMAT" header "FORMAT: $FORMAT"
fi fi
if [ "$VERBOSITY" = "" ]; then if [ "$VERBOSITY" = "" ]; then
echo "default VERBOSITY: 1" header "default VERBOSITY: 1"
VERBOSITY=1 VERBOSITY=1
else else
echo "VERBOSITY level: $VERBOSITY" header "VERBOSITY level: $VERBOSITY"
fi fi
if [ "$NONUMBER" = "" ]; then if [ "$NONUMBER" = "" ]; then
echo "default NONUMBER: disabled" header "default NONUMBER: disabled"
NONUMBER=0 NONUMBER=0
# Assume that there should be a separator. # Assume that there should be a separator.
if [ "$SEPARATOR" = "" ]; then if [ "$SEPARATOR" = "" ]; then
echo "default SEPARATOR: ' - '" header "default SEPARATOR: ' - '"
SEPARATOR=" - " SEPARATOR=" - "
else else
echo "SEPARATOR: '$SEPARATOR'" header "SEPARATOR: '$SEPARATOR'"
fi fi
else else
echo "NONUMBER: won't prefix tracks" header "NONUMBER: won't prefix tracks"
SEPARATOR="" SEPARATOR=""
fi fi
if [ "$SIMULATION" != "" ]; then if [ "$SIMULATION" != "" ]; then
echo "SIMULATION envvar is set: this is a simulation." header "SIMULATION envvar is set: this is a simulation."
fi fi
</dev/null xxd -p >/dev/null 2>/dev/null </dev/null xxd -p >/dev/null 2>/dev/null