[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:
parent
ab40c112ed
commit
0c695f0a76
4 changed files with 17 additions and 24 deletions
|
@ -23,7 +23,7 @@ chk_deployed_ids() {
|
|||
local COUNT=$(( ${COUNT} + 1 ))
|
||||
local ERR=false
|
||||
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 TRACKID=${metadataList[1]}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import_src() {
|
|||
local fileList=($(find ${TRACK_DIR} -maxdepth 1 -name '*.flac' -printf '%p\n' | sort))
|
||||
|
||||
# Join trackList
|
||||
echo "Processing audio files "
|
||||
echo "Processing audio files"
|
||||
case ${SOURCE} in
|
||||
FLAC)
|
||||
gen_image "${TRACK_DIR}/flac" $(printf "%s\t" ${fileList[@]})
|
||||
|
@ -49,7 +49,7 @@ import_src() {
|
|||
(FLAC)
|
||||
local trackList=(${fileList[@]})
|
||||
local addmetaList=($(gen_metatrack ${trackList[@]}))
|
||||
local trackmetaList=($(print_meta_flac "${trackList}"))
|
||||
local trackmetaList=($(print_meta_flac ${trackList[@]}))
|
||||
;;
|
||||
CUETOOLS|EAC)
|
||||
local trackList=($(grep -o TRACK ${TRACK_DIR}/cue ))
|
||||
|
@ -65,8 +65,6 @@ import_src() {
|
|||
local COUNT=$(( ${COUNT} + 1 ))
|
||||
done
|
||||
|
||||
echo ${metadataList[@]}
|
||||
|
||||
# Generate cuesheet
|
||||
echo "Generating cue file"
|
||||
case ${SOURCE} in
|
||||
|
@ -93,7 +91,7 @@ import_src() {
|
|||
cp "${TRACK_DIR}/flac" "${GIT_DIR}/${IMAGEID}.flac"
|
||||
|
||||
# Generate cover images
|
||||
gen_cover "${TRACK_DIR}/jpg" > ${GIT_DIR}/${IMAGEID}.png
|
||||
gen_small_cover "${TRACK_DIR}/jpg" > ${GIT_DIR}/${IMAGEID}.jpg
|
||||
gen_cover "${TRACK_DIR}/png" > ${GIT_DIR}/${IMAGEID}.png
|
||||
gen_small_cover "${TRACK_DIR}/png" > ${GIT_DIR}/${IMAGEID}.jpg
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -25,10 +25,11 @@ import_track() {
|
|||
local coverList=($(find "${DIR_NAME}"/ -maxdepth 1 \( -name '*.jpg' -o -name '*.png' \) -printf '%p\t'))
|
||||
|
||||
# Metadata parsing
|
||||
local ARTIST=$(cut -d= -f2 <<< $(print_meta_flac ${TRACK} ARTIST))
|
||||
local ALBUM=$(cut -d= -f2 <<< $(print_meta_flac ${TRACK} ALBUM))
|
||||
local DISCNUMBER=$(cut -d= -f2 <<< $(print_meta_flac ${TRACK} DISCNUMBER))
|
||||
local TRACKNUMBER=$(cut -d= -f2 <<< $(print_meta_flac ${TRACK} TRACKNUMBER))
|
||||
local metadataList=($(print_meta_flac ${TRACK}))
|
||||
local ARTIST=$(awk 'BEGIN{FS="=";RS=";"}{if($1==ARTIST){print $2}}')
|
||||
local ALBUM=$(awk 'BEGIN{FS="=";RS=";"}{if($1==ALBUM){print $2}}')
|
||||
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
|
||||
[[ -z "${DISCNUMBER}" ]] && local DISCNUMBER=1
|
||||
|
|
|
@ -11,18 +11,12 @@
|
|||
# }
|
||||
|
||||
print_meta_flac() {
|
||||
local FILE="${1}"; shift
|
||||
local tagList=(${@})
|
||||
[[ ! -f ${FILE} ]] && return 1
|
||||
|
||||
local METADATA=$(awk 'BEGIN{FS="]: ";ORS=";"}{if($1 ~ /comment\[/){print $2}}' <<< $(metaflac --list --block-type=VORBIS_COMMENT "${FILE}"))
|
||||
if [[ -z "${tagList[@]}" ]]; then
|
||||
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
|
||||
echo -n "${SEL_METADATA}" | sed 's|.$||'
|
||||
fi
|
||||
local fileList="${@}"
|
||||
|
||||
for file in ${fileList[@]}; do
|
||||
[[ ! -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|.$||'
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue