[build] Any arguments in build will be added at end of EXEC
[gen_mtag] Can now generate MTAG output succesfully
This commit is contained in:
parent
65dd94cc8f
commit
762c49da89
1 changed files with 14 additions and 14 deletions
28
src/gen_mtag
28
src/gen_mtag
|
@ -12,51 +12,51 @@
|
||||||
|
|
||||||
gen_mtag() {
|
gen_mtag() {
|
||||||
local metadata_trackList=(${@})
|
local metadata_trackList=(${@})
|
||||||
|
|
||||||
# Generates list of tags to be parsed
|
# Generates list of tags to be parsed
|
||||||
local COUNT=0
|
local COUNT=0
|
||||||
for metadata_track in ${metadata_trackList[@]}; do
|
for metadata_track in ${metadata_trackList[@]}; do
|
||||||
local tagList[${COUNT}]=$(awk 'BEGIN{RS=";";FS="="}{print $1";"}' <<< ${metadata_track})
|
local tagList[${COUNT}]=$(awk 'BEGIN{RS=";";FS="=";ORS=";";}{print $1}' <<< ${metadata_track})
|
||||||
local COUNT=$(( ${COUNT} + 1 ))
|
local COUNT=$(( ${COUNT} + 1 ))
|
||||||
done
|
done
|
||||||
local tagList=($(tr ';' \\n <<< ${tagList[@]} | awk '!seen[$0]++'))
|
local tagList=($( sed -e 's| ; ||g' -e 's|; ;||' <<< ${tagList[@]} | tr ';' \\n | awk '!seen[$0]++' ))
|
||||||
|
|
||||||
|
|
||||||
# Header echo
|
# Header echo
|
||||||
echo "["
|
echo "["
|
||||||
|
|
||||||
# Track echo
|
# Track echo
|
||||||
local COUNT=0
|
local COUNT=0
|
||||||
for metadata_trackList in ${metadata_trackList[@]}; do
|
for metadata_track in ${metadata_trackList[@]}; do
|
||||||
|
|
||||||
# Track header and file name
|
# Track header and file name
|
||||||
local FILE_NAME=$(awk -v tag="IMAGEID" 'BEGIN{RS=";";FS="=";}{if($1=tag){print $2}}' <<< ${metadata_track})
|
local FILE_NAME=$(awk -v tag="IMAGEID" 'BEGIN{RS=";";FS="=";}{if($1==tag){print $2}}' <<< ${metadata_track})
|
||||||
echo -e " {\n \"@\" : \"${FILE_NAME}.cue|$(( ${COUNT} + 1 ))\","
|
echo -en " {\n \"@\" : \"${FILE_NAME}.cue|$(( ${COUNT} + 1 ))\""
|
||||||
|
|
||||||
# Tag loop
|
# Tag loop
|
||||||
for tag in ${tagList[@]}; do
|
for tag in ${tagList[@]}; do
|
||||||
|
|
||||||
# Determines current tag value
|
# Determines current tag value
|
||||||
local CUR_TAG=$(awk -v tag="${tag}" 'BEGIN{RS=";";FS="=";}{if($1=tag){print $2}}' <<< ${metadata_track})
|
local CUR_TAG=$(awk -v tag="${tag}" 'BEGIN{RS=";";FS="=";}{if($1==tag){print $2}}' <<< ${metadata_track})
|
||||||
|
|
||||||
# Determines previous tag value
|
# Determines previous tag value
|
||||||
local PREV_TAG=$(awk -v tag="${tag}" 'BEGIN{RS=";";FS="=";}{if($1=tag){print $2}}' <<< ${metadata_trackList[$(( ${COUNT} - 1 ))]})
|
local PREV_TAG=$(awk -v tag="${tag}" 'BEGIN{RS=";";FS="=";}{if($1==tag){print $2}}' <<< ${metadata_trackList[$(( ${COUNT} - 1 ))]})
|
||||||
|
|
||||||
# Compares previous tag value and current tag value. If there is a difference or we're dealing with the first track,
|
# Compares previous tag value and current tag value. If there is a difference or we're dealing with the first track,
|
||||||
# print the value in MTAG format
|
# print the value in MTAG format
|
||||||
if [[ "${CUR_TAG}" != "${PREV_TAG}" ]] || [[ ${COUNT} -eq 0 ]]; then
|
if [[ "${CUR_TAG}" != "${PREV_TAG}" ]] || [[ ${COUNT} -eq 0 ]]; then
|
||||||
|
echo ","
|
||||||
echo -n " \"${tag}\" : \"${CUR_TAG}\""
|
echo -n " \"${tag}\" : \"${CUR_TAG}\""
|
||||||
[[ "${tag}" != "${tagList[-1]}" ]] && echo ";" || echo
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# Track footer
|
# Track footer
|
||||||
echo " }"
|
echo -en "\n }"
|
||||||
|
[[ "$(( ${COUNT} + 1 ))" != "${#metadata_trackList[@]}" ]] && echo "," || echo
|
||||||
|
|
||||||
local COUNT=$(( ${COUNT} + 1 ))
|
local COUNT=$(( ${COUNT} + 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Footer echo
|
# Footer echo
|
||||||
echo -e " }\n]"
|
echo "]"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue