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