print_future_meta can now selectively extract tags, if told to
This commit is contained in:
parent
1ded1a99e0
commit
06a0491448
1 changed files with 7 additions and 5 deletions
|
@ -5,22 +5,24 @@
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
# print_future_meta - Prints metadata of specified TRACKNUMBER, from textfile following
|
# print_future_meta - Prints metadata of specified TRACKNUMBER, from textfile following
|
||||||
# the MTAG specification. Outputs as standard FIELD=VALUE that can then be pipped into
|
# the MTAG specification. Outputs as standard FIELD=VALUE that can then be pipped into
|
||||||
# metaflac.
|
# metaflac. Can also be supplied with what tags to extract
|
||||||
#
|
#
|
||||||
# USAGE
|
# USAGE
|
||||||
# print_future_meta </path/to/mtag/file> <track no>
|
# print_future_meta </path/to/mtag/file> <track no> [<field>]
|
||||||
#
|
#
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
|
||||||
print_future_meta() {
|
print_future_meta() {
|
||||||
local MTAG=${1}
|
local MTAG=${1}
|
||||||
local TRACKNUMBER="${2}"
|
local TRACKNUMBER="${2}"; shift 2
|
||||||
local tagList=($(awk 'BEGIN{RS="\",*\n * \"";FS="\" : \""}{if($1!~"@"){print $1}}' ${MTAG} | awk '!seen[$0]++'))
|
local tagList=(${@})
|
||||||
|
|
||||||
|
[[ -z "${tagList[@]}" ]] && local tagList=($(awk 'BEGIN{RS="\",*\n * \"";FS="\" : \""}{if($1!~"@"){print $1}}' ${MTAG} | awk '!seen[$0]++') IMAGEID)
|
||||||
|
|
||||||
for tag in ${tagList[@]}; do
|
for tag in ${tagList[@]}; do
|
||||||
|
[[ "${tag}" == "IMAGEID" ]] && { echo -n "IMAGEID=$(sed 's|.tags||g' <<< $(basename "${MTAG}"));"; continue; }
|
||||||
echo -n "${tag}=$(print_meta_field ${MTAG} ${TRACKNUMBER} ${tag});"
|
echo -n "${tag}=$(print_meta_field ${MTAG} ${TRACKNUMBER} ${tag});"
|
||||||
done
|
done
|
||||||
echo -n "IMAGEID=$(sed 's|.tags||g' <<< $(basename "${MTAG}"))"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue