Unified · Split
| @@ -30,6 +30,7 @@ · 29 unmodified lines | |||
| 30 | CONFIG="${HOME}/.split2flac" | 30 | CONFIG="${HOME}/.split2flac" |
| 31 | TMPCUE="${HOME}/.split2flac_sheet.cue" | 31 | TMPCUE="${HOME}/.split2flac_sheet.cue" |
| 32 | TMPPIC="${HOME}/.split2flac_cover.jpg" | 32 | TMPPIC="${HOME}/.split2flac_cover.jpg" |
| 33 | FAILED="split_failed.txt" | ||
| 33 | 34 | ||
| 34 | NOSUBDIRS=0 | 35 | NOSUBDIRS=0 |
| 35 | NORENAME=0 | 36 | NORENAME=0 |
| @@ -498,6 +499,7 @@ split_file () { · 462 unmodified lines | |||
| 498 | } | 499 | } |
| 499 | 500 | ||
| 500 | split_collection () { | 501 | split_collection () { |
| 502 | NUM_FAILED=0 | ||
| 501 | while read -r FILE; do | 503 | while read -r FILE; do |
| 502 | $msg "$cG>> $cC\"${FILE}\"$cZ" | 504 | $msg "$cG>> $cC\"${FILE}\"$cZ" |
| 503 | unset PIC CUE | 505 | unset PIC CUE |
| @@ -505,15 +507,28 @@ split_collection () { · 1 unmodified line | |||
| 505 | 507 | ||
| 506 | if [ ! $? -eq 0 ]; then | 508 | if [ ! $? -eq 0 ]; then |
| 507 | emsg "Failed to split \"${FILE}\"" | 509 | emsg "Failed to split \"${FILE}\"" |
| 510 | echo "${FILE}" >> "${FAILED}" | ||
| 511 | NUM_FAILED=$((${NUM_FAILED} + 1)) | ||
| 508 | fi | 512 | fi |
| 509 | 513 | ||
| 510 | echo | 514 | echo |
| 511 | done | 515 | done |
| 516 | |||
| 517 | return ${NUM_FAILED} | ||
| 512 | } | 518 | } |
| 513 | 519 | ||
| 514 | # searches for files in a directory and splits them | 520 | # searches for files in a directory and splits them |
| 515 | split_dir () { | 521 | split_dir () { |
| 522 | rm -f "${FAILED}" | ||
| 516 | find "$1" -name '*.flac' -o -name '*.ape' -o -name '*.wv' | split_collection | 523 | find "$1" -name '*.flac' -o -name '*.ape' -o -name '*.wv' | split_collection |
| 524 | NUM_FAILED=$? | ||
| 525 | if [ ${NUM_FAILED} -ne 0 ]; then | ||
| 526 | emsg "${NUM_FAILED} file(s) failed to split (already splited?):" | ||
| 527 | $msg "${cR}" | ||
| 528 | sort "${FAILED}" -o "${FAILED}" | ||
| 529 | cat "${FAILED}" | ||
| 530 | emsg "\nThese files are also listed in ${FAILED}." | ||
| 531 | fi | ||
| 517 | } | 532 | } |
| 518 | 533 | ||
| 519 | if [ -d "${INPATH}" ]; then | 534 | if [ -d "${INPATH}" ]; then |