[print_meta_field] Renamed to print_mtag_field in preparation for import functions

[print_track_no] Renamed to print_mtag_trackno in preparation for import functions
[deploy_meta] Applied function rename for print_track_no
[print_meta_mtag] Applied function rename for print_mtag_field
This commit is contained in:
ayakael 2018-04-08 14:43:54 -04:00
parent b9a328591b
commit cae230c11d
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026
4 changed files with 11 additions and 11 deletions

View file

@ -20,7 +20,7 @@ deploy_meta() {
local trackidList=($(awk -v imageid=${IMAGEID} 'BEGIN{FS="\t"}{if($1=="true" && $2==imageid){print $3}}' ${DB_FILE})) local trackidList=($(awk -v imageid=${IMAGEID} 'BEGIN{FS="\t"}{if($1=="true" && $2==imageid){print $3}}' ${DB_FILE}))
for trackid in ${trackidList[@]}; do for trackid in ${trackidList[@]}; do
local TRACKNO="$(print_track_no ${GIT_DIR} ${IMAGEID} ${trackid})" local TRACKNO="$(print_mtag_trackno ${GIT_DIR} ${IMAGEID} ${trackid})"
_msg ECHO "Checking ${trackid}" _msg ECHO "Checking ${trackid}"
## Path and metadata parsing ## Path and metadata parsing
local FUTURE_META="$(print_meta_mtag ${GIT_DIR}/${IMAGEID}.tags ${TRACKNO} | tr '\\' -d)" local FUTURE_META="$(print_meta_mtag ${GIT_DIR}/${IMAGEID}.tags ${TRACKNO} | tr '\\' -d)"

View file

@ -24,12 +24,12 @@ print_meta_mtag() {
# Finalizes output with IMAGEID # Finalizes output with IMAGEID
[[ "${tag}" == "IMAGEID" ]] && { echo -n "IMAGEID=$(sed 's|.tags||g' <<< $(basename "${FILE}"))"; continue; } [[ "${tag}" == "IMAGEID" ]] && { echo -n "IMAGEID=$(sed 's|.tags||g' <<< $(basename "${FILE}"))"; continue; }
# Skips print_meta_field for field TITLE to keep it unique. Thus, if a track # 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 # 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; } [[ "${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 # Prints out VALUE of that TAG for that TRACK NO
echo -n "${tag}=$(print_meta_field ${FILE} ${TRACK_NO} ${tag});" echo -n "${tag}=$(print_mtag_field ${FILE} ${TRACK_NO} ${tag});"
done done
} }

View file

@ -1,17 +1,17 @@
#!/bin/bash #!/bin/bash
# doc print_meta_field { # doc print_mtag_field {
# #
# DESCRIPTION # DESCRIPTION
# print_meta_field - Prints VALUE of FIELD, for specific TRACK NUMBER out of a JSON string. Expects to be used # print_meta_field - Prints VALUE of FIELD, for specific TRACK NUMBER out of a JSON string. Expects to be used
# by print_meta() # by print_meta()
# #
# USAGE # USAGE
# print_meta_field <file> <track_no> <field_name> # print_mtag_field <file> <track_no> <field_name>
# #
# } # }
print_meta_field() { print_mtag_field() {
local FILE="${1}" local FILE="${1}"
local TRACK_NO="${2}" local TRACK_NO="${2}"
local FIELD="${3}" local FIELD="${3}"

View file

@ -1,16 +1,16 @@
#!/bin/bash #!/bin/bash
# doc print_track_no { # doc print_mtag_trackno {
# #
# DESCRIPTION # DESCRIPTION
# print_track_no - Prints track number of TRACKID using MTAG file # print_mtag_trackno - Prints track number of TRACKID using MTAG file
# #
# USAGE # USAGE
# print_track_no <path/to/git/dir> <IMAGEID> <TRACKID> # print_mtag_trackno <path/to/git/dir> <IMAGEID> <TRACKID>
# #
# } # }
print_track_no() { print_mtag_trackno() {
local GIT_DIR="${1}" local GIT_DIR="${1}"
local IMAGEID="${2}" local IMAGEID="${2}"
local TRACKID="${3}" local TRACKID="${3}"
@ -19,7 +19,7 @@ print_track_no() {
local COUNT=1 local COUNT=1
while [[ ${COUNT} -le ${TOTALTRACKS} ]]; do while [[ ${COUNT} -le ${TOTALTRACKS} ]]; do
[[ "$(print_meta_field ${GIT_DIR}/${IMAGEID}.tags ${COUNT} TRACKID)" == "${TRACKID}" ]] && echo ${COUNT} [[ "$(print_mtag_field ${GIT_DIR}/${IMAGEID}.tags ${COUNT} TRACKID)" == "${TRACKID}" ]] && echo ${COUNT}
local COUNT=$(( ${COUNT} + 1 )) local COUNT=$(( ${COUNT} + 1 ))
done done
} }