[print_meta_flac] Now accepts multiple files as argument. Deprecating ability to filter tags.

[import_src][import_track][chk_deployed_ids] Updated print_meta_flac's usage
[import_src] Now used png rather than jpg for cover input
This commit is contained in:
ayakael 2018-07-23 05:29:22 -08:00
parent ab40c112ed
commit 0c695f0a76
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026
4 changed files with 17 additions and 24 deletions

View file

@ -23,7 +23,7 @@ chk_deployed_ids() {
local COUNT=$(( ${COUNT} + 1 )) local COUNT=$(( ${COUNT} + 1 ))
local ERR=false local ERR=false
echo "[ ${COUNT} / ${#flacList[@]} ] Checking ${flac}" echo "[ ${COUNT} / ${#flacList[@]} ] Checking ${flac}"
local metadataList=($(awk 'BEGIN{RS=";";FS="="}{print $2}' <<< $(print_meta_flac "${TARGET}/${flac}" IMAGEID TRACKID))) local metadataList=($(awk 'BEGIN{RS=";";FS="="}{if($1=="IMAGEID" || $2=="TRACKID"){print $2}' <<< $(print_meta_flac "${TARGET}/${flac}")))
local IMAGEID=${metadataList[0]} local IMAGEID=${metadataList[0]}
local TRACKID=${metadataList[1]} local TRACKID=${metadataList[1]}

View file

@ -49,7 +49,7 @@ import_src() {
(FLAC) (FLAC)
local trackList=(${fileList[@]}) local trackList=(${fileList[@]})
local addmetaList=($(gen_metatrack ${trackList[@]})) local addmetaList=($(gen_metatrack ${trackList[@]}))
local trackmetaList=($(print_meta_flac "${trackList}")) local trackmetaList=($(print_meta_flac ${trackList[@]}))
;; ;;
CUETOOLS|EAC) CUETOOLS|EAC)
local trackList=($(grep -o TRACK ${TRACK_DIR}/cue )) local trackList=($(grep -o TRACK ${TRACK_DIR}/cue ))
@ -65,8 +65,6 @@ import_src() {
local COUNT=$(( ${COUNT} + 1 )) local COUNT=$(( ${COUNT} + 1 ))
done done
echo ${metadataList[@]}
# Generate cuesheet # Generate cuesheet
echo "Generating cue file" echo "Generating cue file"
case ${SOURCE} in case ${SOURCE} in
@ -93,7 +91,7 @@ import_src() {
cp "${TRACK_DIR}/flac" "${GIT_DIR}/${IMAGEID}.flac" cp "${TRACK_DIR}/flac" "${GIT_DIR}/${IMAGEID}.flac"
# Generate cover images # Generate cover images
gen_cover "${TRACK_DIR}/jpg" > ${GIT_DIR}/${IMAGEID}.png gen_cover "${TRACK_DIR}/png" > ${GIT_DIR}/${IMAGEID}.png
gen_small_cover "${TRACK_DIR}/jpg" > ${GIT_DIR}/${IMAGEID}.jpg gen_small_cover "${TRACK_DIR}/png" > ${GIT_DIR}/${IMAGEID}.jpg
return 0 return 0
} }

View file

@ -25,10 +25,11 @@ import_track() {
local coverList=($(find "${DIR_NAME}"/ -maxdepth 1 \( -name '*.jpg' -o -name '*.png' \) -printf '%p\t')) local coverList=($(find "${DIR_NAME}"/ -maxdepth 1 \( -name '*.jpg' -o -name '*.png' \) -printf '%p\t'))
# Metadata parsing # Metadata parsing
local ARTIST=$(cut -d= -f2 <<< $(print_meta_flac ${TRACK} ARTIST)) local metadataList=($(print_meta_flac ${TRACK}))
local ALBUM=$(cut -d= -f2 <<< $(print_meta_flac ${TRACK} ALBUM)) local ARTIST=$(awk 'BEGIN{FS="=";RS=";"}{if($1==ARTIST){print $2}}')
local DISCNUMBER=$(cut -d= -f2 <<< $(print_meta_flac ${TRACK} DISCNUMBER)) local ALBUM=$(awk 'BEGIN{FS="=";RS=";"}{if($1==ALBUM){print $2}}')
local TRACKNUMBER=$(cut -d= -f2 <<< $(print_meta_flac ${TRACK} TRACKNUMBER)) local DISCNUMBER=$(awk 'BEGIN{FS="=";RS=";"}{if($1==DISCNUMBER){print $2}}')
local TRACKNUMBER=$(awk 'BEGIN{FS="=";RS=";"}{if($1==TRACKNUMBER){print $2}}')
# Setting TRACK_DIR # Setting TRACK_DIR
[[ -z "${DISCNUMBER}" ]] && local DISCNUMBER=1 [[ -z "${DISCNUMBER}" ]] && local DISCNUMBER=1

View file

@ -11,18 +11,12 @@
# } # }
print_meta_flac() { print_meta_flac() {
local FILE="${1}"; shift local fileList="${@}"
local tagList=(${@})
[[ ! -f ${FILE} ]] && return 1
local METADATA=$(awk 'BEGIN{FS="]: ";ORS=";"}{if($1 ~ /comment\[/){print $2}}' <<< $(metaflac --list --block-type=VORBIS_COMMENT "${FILE}")) for file in ${fileList[@]}; do
if [[ -z "${tagList[@]}" ]]; then [[ ! -f ${file} ]] && return 1
local METADATA=$(awk 'BEGIN{FS="]: ";ORS=";"}{if($1 ~ /comment\[/){print $2}}' <<< $(metaflac --list --block-type=VORBIS_COMMENT "${file}"))
echo -n ${METADATA} | sed 's|.$||' echo -n ${METADATA} | sed 's|.$||'
else
for tag in ${tagList[@]}; do
local SEL_METADATA="${SEL_METADATA}$(awk -v tag=${tag} 'BEGIN{FS="=";RS=";";ORS=";"}{if($1==tag){print $0}}' <<< ${METADATA})"
done done
echo -n "${SEL_METADATA}" | sed 's|.$||'
fi
} }