[deploy_gen] Now return 0 instead of 1 when split reattempt is succesful

[deploy_meta] Now uses sed to convert FUTURE_META's semi colon in new line
[deploy_mv] Fixed bug where certain syntax in mtag would throw off the trackidList generation
[deploy_meta_field] [ and ] characters, which are used for empty fields, are now replaced my space
[deploy_meta_mtag] Fixed bug with tagList generation
This commit is contained in:
ayakael 2018-04-07 18:33:41 -04:00
parent 383139e943
commit 271b515080
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026
5 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@ deploy_gen() {
# Attempts first split. If fails because of lack of CD quality file, retries with modified breakpointList
if ! printf '%s\n' ${breakpointList[@]} | shntool split "${GITDIR}/${IMAGEID}.flac" -o flac -O always -d "${GITDIR}"; then
printf '%s\n' ${breakpointList[@]} | sed s/$/0/ | shntool split "${GITDIR}/${IMAGEID}.flac" -o flac -O always -d "${GITDIR}"
[[ $? -ne 0 ]] && return 2 || return 1
[[ $? -ne 0 ]] && return 1 || return 0
fi
}

View file

@ -32,7 +32,7 @@ deploy_meta() {
if [[ "${PRESENT_META}" != "${FUTURE_META}" ]]; then
_msg ECHO "${trackid} has differing metadata. Updating"
[[ "${PRESENT_PATH}" == "null" ]] || metaflac --remove-all "${TARGET}/${PRESENT_PATH}"
awk 'BEGIN {RS=";"}{print $0}' <<< ${FUTURE_META} | head -n -1 | metaflac --import-tags-from=- --import-picture-from="${GIT_DIR}/${IMAGEID}.jpg" "${TARGET}/${PRESENT_PATH}"
sed s'/;/\n/' <<< ${FUTURE_META} | metaflac --import-tags-from=- --import-picture-from="${GIT_DIR}/${IMAGEID}.jpg" "${TARGET}/${PRESENT_PATH}"
[[ $? -eq 0 ]] || local ERR=true
fi

View file

@ -14,7 +14,7 @@ deploy_mv() {
local IMAGEID="${2}"
# Generated trackidList to know what id to assign to each file
local trackidList=$(awk 'BEGIN{RS="\",*\n * \"";FS="\" : \""}{if($1=="TRACKID"){print $2}}' "${GITDIR}/${IMAGEID}.tags")
local trackidList=$(awk -v field="\"TRACKID\"" 'BEGIN{RS="[,]?\n";FS=" : "}{if($1~field){print $2}}' "${GITDIR}/${IMAGEID}.tags" | tr -d '"')
# Then renames the ouput files to TRACKID
local COUNT=1

View file

@ -21,5 +21,5 @@ print_meta_field() {
# the last line (Thus the only relevant value). This permits us to use the MTAG's specs where tracks inherit
# the values of its previous tracks when not set. Thus, one needs only to define the ALBUM once on the first
# track for all other TRACKs to inherit it.
awk -v track=${TRACK_NO} 'BEGIN {RS="\n * }"}{if(NR<=track){print $0}}' ${FILE} | awk -v field="\"${FIELD}\"" 'BEGIN{RS="[,]?\n";FS=" : "}{if($1~field){print $2}}' | tail -n 1 | sed -e 's/^"//' -e 's/"$//'
awk -v track=${TRACK_NO} 'BEGIN {RS="\n * }"}{if(NR<=track){print $0}}' ${FILE} | awk -v field="\"${FIELD}\"" 'BEGIN{RS="[,]?\n";FS=" : "}{if($1~field){print $2}}' | tail -n 1 | sed -e 's/^"//' -e 's/"$//' -e 's/\[//' -e 's/\]/ /'
}

View file

@ -18,8 +18,8 @@ print_meta_mtag() {
local TRACK_NO="${2}"; shift 2
local tagList=(${@})
[[ -z "${tagList[@]}" ]] && local tagList=($(awk 'BEGIN{RS="\",*\n * \"";FS="\" : \""}{if($1!~"@"){print $1}}' ${FILE} | awk '!seen[$0]++') IMAGEID)
[[ -z "${tagList[@]}" ]] && local tagList=($(awk 'BEGIN{RS="[,]?\n";FS=" : "}{if($1!~"@"){print $1}}' ${FILE} | tr -d '[]{}" ' | awk '!seen[$0]++' | tail -n +3) IMAGEID)
for tag in ${tagList[@]}; do
# Finalizes output with IMAGEID
[[ "${tag}" == "IMAGEID" ]] && { echo -n "IMAGEID=$(sed 's|.tags||g' <<< $(basename "${FILE}"))"; continue; }