[import_images] Now groks source from function argument rather than through inference; DISCID is now grokked via grep rather than awk; exit code 2 executed when ACCURIP is present on EAC image or is not present on CUETOOLS
This commit is contained in:
parent
37266463ce
commit
d25f022ced
1 changed files with 9 additions and 8 deletions
|
@ -23,8 +23,9 @@
|
||||||
|
|
||||||
import_images() {
|
import_images() {
|
||||||
local GIT_DIR="${1}"
|
local GIT_DIR="${1}"
|
||||||
local IMG="${2}"; local pathList[1]="${IMG}"
|
local SOURCE="${2}"
|
||||||
local CUE="${3}"; local pathList[2]="${CUE}"; shift 3
|
local IMG="${3}"; local pathList[1]="${IMG}"
|
||||||
|
local CUE="${4}"; local pathList[2]="${CUE}"; shift 3
|
||||||
while true; do
|
while true; do
|
||||||
case ${1} in
|
case ${1} in
|
||||||
(-a) local ACCURIP="${2}"; local pathList[3]="${ACCURIP}"; shift 2;;
|
(-a) local ACCURIP="${2}"; local pathList[3]="${ACCURIP}"; shift 2;;
|
||||||
|
@ -34,17 +35,17 @@ import_images() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Checks if ACCURIP is defined. If so, source CUETOOLS, else, SOURCE is EAC
|
|
||||||
[[ -z "${ACCURIP}" ]] && local SOURCE=EAC || local SOURCE=CUETOOLS
|
|
||||||
|
|
||||||
# Checks if path is valid
|
# 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
|
||||||
|
|
||||||
# Parses cue file for metadata
|
# Checks if ACCURIP should exist or not
|
||||||
local METADATA=$(print_meta_cue "${CUE}")
|
if [[ -n "${ACCURIP}" ]] && [[ "${SOURCE}" == "EAC" ]]; then return 2; fi
|
||||||
local DISCID="$(awk 'BEGIN{RS=";";FS="="}{if($1=="DISCID"){print $2}}')"
|
if [[ -z "${ACCURIP}" ]] && [[ "${SOURCE}" == "CUETOOLS" ]]; then return 2; fi
|
||||||
|
|
||||||
|
# Parses cue file for DISCID
|
||||||
|
local DISCID="$(grep "REM DISCID" ${TRACK_DIR}/cue | cut -d' ' -f3)"
|
||||||
|
|
||||||
# Copies path to import folder
|
# Copies path to import folder
|
||||||
mkdir -p "${GIT_DIR}/.import/${SOURCE}/$(dirname ${IMG} | sed 's|.*/||')"
|
mkdir -p "${GIT_DIR}/.import/${SOURCE}/$(dirname ${IMG} | sed 's|.*/||')"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue