[cmd_import_images][import_src] Added -b option for batchid
This commit is contained in:
parent
346cfdc2d1
commit
0e3a0d277c
2 changed files with 7 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
||||||
# cmd_import_images - Imports CD images into GIT_DIR
|
# cmd_import_images - Imports CD images into GIT_DIR
|
||||||
#
|
#
|
||||||
# USAGE
|
# USAGE
|
||||||
# cmd_import_images </path/to/image/folder> [<...>]
|
# cmd_import_images </path/to/git/dir> </path/to/source/dir> -b [<batch-id>] </path/to/image/folder> [<...>]
|
||||||
#
|
#
|
||||||
# DEPENDENCIES src/import_images
|
# DEPENDENCIES src/import_images
|
||||||
#
|
#
|
||||||
|
@ -15,6 +15,9 @@
|
||||||
cmd_import_images() {
|
cmd_import_images() {
|
||||||
local GIT_DIR="${1}"
|
local GIT_DIR="${1}"
|
||||||
local SOURCE="${2}"; shift 2
|
local SOURCE="${2}"; shift 2
|
||||||
|
case ${1} in
|
||||||
|
(-b) local BATCHID=${2}; shift 2 ;;
|
||||||
|
esac
|
||||||
local dirList=("${@}")
|
local dirList=("${@}")
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +57,7 @@ cmd_import_images() {
|
||||||
local importList=($(find ${GIT_DIR}/.import/${SOURCE}/ -mindepth 1 -maxdepth 1 -type d -printf '%p\t'))
|
local importList=($(find ${GIT_DIR}/.import/${SOURCE}/ -mindepth 1 -maxdepth 1 -type d -printf '%p\t'))
|
||||||
for import in ${importList[@]}; do
|
for import in ${importList[@]}; do
|
||||||
_msg EXEC "Importing ${import}"
|
_msg EXEC "Importing ${import}"
|
||||||
import_src "${GIT_DIR}" "${import}" >${STDERR} 2>&1
|
import_src "${GIT_DIR}" "${import}" $([[ -n "${BATCHID}" ]] && echo "-b") ${BATCHID} >${STDERR} 2>&1
|
||||||
local EXIT=$?
|
local EXIT=$?
|
||||||
[[ ${EXIT} -eq 0 ]] && _msg OK || _msg WARN "import_src exited with code ${EXIT}"
|
[[ ${EXIT} -eq 0 ]] && _msg OK || _msg WARN "import_src exited with code ${EXIT}"
|
||||||
rm -Rf "${import}" >/dev/null 2>&1
|
rm -Rf "${import}" >/dev/null 2>&1
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
import_src() {
|
import_src() {
|
||||||
local GIT_DIR="${1}"
|
local GIT_DIR="${1}"
|
||||||
local TRACK_DIR="${2}"
|
local TRACK_DIR="${2}"
|
||||||
|
[[ ${3} == "-b" ]] && local BATCHID="${4}"
|
||||||
local SOURCE=$(sed 's|.*.import/||' <<<${TRACK_DIR}| cut -d/ -f1)
|
local SOURCE=$(sed 's|.*.import/||' <<<${TRACK_DIR}| cut -d/ -f1)
|
||||||
local supportedsrcList=(FLAC CUETOOLS EAC)
|
local supportedsrcList=(FLAC CUETOOLS EAC)
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ import_src() {
|
||||||
|
|
||||||
# Conjoins trackmetaList and addmetaList into metadataList
|
# Conjoins trackmetaList and addmetaList into metadataList
|
||||||
while [[ ${COUNT} -lt ${#trackList[@]} ]]; do
|
while [[ ${COUNT} -lt ${#trackList[@]} ]]; do
|
||||||
local metadataList[${COUNT}]="${trackmetaList[${COUNT}]};${addmetaList[${COUNT}]};IMAGEID=${IMAGEID};"
|
local metadataList[${COUNT}]="${trackmetaList[${COUNT}]};${addmetaList[${COUNT}]};IMAGEID=${IMAGEID};BATCHID=${BATCHID}"
|
||||||
local COUNT=$(( ${COUNT} + 1 ))
|
local COUNT=$(( ${COUNT} + 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue