diff --git a/src/deploy_gen b/src/deploy_gen index 2b120ec..e031509 100644 --- a/src/deploy_gen +++ b/src/deploy_gen @@ -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 } diff --git a/src/deploy_meta b/src/deploy_meta index 9182bd1..e74fe47 100644 --- a/src/deploy_meta +++ b/src/deploy_meta @@ -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 diff --git a/src/deploy_mv b/src/deploy_mv index 2c1e5d6..676458a 100644 --- a/src/deploy_mv +++ b/src/deploy_mv @@ -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 diff --git a/src/print_meta_field b/src/print_meta_field index 1f2b709..dae7296 100644 --- a/src/print_meta_field +++ b/src/print_meta_field @@ -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/\]/ /' } diff --git a/src/print_meta_mtag b/src/print_meta_mtag index 18e45af..4263b0e 100644 --- a/src/print_meta_mtag +++ b/src/print_meta_mtag @@ -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; }