History

print 'failed to split' files and write their names in split_failed.txt

Serge Zirukin committed 16 years ago

Commit 0abed7a1 parent 4f82ba11 file · +15 −0Browse files

Unified · Split

split2flac.sh+15−0
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 CONFIG="${HOME}/.split2flac"
3131 TMPCUE="${HOME}/.split2flac_sheet.cue"
3232 TMPPIC="${HOME}/.split2flac_cover.jpg"
33+FAILED="split_failed.txt"
3334
3435 NOSUBDIRS=0
3536 NORENAME=0
@@ -498,6 +499,7 @@ split_file () { · 462 unmodified lines
498499 }
499500
500501 split_collection () {
502+ NUM_FAILED=0
501503 while read -r FILE; do
502504 $msg "$cG>> $cC\"${FILE}\"$cZ"
503505 unset PIC CUE
@@ -505,15 +507,28 @@ split_collection () { · 1 unmodified line
505507
506508 if [ ! $? -eq 0 ]; then
507509 emsg "Failed to split \"${FILE}\""
510+ echo "${FILE}" >> "${FAILED}"
511+ NUM_FAILED=$((${NUM_FAILED} + 1))
508512 fi
509513
510514 echo
511515 done
516+
517+ return ${NUM_FAILED}
512518 }
513519
514520 # searches for files in a directory and splits them
515521 split_dir () {
522+ rm -f "${FAILED}"
516523 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
517532 }
518533
519534 if [ -d "${INPATH}" ]; then

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t