[export_gen] Changed name to gen_tracks to relativize
[gen_tracks] Relativized function [export_cp][export_cp][gen_trackid] Changed name of export_gen function, and update to support new syntax
This commit is contained in:
parent
6f4b82b3b4
commit
31c3b39b68
4 changed files with 18 additions and 16 deletions
|
@ -9,7 +9,7 @@
|
||||||
# USAGE
|
# USAGE
|
||||||
# export_cp </path/to/git/dir> </path/to/target> </path/to/db/file> <IMAGEID>
|
# export_cp </path/to/git/dir> </path/to/target> </path/to/db/file> <IMAGEID>
|
||||||
#
|
#
|
||||||
# DEPENDENCIES bunc/src/* src/export_gen src/export_mv
|
# DEPENDENCIES bunc/src/* src/gen_tracks src/export_mv
|
||||||
#
|
#
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ export_cp() {
|
||||||
|
|
||||||
## Splits IMAGEID into TRACKIDs
|
## Splits IMAGEID into TRACKIDs
|
||||||
_msg EXEC "Splitting ${IMAGEID}"
|
_msg EXEC "Splitting ${IMAGEID}"
|
||||||
export_gen "${GIT_DIR}" ${IMAGEID} >${STDERR} 2>&1
|
gen_tracks "${GIT_DIR}" "${GIT_DIR}/${IMAGEID}.flac" "${GIT_DIR}/${IMAGEID}.cue" >${STDERR} 2>&1
|
||||||
[[ $? -ne 0 ]] && _msg WARN
|
[[ $? -ne 0 ]] && _msg WARN
|
||||||
export_mv "${GIT_DIR}" ${IMAGEID} >${STDERR} 2>&1
|
export_mv "${GIT_DIR}" ${IMAGEID} >${STDERR} 2>&1
|
||||||
[[ $? -eq 0 ]] && _msg OK || _msg WARN
|
[[ $? -eq 0 ]] && _msg OK || _msg WARN
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# doc export_mv {
|
# doc export_mv {
|
||||||
#
|
#
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
# export_mv - Renames output files from export_gen to associated TRACKID
|
# export_mv - Renames output files from gen_tracks to associated TRACKID
|
||||||
#
|
#
|
||||||
# USAGE
|
# USAGE
|
||||||
# export_mv </path/to/git/dir> <IMAGEID.
|
# export_mv </path/to/git/dir> <IMAGEID.
|
||||||
|
|
|
@ -8,15 +8,16 @@
|
||||||
# USAGE
|
# USAGE
|
||||||
# gen_trackid </path/to/flac/file> </path/to/cue/fule>
|
# gen_trackid </path/to/flac/file> </path/to/cue/fule>
|
||||||
#
|
#
|
||||||
# DEPENDENCIES src/export_gen
|
# DEPENDENCIES src/gen_tracks
|
||||||
#
|
#
|
||||||
# }
|
# }
|
||||||
|
|
||||||
gen_trackid() {
|
gen_trackid() {
|
||||||
FLAC="${1}"
|
GIT_DIR="${1}"
|
||||||
CUE="${2}"
|
FLAC="${2}"
|
||||||
|
CUE="${3}"
|
||||||
|
|
||||||
export_gen ${FLAC} ${CUE} >/dev/null 2>&1
|
gen_tracks "${GIT_DIR}" "${FLAC}" "${CUE}" >/dev/null 2>&1
|
||||||
local TOTALTRACKS="$(grep -e "TRACK [0-9][0-9] AUDIO" "${CUE}" | wc -l)"
|
local TOTALTRACKS="$(grep -e "TRACK [0-9][0-9] AUDIO" "${CUE}" | wc -l)"
|
||||||
|
|
||||||
local COUNT=1
|
local COUNT=1
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# doc export_gen {
|
# doc gen_tracks {
|
||||||
#
|
#
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
# export_gen - Splits specified image into multiple files using a text file
|
# gen_tracks - Splits specified image into multiple files using a text file
|
||||||
# formatted under the CUE specification
|
# formatted under the CUE specification
|
||||||
#
|
#
|
||||||
# USAGE
|
# USAGE
|
||||||
# export_gen </path/to/git/dir> <IMAGEID>
|
# gen_tracks </path/to/git/dir> </path/to/image> </path/to/cue/file>
|
||||||
#
|
#
|
||||||
# }
|
# }
|
||||||
|
|
||||||
export_gen() {
|
gen_tracks() {
|
||||||
local GITDIR="${1}"
|
local GITDIR="${1}"
|
||||||
local IMAGEID="${2}"
|
local IMAGE="${2}"
|
||||||
|
local CUE="${3}"
|
||||||
|
|
||||||
## breakpointList generator
|
## breakpointList generator
|
||||||
# Generates list with cuebreakpoints utility
|
# Generates list with cuebreakpoints utility
|
||||||
local breakpointList=($(cuebreakpoints "${GITDIR}/${IMAGEID}.cue" 2>/dev/null))
|
local breakpointList=($(cuebreakpoints "${CUE}" 2>/dev/null))
|
||||||
|
|
||||||
# In the event that breakpointList is empty because image represents only one track,
|
# In the event that breakpointList is empty because image represents only one track,
|
||||||
# no split occurs, and returns a 0.
|
# no split occurs, and returns a 0.
|
||||||
[[ -z "${breakpointList[@]}" ]] && { cat "${GITDIR}/${IMAGEID}.flac" > ${GITDIR}/split-track01.flac; return 0; }
|
[[ -z "${breakpointList[@]}" ]] && { cat "${IMAGE}" > ${GITDIR}/split-track01.flac; return 0; }
|
||||||
|
|
||||||
# Attempts first split. If fails because of lack of CD quality file, retries with modified breakpointList
|
# Attempts first split. If fails because of lack of CD quality file, retries with modified breakpointList
|
||||||
if ! printf '%s\n' ${breakpointList[@]} | shntool split -o flac -O always -d "${GITDIR}" "${GITDIR}/${IMAGEID}.flac" ; then
|
if ! printf '%s\n' ${breakpointList[@]} | shntool split -o flac -O always -d "${GITDIR}" "${IMAGE}.flac" ; then
|
||||||
printf '%s\n' ${breakpointList[@]} | sed s/$/0/ | shntool split -o flac -O always -d "${GITDIR}" "${GITDIR}/${IMAGEID}.flac"
|
printf '%s\n' ${breakpointList[@]} | sed s/$/0/ | shntool split -o flac -O always -d "${GITDIR}" "${IMAGE}.flac"
|
||||||
[[ $? -ne 0 ]] && return 1 || return 0
|
[[ $? -ne 0 ]] && return 1 || return 0
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue