From 5c4632ba6700e1aaa4ed34887875b98341d446b8 Mon Sep 17 00:00:00 2001 From: ayakael Date: Fri, 28 Dec 2018 12:38:49 -0500 Subject: [PATCH] [print_meta_mtag] Fixed bug where IMAGEID would be outputted twice, and would merge with one of the tags to create a syntax error --- src/print_meta_mtag | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/print_meta_mtag b/src/print_meta_mtag index 3483514..2f009c2 100644 --- a/src/print_meta_mtag +++ b/src/print_meta_mtag @@ -22,20 +22,18 @@ print_meta_mtag() { # If list of Tags isn't giving, assumes that we want to output all tags, and thus this # generates all tags present in MTAG file - [[ -z "${tagList[@]}" ]] && local tagList=($(awk 'BEGIN{RS="[,]?\n";FS=" : "}{if($1!~"@"){print $1}}' ${FILE} | tr -d '[]{}" ' | awk '!seen[$0]++' | tail -n +3) IMAGEID) + [[ -z "${tagList[@]}" ]] && local tagList=($(awk 'BEGIN{RS="[,]?\n";FS=" : "}{if($1!~"@"){print $1}}' ${FILE} | tr -d '[]{}" ' | awk '!seen[$0]++' | tail -n +3)) # Goes through every tag, determines it's original value, and then prints out. for tag in ${tagList[@]}; do - # Finalizes output with IMAGEID - [[ "${tag}" == "IMAGEID" ]] && { echo -n "IMAGEID=$(sed 's|.tags||g' <<< $(basename "${FILE}"))"; continue; } - # Skips rint_mtag_field for field TITLE to keep it unique. Thus, if a track # does not have a defined TITLE, it won't inherit it from previous tracks [[ "${tag}" == "TITLE" ]] && { [[ -z "$(awk -v track=${TRACK_NO} 'BEGIN {RS="\n * }"}{if(NR==track){print $0}}' ${FILE} | awk -v field="\"TITLE\"" 'BEGIN{RS="[,]?\n";FS=" : "}{if($1~field){print $2}}')" ]] && continue; } # Prints out VALUE of that TAG for that TRACK NO - echo -n "${tag}=$(print_mtag_field ${FILE} ${TRACK_NO} ${tag});" + echo -n "${tag}=$(print_mtag_field ${FILE} ${TRACK_NO} ${tag})" + [[ "${tag}" != "${tagList[-1]}" ]] && echo -n ";" done }