Unified · Split
| @@ -49,6 +49,8 @@ FORMAT="${0##*split2}" · 48 unmodified lines | |||
| 49 | FORMAT="${FORMAT%.sh}" | 49 | FORMAT="${FORMAT%.sh}" |
| 50 | DIR="." | 50 | DIR="." |
| 51 | OUTPATTERN="@artist/{@year - }@album/@track - @title.@ext" | 51 | OUTPATTERN="@artist/{@year - }@album/@track - @title.@ext" |
| 52 | COPYMASKS="Covers,covers,*.log,*.txt,*.jpg,*.cbr" | ||
| 53 | COPYFILES=1 | ||
| 52 | 54 | ||
| 53 | # codecs default arguments | 55 | # codecs default arguments |
| 54 | ENCARGS_flac="-8" | 56 | ENCARGS_flac="-8" |
| @@ -66,7 +68,7 @@ unset PIC INPATH CUE CHARSET · 11 unmodified lines | |||
| 66 | FORCE=0 | 68 | FORCE=0 |
| 67 | 69 | ||
| 68 | # do not forget to update before commit | 70 | # do not forget to update before commit |
| 69 | VERSION=95 | 71 | VERSION=96 |
| 70 | 72 | ||
| 71 | HELP="\${cG}split2flac version: ${VERSION} | 73 | HELP="\${cG}split2flac version: ${VERSION} |
| 72 | 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. | 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. |
| @@ -84,6 +86,8 @@ Usage: \${cZ}split2\${FORMAT}.sh [\${cU}OPTIONS\$cZ] \${cU}FILE\$cZ [\${cU}OPTIO · 11 unmodified lines | |||
| 84 | \$cG-eh\$cZ - show help for current encoder and exit\$cZ | 86 | \$cG-eh\$cZ - show help for current encoder and exit\$cZ |
| 85 | \$cG-c \${cU}FILE\$cZ \$cR*\$cZ - use file as a cover image (does not work with \${cU}DIR\$cZ) | 87 | \$cG-c \${cU}FILE\$cZ \$cR*\$cZ - use file as a cover image (does not work with \${cU}DIR\$cZ) |
| 86 | \$cG-nc \${cR}*\$cZ - do not set any cover images | 88 | \$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) | ||
| 90 | \$cG-nC \${cR}*\$cZ - do not copy any files | ||
| 87 | \$cG-cs \${cU}WxH\$cZ \$cR*\$cZ - set cover image size (current is \$cP\${PIC_SIZE}\$cZ) | 91 | \$cG-cs \${cU}WxH\$cZ \$cR*\$cZ - set cover image size (current is \$cP\${PIC_SIZE}\$cZ) |
| 88 | \$cG-d \$cR*\$cZ - create artist/album subdirs (default) | 92 | \$cG-d \$cR*\$cZ - create artist/album subdirs (default) |
| 89 | \$cG-nd \$cR*\$cZ - do not create any subdirs | 93 | \$cG-nd \$cR*\$cZ - do not create any subdirs |
| @@ -150,6 +154,8 @@ while [ "$1" ]; do · 60 unmodified lines | |||
| 150 | -eh) ENCHELP=1;; | 154 | -eh) ENCHELP=1;; |
| 151 | -c) NOPIC=0; PIC=$2; shift;; | 155 | -c) NOPIC=0; PIC=$2; shift;; |
| 152 | -nc) NOPIC=1;; | 156 | -nc) NOPIC=1;; |
| 157 | -C) COPYMASKS="$1"; COPYFILES=1; shift;; | ||
| 158 | -nC) COPYFILES=0;; | ||
| 153 | -cs) PIC_SIZE=$2; shift;; | 159 | -cs) PIC_SIZE=$2; shift;; |
| 154 | -d) NOSUBDIRS=0;; | 160 | -d) NOSUBDIRS=0;; |
| 155 | -nd) NOSUBDIRS=1;; | 161 | -nd) NOSUBDIRS=1;; |
| @@ -186,6 +192,8 @@ eval "export ENCARGS_${FORMAT}=\"${ENCARGS}\"" · 30 unmodified lines | |||
| 186 | if [ ${SAVE} -eq 1 ]; then | 192 | if [ ${SAVE} -eq 1 ]; then |
| 187 | echo "DIR=\"${DIR}\"" > "${CONFIG}" | 193 | echo "DIR=\"${DIR}\"" > "${CONFIG}" |
| 188 | echo "OUTPATTERN=\"${OUTPATTERN}\"" >> "${CONFIG}" | 194 | echo "OUTPATTERN=\"${OUTPATTERN}\"" >> "${CONFIG}" |
| 195 | echo "COPYMASKS=\"${COPYMASKS}\"" >> "${CONFIG}" | ||
| 196 | echo "COPYFILES=${COPYFILES}" >> "${CONFIG}" | ||
| 189 | echo "NOSUBDIRS=${NOSUBDIRS}" >> "${CONFIG}" | 197 | echo "NOSUBDIRS=${NOSUBDIRS}" >> "${CONFIG}" |
| 190 | echo "NOPIC=${NOPIC}" >> "${CONFIG}" | 198 | echo "NOPIC=${NOPIC}" >> "${CONFIG}" |
| 191 | echo "REMOVE=${REMOVE}" >> "${CONFIG}" | 199 | echo "REMOVE=${REMOVE}" >> "${CONFIG}" |
| @@ -335,13 +343,13 @@ split_file () { · 143 unmodified lines | |||
| 335 | fi | 343 | fi |
| 336 | fi | 344 | fi |
| 337 | 345 | ||
| 346 | SDIR=$(dirname "${FILE}") | ||
| 347 | |||
| 338 | # search for a front cover image | 348 | # search for a front cover image |
| 339 | if [ ${NOPIC} -eq 1 ]; then | 349 | if [ ${NOPIC} -eq 1 ]; then |
| 340 | unset PIC | 350 | unset PIC |
| 341 | elif [ -z "${PIC}" ]; then | 351 | elif [ -z "${PIC}" ]; then |
| 342 | # try common names | 352 | # try common names |
| 343 | SDIR=$(dirname "${FILE}") | ||
| 344 | |||
| 345 | for i in cover.jpg front_cover.jpg folder.jpg; do | 353 | for i in cover.jpg front_cover.jpg folder.jpg; do |
| 346 | if [ -r "${SDIR}/$i" ]; then | 354 | if [ -r "${SDIR}/$i" ]; then |
| 347 | PIC="${SDIR}/$i" | 355 | PIC="${SDIR}/$i" |
| @@ -371,6 +379,11 @@ split_file () { · 23 unmodified lines | |||
| 371 | || $msg "$msg_removal if user says 'y'$cZ\n" | 379 | || $msg "$msg_removal if user says 'y'$cZ\n" |
| 372 | fi | 380 | fi |
| 373 | 381 | ||
| 382 | # files to copy over | ||
| 383 | if [ ${COPYFILES} -eq 1 -a "${COPYMASKS}" ]; then | ||
| 384 | $msg "${cG}Copy over :$cZ ${COPYMASKS}\n" | ||
| 385 | fi | ||
| 386 | |||
| 374 | # get common tags | 387 | # get common tags |
| 375 | TAG_ARTIST=$(${GETTAG} %P "${CUE}" 2>/dev/null) | 388 | TAG_ARTIST=$(${GETTAG} %P "${CUE}" 2>/dev/null) |
| 376 | TAG_ALBUM=$(${GETTAG} %T "${CUE}" 2>/dev/null) | 389 | TAG_ALBUM=$(${GETTAG} %T "${CUE}" 2>/dev/null) |
| @@ -595,6 +608,22 @@ split_file () { · 218 unmodified lines | |||
| 595 | fi | 608 | fi |
| 596 | fi | 609 | fi |
| 597 | 610 | ||
| 611 | # copy files | ||
| 612 | if [ ${COPYFILES} -eq 1 -a "${COPYMASKS}" ]; then | ||
| 613 | old=`pwd` | ||
| 614 | cd "${SDIR}" | ||
| 615 | $msg "\n${cG}Copying files:$cZ\n" | ||
| 616 | eval "for i in {${COPYMASKS}}; do \ | ||
| 617 | test -r \"\$i\" && \ | ||
| 618 | echo \" +> \$i\" 2>/dev/null; done" | ||
| 619 | if [ ${DRY} -ne 1 ]; then | ||
| 620 | eval "for i in {${COPYMASKS}}; do \ | ||
| 621 | test -r \"\$i\" && \ | ||
| 622 | cp -r \"\$i\" \"\${OUT}/\"; done" | ||
| 623 | fi | ||
| 624 | cd "${old}" | ||
| 625 | fi | ||
| 626 | |||
| 598 | rm -f "${TMPPIC}" | 627 | rm -f "${TMPPIC}" |
| 599 | rm -f "${TMPCUE}" | 628 | rm -f "${TMPCUE}" |
| 600 | 629 | ||