[import_images] Rewrote

This commit is contained in:
ayakael 2018-07-12 17:30:58 -08:00
parent de578b9e5b
commit cabf81552a
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026

View file

@ -23,24 +23,28 @@
import_images() { import_images() {
local TRACK_DIR="${1}" local TRACK_DIR="${1}"
local IMG="${2}" local IMG="${2}"; local pathList[1]="${IMG}"
local CUE="${3}"; shift 3 local CUE="${3}"; local pathList[2]="${CUE}"; shift 3
while true; do while true; do
case ${1} in case ${1} in
(-a) local ACCURIP="${2}"; shift 2;; (-a) local ACCURIP="${2}"; local pathList[3]="${ACCURIP}"; shift 2;;
(-c) local COVER="${2}"; shift 2;; (-c) local COVER="${2}"; local pathList[4]="${COVER}"; shift 2;;
(-l) local LOG="${2}"; shift 2;; (-l) local LOG="${2}"; local pathList[5]="${LOG}"; shift 2;;
(*) break ;; (*) break ;;
esac esac
done done
local pathList=(${IMG} ${CUE} ${ACCURIP} ${COVER} ${LOG}) # Checks if ACCURIP is defined. If so, source CUETOOLS, else, SOURCE is EAC
[[ -z ${ACCURIP+x} ]] || local SOURCE=CUETOOLS && SOURCE=EAC
# Checks if path is valid
for path in ${pathList[@]}; do for path in ${pathList[@]}; do
[[ -f ${path} ]] || return 1 [[ -f ${path} ]] || return 1
done done
# Copies path to import folder
for path in ${pathList[@]}; do for path in ${pathList[@]}; do
cp "${path}" "$(sed 's|.*/.||' <<< ${TRACK_DIR})" cp "${path}" "${GIT_DIR}/.import/${SOURCE}/$(sed 's|.*/.||' <<< ${TRACK_DIR})"
done done
} }