[gen_metatrack] Relativized to support CUE file sheets
This commit is contained in:
parent
3a4dcbcca3
commit
1bbfed1313
1 changed files with 17 additions and 11 deletions
|
@ -13,18 +13,24 @@
|
||||||
# }
|
# }
|
||||||
|
|
||||||
gen_metatrack() {
|
gen_metatrack() {
|
||||||
WRK_DIR="${1}"
|
while true; do
|
||||||
FLAC="${2}"
|
case ${1} in
|
||||||
CUE="${3}"
|
(-c) local CUE="${2}"; shift 2 ;;
|
||||||
|
(*) local fileList=(${@}); local TOTALTRACKS=${#fileList[@]}; break ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
gen_tracks "${WRK_DIR}" "${FLAC}" "${CUE}" >/dev/null 2>&1
|
|
||||||
|
|
||||||
|
if [[ -n "${CUE}" ]]; then
|
||||||
|
gen_tracks "${_OPT_TMP}" "${fileList}" "${CUE}" >/dev/null 2>&1
|
||||||
local TOTALTRACKS="$(grep -e "TRACK [0-9][0-9] AUDIO" "${CUE}" | wc -l)"
|
local TOTALTRACKS="$(grep -e "TRACK [0-9][0-9] AUDIO" "${CUE}" | wc -l)"
|
||||||
local COUNT=0
|
local COUNT=0
|
||||||
while [[ ${COUNT} -lt ${TOTALTRACKS} ]]; do
|
while [[ ${COUNT} -lt ${TOTALTRACKS} ]]; do
|
||||||
local fileList[${COUNT}]=$(printf "${WRK_DIR}/split-track%02d.flac\t" $(( ${COUNT} + 1 )))
|
local fileList[${COUNT}]=$(printf "${_OPT_TMP}/split-track%02d.flac\t" $(( ${COUNT} + 1 )))
|
||||||
local COUNT=$(( ${COUNT} + 1 ))
|
local COUNT=$(( ${COUNT} + 1 ))
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
local replaygainList=($(metaflac --scan-replay-gain ${fileList[@]} | awk 'BEGIN{ORS=" ";FS=":"}{print $2}' | tr ' ' '\t'))
|
local replaygainList=($(metaflac --scan-replay-gain ${fileList[@]} | awk 'BEGIN{ORS=" ";FS=":"}{print $2}' | tr ' ' '\t'))
|
||||||
local REPLAYGAIN_ALBUM_GAIN=${replaygainList[0]}
|
local REPLAYGAIN_ALBUM_GAIN=${replaygainList[0]}
|
||||||
local REPLAYGAIN_ALBUM_PEAK=${replaygainList[1]}
|
local REPLAYGAIN_ALBUM_PEAK=${replaygainList[1]}
|
||||||
|
|
Loading…
Reference in a new issue