Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Check shntool and cuetools existance #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions split2flac
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,22 @@ update_pattern () {
update_pattern_aux "$v" "_${tag_name}" $(echo "${tag_value}" | sed "s/ /_/g")
}

check_cuetools () {
if ! which cuebreakpoints 2>/dev/null ; then
emsg "'cuebreakpoints' tool was not found, "
emsg "you should install 'cuetools' package\n"
exit 1
fi
}

check_shntool () {
if ! which shnsplit 2>/dev/null ; then
emsg "'shnsplit' tool was not found, "
emsg "you should install 'shntool' package\n"
exit 1
fi
}

# splits a file
split_file () {
TMPCUE="${HOME}/.split2flac_XXXXX.cue"
Expand Down Expand Up @@ -423,6 +439,8 @@ split_file () {
TAG_ALBUM=$(${GETTAG} %T "${CUE}" 2>/dev/null)
TRACKS_NUM=$(${GETTAG} %N "${CUE}" 2>/dev/null)

check_cuetools

# some cue sheets may have non-audio tracks
# we can check the difference between what cuebreakpoints and cueprint gives us
BREAKPOINTS_NUM=$(($(cuebreakpoints "${CUE}" 2>/dev/null | wc -l) + 1))
Expand Down Expand Up @@ -502,6 +520,8 @@ split_file () {
*) emsg "Unknown output format ${FORMAT}\n"; exit 1;;
esac

check_shntool

# split to tracks
# sed expression is a fix for "shnsplit: error: m:ss.ff format can only be used with CD-quality files"
cuebreakpoints "${CUE}" 2>/dev/null | \
Expand Down