[import_dir] Completed function
This commit is contained in:
parent
3ff8d2f4b8
commit
4a9d29a9b9
1 changed files with 30 additions and 1 deletions
|
@ -8,12 +8,41 @@
|
||||||
# USAGE
|
# USAGE
|
||||||
# import_dir </path/to/git/dir> </path/to/track/dir>
|
# import_dir </path/to/git/dir> </path/to/track/dir>
|
||||||
#
|
#
|
||||||
|
# DEPENDENCIES src/gen_mtag
|
||||||
|
#
|
||||||
# }
|
# }
|
||||||
|
|
||||||
import_dir() {
|
import_dir() {
|
||||||
local GIT_DIR="${1}"
|
local GIT_DIR="${1}"
|
||||||
local TRACK_DIR="${2}"
|
local TRACK_DIR="${2}"
|
||||||
|
|
||||||
local trackList=($(find ${TRACK_DIR} -maxdepth=1 -name *.flac -print '%p\t'))
|
local trackList=($(find ${TRACK_DIR} -maxdepth 1 -name *.flac -print '%p\t'))
|
||||||
|
|
||||||
|
# Join trackList
|
||||||
|
_msg EXEC "Generating joined image"
|
||||||
|
gen_image "${TARGET_DIR}" $(printf "%s\t" ${trackList[@]})
|
||||||
|
local EXIT="$?"
|
||||||
|
[[ $? -eq 0 ]] && _msg OK || { _msg WARN; return 1; }
|
||||||
|
|
||||||
|
|
||||||
|
# Generates IMAGEID
|
||||||
|
for track in ${trackList[@]}; do
|
||||||
|
local TRACK_EXT="$(cut -d '.' -f2)"
|
||||||
|
[[ "${TRACK_EXT}" != "FLAC" ]] && SOURCE="${TRACK_EXT}"
|
||||||
|
done
|
||||||
|
local IMAGEID="SHA256-${SOURCE}--$(sha256sum "${TARGET_DIR}/joined.flac")"
|
||||||
|
|
||||||
|
# Generate metadata_trackList
|
||||||
|
local COUNT=0
|
||||||
|
for track in ${trackList[@]}; do
|
||||||
|
local TRACKID=$(metaflac --list --block-number=0 "${track}" | awk 'BEGIN{FS=": "}{if($1==" MD5 signature") {print $2}}')
|
||||||
|
local metadata_trackList[${COUNT}]="$(print_meta_flac "${track}");IMAGEID=${IMAGEID};TRACKID=${TRACKID};"
|
||||||
|
local COUNT=$(( ${COUNT} + 1 ))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Generate cuesheet
|
||||||
|
gen_cue $(printf '%s\t' ${metadata_trackList[@]}) > "${GIT_DIR}/${IMAGEID}.cue"
|
||||||
|
|
||||||
|
# Generate tags file
|
||||||
|
gen_mtag $(printf '%s\t' ${metadata_trackList[@]}) > "${GIT_DIR}/${IMAGEID}.tags"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue