Unified · Split
| @@ -25,7 +25,7 @@ · 24 unmodified lines | |||
| 25 | # SPLIT: flac, wavpack, mac | 25 | # SPLIT: flac, wavpack, mac |
| 26 | # CONVERT: flac/flake, faac, libmp4v2, id3lib/mutagen, lame, vorbis-tools | 26 | # CONVERT: flac/flake, faac, libmp4v2, id3lib/mutagen, lame, vorbis-tools |
| 27 | # ART: ImageMagick | 27 | # ART: ImageMagick |
| 28 | # CHARSET: iconv | 28 | # CHARSET: iconv, enca |
| 29 | # GAIN: flac, aacgain, mp3gain, vorbisgain | 29 | # GAIN: flac, aacgain, mp3gain, vorbisgain |
| 30 | 30 | ||
| 31 | # Exit codes: | 31 | # Exit codes: |
| @@ -51,6 +51,7 @@ DIR="." · 19 unmodified lines | |||
| 51 | OUTPATTERN="@artist/{@year - }@album/@track - @title.@ext" | 51 | OUTPATTERN="@artist/{@year - }@album/@track - @title.@ext" |
| 52 | COPYMASKS="Covers,covers,*.log,*.txt,*.jpg,*.cbr" | 52 | COPYMASKS="Covers,covers,*.log,*.txt,*.jpg,*.cbr" |
| 53 | COPYFILES=1 | 53 | COPYFILES=1 |
| 54 | ENCA_ARGS="" | ||
| 54 | 55 | ||
| 55 | # codecs default arguments | 56 | # codecs default arguments |
| 56 | ENCARGS_flac="-8" | 57 | ENCARGS_flac="-8" |
| @@ -68,7 +69,7 @@ unset PIC INPATH CUE CHARSET · 11 unmodified lines | |||
| 68 | FORCE=0 | 69 | FORCE=0 |
| 69 | 70 | ||
| 70 | # do not forget to update before commit | 71 | # do not forget to update before commit |
| 71 | VERSION=105 | 72 | VERSION=106 |
| 72 | 73 | ||
| 73 | HELP="\${cG}split2flac version: ${VERSION} | 74 | HELP="\${cG}split2flac version: ${VERSION} |
| 74 | Splits one big \${cU}APE/FLAC/WV/WAV\$cZ\$cG audio image (or a collection) into \${cU}FLAC/M4A/MP3/OGG_VORBIS/WAV\$cZ\$cG tracks with tagging and renaming. | 75 | Splits one big \${cU}APE/FLAC/WV/WAV\$cZ\$cG audio image (or a collection) into \${cU}FLAC/M4A/MP3/OGG_VORBIS/WAV\$cZ\$cG tracks with tagging and renaming. |
| @@ -84,6 +85,7 @@ Usage: \${cZ}split2\${FORMAT}.sh [\${cU}OPTIONS\$cZ] \${cU}FILE\$cZ [\${cU}OPTIO · 9 unmodified lines | |||
| 84 | \$cG-f \${cU}FORMAT\$cZ - use specific output format (current is \$cP\${FORMAT}\$cZ) | 85 | \$cG-f \${cU}FORMAT\$cZ - use specific output format (current is \$cP\${FORMAT}\$cZ) |
| 85 | \$cG-e \${cU}'ARG1 ARG2'\$cZ \$cR*\$cZ - encoder arguments (current is \$cP'\${ENCARGS}'\$cZ) | 86 | \$cG-e \${cU}'ARG1 ARG2'\$cZ \$cR*\$cZ - encoder arguments (current is \$cP'\${ENCARGS}'\$cZ) |
| 86 | \$cG-eh\$cZ - show help for current encoder and exit\$cZ | 87 | \$cG-eh\$cZ - show help for current encoder and exit\$cZ |
| 88 | \$cG-enca \${cU}'ARG1 ARG2'\$cZ \$cR*\$cZ - enca additional arguments (current is \$cP'\${ENCA_ARGS}'\$cZ) | ||
| 87 | \$cG-c \${cU}FILE\$cZ \$cR*\$cZ - use file as a cover image (does not work with \${cU}DIR\$cZ) | 89 | \$cG-c \${cU}FILE\$cZ \$cR*\$cZ - use file as a cover image (does not work with \${cU}DIR\$cZ) |
| 88 | \$cG-nc \${cR}*\$cZ - do not set any cover images | 90 | \$cG-nc \${cR}*\$cZ - do not set any cover images |
| 89 | \$cG-C \${cU}MASKS\$cZ \$cR*\$cZ - specify wildcards for files to copy over (current is \$cP'\${COPYMASKS}'\$cZ) | 91 | \$cG-C \${cU}MASKS\$cZ \$cR*\$cZ - specify wildcards for files to copy over (current is \$cP'\${COPYMASKS}'\$cZ) |
| @@ -154,6 +156,7 @@ while [ "$1" ]; do · 64 unmodified lines | |||
| 154 | -f) FORMAT=$2; update_encargs; shift;; | 156 | -f) FORMAT=$2; update_encargs; shift;; |
| 155 | -e) ENCARGS=$2; shift;; | 157 | -e) ENCARGS=$2; shift;; |
| 156 | -eh) ENCHELP=1;; | 158 | -eh) ENCHELP=1;; |
| 159 | -enca) ENCA_ARGS=$2; shift;; | ||
| 157 | -c) NOPIC=0; PIC=$2; shift;; | 160 | -c) NOPIC=0; PIC=$2; shift;; |
| 158 | -nc) NOPIC=1;; | 161 | -nc) NOPIC=1;; |
| 159 | -C) COPYMASKS=$2; COPYFILES=1; shift;; | 162 | -C) COPYMASKS=$2; COPYFILES=1; shift;; |
| @@ -216,6 +219,7 @@ if [ ${SAVE} -eq 1 ]; then · 56 unmodified lines | |||
| 216 | echo "ENCARGS_mp3=\"${ENCARGS_mp3}\"" >> "${CONFIG}" | 219 | echo "ENCARGS_mp3=\"${ENCARGS_mp3}\"" >> "${CONFIG}" |
| 217 | echo "ENCARGS_ogg=\"${ENCARGS_ogg}\"" >> "${CONFIG}" | 220 | echo "ENCARGS_ogg=\"${ENCARGS_ogg}\"" >> "${CONFIG}" |
| 218 | echo "ENCARGS_wav=\"${ENCARGS_wav}\"" >> "${CONFIG}" | 221 | echo "ENCARGS_wav=\"${ENCARGS_wav}\"" >> "${CONFIG}" |
| 222 | echo "ENCA_ARGS=\"${ENCA_ARGS}\"" >> "${CONFIG}" | ||
| 219 | $msg "${cP}Configuration saved$cZ\n" | 223 | $msg "${cP}Configuration saved$cZ\n" |
| 220 | fi | 224 | fi |
| 221 | 225 | ||
| @@ -322,6 +326,11 @@ split_file () { · 100 unmodified lines | |||
| 322 | 326 | ||
| 323 | CUESHEET=$(iconv -f "${CHARSET}" -t utf-8 "${CUE}" 2>/dev/null) | 327 | CUESHEET=$(iconv -f "${CHARSET}" -t utf-8 "${CUE}" 2>/dev/null) |
| 324 | 328 | ||
| 329 | # try to guess the charset using enca | ||
| 330 | if [ $? -ne 0 ]; then | ||
| 331 | CUESHEET=$(enconv ${ENCA_ARGS} -x utf8 < "${CUE}" 2>/dev/null) | ||
| 332 | fi | ||
| 333 | |||
| 325 | if [ $? -ne 0 ]; then | 334 | if [ $? -ne 0 ]; then |
| 326 | [ "${CHARSET}" = "utf-8" ] \ | 335 | [ "${CHARSET}" = "utf-8" ] \ |
| 327 | && emsg "Cue sheet is not utf-8\n" \ | 336 | && emsg "Cue sheet is not utf-8\n" \ |
| @@ -345,14 +354,13 @@ split_file () { · 17 unmodified lines | |||
| 345 | fi | 354 | fi |
| 346 | fi | 355 | fi |
| 347 | 356 | ||
| 348 | if [ -n "${CHARSET}" -a "${CHARSET}" != "utf-8" ]; then | 357 | # save converted cue sheet |
| 349 | CUE="${TMPCUE}" | 358 | CUE="${TMPCUE}" |
| 350 | echo "${CUESHEET}" > "${CUE}" | 359 | echo "${CUESHEET}" > "${CUE}" |
| 351 | 360 | ||
| 352 | if [ $? -ne 0 ]; then | 361 | if [ $? -ne 0 ]; then |
| 353 | emsg "Unable to save converted cue sheet\n" | 362 | emsg "Unable to save converted cue sheet\n" |
| 354 | return 1 | 363 | return 1 |
| 355 | fi | ||
| 356 | fi | 364 | fi |
| 357 | 365 | ||
| 358 | SDIR=$(dirname "${FILE}") | 366 | SDIR=$(dirname "${FILE}") |