History

option to copy files by masks. fixes issue #15

Serge Zirukin committed 15 years ago

Commit 55c65fd1 parent 24b9db51 file · +32 −3Browse files

Unified · Split

split2flac.sh+32−3
@@ -49,6 +49,8 @@ FORMAT="${0##*split2}" · 48 unmodified lines
49FORMAT="${FORMAT%.sh}"49FORMAT="${FORMAT%.sh}"
50DIR="."50DIR="."
51OUTPATTERN="@artist/{@year - }@album/@track - @title.@ext"51OUTPATTERN="@artist/{@year - }@album/@track - @title.@ext"
52COPYMASKS="Covers,covers,*.log,*.txt,*.jpg,*.cbr"
53COPYFILES=1
52 54
53# codecs default arguments55# codecs default arguments
54ENCARGS_flac="-8"56ENCARGS_flac="-8"
@@ -66,7 +68,7 @@ unset PIC INPATH CUE CHARSET · 11 unmodified lines
66FORCE=068FORCE=0
67 69
68# do not forget to update before commit70# do not forget to update before commit
69VERSION=9571VERSION=96
70 72
71HELP="\${cG}split2flac version: ${VERSION}73HELP="\${cG}split2flac version: ${VERSION}
72Splits 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.74Splits 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\$cZ86 \$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 images88 \$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 subdirs93 \$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
186if [ ${SAVE} -eq 1 ]; then192if [ ${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 fi343 fi
336 fi344 fi
337 345
346 SDIR=$(dirname "${FILE}")
347
338 # search for a front cover image348 # search for a front cover image
339 if [ ${NOPIC} -eq 1 ]; then349 if [ ${NOPIC} -eq 1 ]; then
340 unset PIC350 unset PIC
341 elif [ -z "${PIC}" ]; then351 elif [ -z "${PIC}" ]; then
342 # try common names352 # try common names
343 SDIR=$(dirname "${FILE}")
344
345 for i in cover.jpg front_cover.jpg folder.jpg; do353 for i in cover.jpg front_cover.jpg folder.jpg; do
346 if [ -r "${SDIR}/$i" ]; then354 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 fi380 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 tags387 # 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 fi608 fi
596 fi609 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

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