Unified · Split
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | CONFIG="${HOME}/.split2flac" |
| 31 | 31 | TMPCUE="${HOME}/.split2flac_sheet.cue" |
| 32 | 32 | TMPPIC="${HOME}/.split2flac_cover.jpg" |
| 33 | +FAILED="split_failed.txt" | |
| 33 | 34 | |
| 34 | 35 | NOSUBDIRS=0 |
| 35 | 36 | NORENAME=0 |
| @@ -498,6 +499,7 @@ split_file () { · 462 unmodified lines | ||
| 498 | 499 | } |
| 499 | 500 | |
| 500 | 501 | split_collection () { |
| 502 | + NUM_FAILED=0 | |
| 501 | 503 | while read -r FILE; do |
| 502 | 504 | $msg "$cG>> $cC\"${FILE}\"$cZ" |
| 503 | 505 | unset PIC CUE |
| @@ -505,15 +507,28 @@ split_collection () { · 1 unmodified line | ||
| 505 | 507 | |
| 506 | 508 | if [ ! $? -eq 0 ]; then |
| 507 | 509 | emsg "Failed to split \"${FILE}\"" |
| 510 | + echo "${FILE}" >> "${FAILED}" | |
| 511 | + NUM_FAILED=$((${NUM_FAILED} + 1)) | |
| 508 | 512 | fi |
| 509 | 513 | |
| 510 | 514 | echo |
| 511 | 515 | done |
| 516 | + | |
| 517 | + return ${NUM_FAILED} | |
| 512 | 518 | } |
| 513 | 519 | |
| 514 | 520 | # searches for files in a directory and splits them |
| 515 | 521 | split_dir () { |
| 522 | + rm -f "${FAILED}" | |
| 516 | 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 | 534 | if [ -d "${INPATH}" ]; then |