[cmd_import] Optimized delegation

[cmd_import_cueripper] [cmd_import_tracks] Changed names of old functions
This commit is contained in:
ayakael 2018-05-15 22:52:31 -07:00
parent 9e4e9327b2
commit 3670bb268b
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026
3 changed files with 5 additions and 7 deletions

View file

@ -28,8 +28,5 @@ cmd_import() {
local GIT_DIR="${2}"; shift 2
local dirList=(${@})
[[ "${CMD}" == "cueripper" ]] && import_cueripper ${@}
[[ "${CMD}" == "eac" ]] && import_eac ${@}
[[ "${CMD}" == "tracks" ]] && import_tracks ${@}
eval import_${CMD} "${GIT_DIR}" ${@}
}

View file

@ -11,12 +11,13 @@
# }
cmd_import_cueripper() {
local GIT_DIR="${1}"; shift
local dirList=("${@}")
for dir in ${dirList[@]}; do
folderList=($(find "${dir}" -name '*.cue' -printf '%h\n' | awk '!seen[$0]++'))
for folder in ${folderList[@]}; do
gen "${folder}"
import_cueripper "${GIT_DIR}" "${folder}"
done
done
}

View file

@ -10,13 +10,13 @@
#
# }
cmd_import_tracks {
cmd_import_tracks() {
local ROOT="${1}"; shift 1
local dirList=("${@}")
for dir in ${dirList[@]}; do
folderList=($(find ${ROOT}/${dir} -name '*cover*' -printf '%h\n' | awk '!seen[$0]++' | sed "s|${ROOT}/||g"))
for folder in ${folderList[@]}; do
gen ${ROOT} "${folder}"
import_tracks ${ROOT} "${folder}"
done
done
}