Unified · Split
| @@ -79,8 +79,8 @@ Usage: \${cZ}split2\${FORMAT}.sh [\${cU}OPTIONS\$cZ] \${cU}FILE\$cZ [\${cU}OPTIO · 78 unmodified lines | ||
| 79 | 79 | It's better to pass \$cP'-p'\$cZ option to see what will happen when actually splitting tracks. |
| 80 | 80 | You may want to pass \$cP'-s'\$cZ option for the first run to save default configuration |
| 81 | 81 | (output dir, cover image size, etc.) so you won't need to pass a lot of options |
| 82 | −every time, just a filename. | |
| 83 | −Script will try to find CUE sheet if it wasn't specified. It also supports internal CUE sheets." | |
| 82 | +every time, just a filename. Script will try to find CUE sheet if it wasn't specified. | |
| 83 | +It also supports internal CUE sheets (FLAC and WV)." | |
| 84 | 84 | |
| 85 | 85 | msg="echo -e" |
| 86 | 86 | |
| @@ -127,7 +127,7 @@ while [ "$1" ]; do · 40 unmodified lines | ||
| 127 | 127 | -h|--help|-help) eval "$msg \"${HELP}\""; exit 0;; |
| 128 | 128 | -*) eval "$msg \"${HELP}\""; emsg "\nUnknown option $1"; exit 1;; |
| 129 | 129 | *) |
| 130 | − if [ -n "${INPATH}" ]; then | |
| 130 | + if [ "${INPATH}" ]; then | |
| 131 | 131 | eval "$msg \"${HELP}\"" |
| 132 | 132 | emsg "\nUnknown option $1" |
| 133 | 133 | exit 1 |
| @@ -193,6 +193,7 @@ split_file ( ) { · 59 unmodified lines | ||
| 193 | 193 | fi |
| 194 | 194 | |
| 195 | 195 | if [ "${CUESHEET}" ]; then |
| 196 | + $msg "${cP}Found internal cue sheet$cZ" | |
| 196 | 197 | CUE="${TMPCUE}" |
| 197 | 198 | echo "${CUESHEET}" > "${CUE}" |
| 198 | 199 | |
| @@ -213,7 +214,7 @@ split_file ( ) { · 14 unmodified lines | ||
| 213 | 214 | return 1 |
| 214 | 215 | fi |
| 215 | 216 | |
| 216 | − if [ -n "${CHARSET}" ]; then | |
| 217 | + if [ "${CHARSET}" ]; then | |
| 217 | 218 | $msg "${cG}Cue charset : $cP${CHARSET} -> utf-8$cZ" |
| 218 | 219 | CUESHEET=$(iconv -f "${CHARSET}" -t utf-8 "${CUE}" 2>/dev/null) |
| 219 | 220 | if [ $? -ne 0 ]; then |
| @@ -254,6 +255,7 @@ split_file ( ) { · 34 unmodified lines | ||
| 254 | 255 | fi |
| 255 | 256 | fi |
| 256 | 257 | |
| 258 | + $msg "${cG}Cue sheet :$cZ ${CUE}" | |
| 257 | 259 | $msg "${cG}Cover image :$cZ ${PIC:-not set}" |
| 258 | 260 | $msg "${cG}Output dir :$cZ ${DIR:?Output directory was not set}" |
| 259 | 261 | |
| @@ -277,7 +279,7 @@ split_file ( ) { · 17 unmodified lines | ||
| 277 | 279 | |
| 278 | 280 | unset TAG_DATE |
| 279 | 281 | |
| 280 | − if [ -n "${YEAR}" ]; then | |
| 282 | + if [ "${YEAR}" ]; then | |
| 281 | 283 | if [ ${YEAR} -ne 0 ]; then |
| 282 | 284 | TAG_DATE="${YEAR}" |
| 283 | 285 | fi |
| @@ -285,7 +287,7 @@ split_file ( ) { · 1 unmodified line | ||
| 285 | 287 | |
| 286 | 288 | $msg "\n${cG}Artist :$cZ ${TAG_ARTIST}" |
| 287 | 289 | $msg "${cG}Album :$cZ ${TAG_ALBUM}" |
| 288 | − if [ -n "${TAG_DATE}" ]; then | |
| 290 | + if [ "${TAG_DATE}" ]; then | |
| 289 | 291 | $msg "${cG}Year :$cZ ${TAG_DATE}" |
| 290 | 292 | fi |
| 291 | 293 | $msg "${cG}Tracks :$cZ ${TRACKS_NUM}\n" |
| @@ -380,12 +382,12 @@ split_file ( ) { · 88 unmodified lines | ||
| 380 | 382 | "${FINAL}" >/dev/null |
| 381 | 383 | RES=$? |
| 382 | 384 | |
| 383 | − if [ -n "${TAG_DATE}" ]; then | |
| 385 | + if [ "${TAG_DATE}" ]; then | |
| 384 | 386 | ${METAFLAC} --set-tag="DATE=${TAG_DATE}" "${FINAL}" >/dev/null |
| 385 | 387 | RES=$RES$? |
| 386 | 388 | fi |
| 387 | 389 | |
| 388 | − if [ -n "${PIC}" ]; then | |
| 390 | + if [ "${PIC}" ]; then | |
| 389 | 391 | ${METAFLAC} --import-picture-from="${PIC}" "${FINAL}" >/dev/null |
| 390 | 392 | RES=$RES$? |
| 391 | 393 | fi |
| @@ -400,7 +402,7 @@ split_file ( ) { · 8 unmodified lines | ||
| 400 | 402 | "${FINAL}" >/dev/null |
| 401 | 403 | RES=$? |
| 402 | 404 | |
| 403 | − if [ -n "${TAG_DATE}" ]; then | |
| 405 | + if [ "${TAG_DATE}" ]; then | |
| 404 | 406 | ${ID3TAG} -y"${TAG_DATE}" "${FINAL}" >/dev/null |
| 405 | 407 | RES=$RES$? |
| 406 | 408 | fi |
| @@ -414,7 +416,7 @@ split_file ( ) { · 7 unmodified lines | ||
| 414 | 416 | -t "TRACKNUMBER=$i" >/dev/null |
| 415 | 417 | RES=$? |
| 416 | 418 | |
| 417 | − if [ -n "${TAG_DATE}" ]; then | |
| 419 | + if [ "${TAG_DATE}" ]; then | |
| 418 | 420 | ${VORBISCOMMENT} "${FINAL}" -t "DATE=${TAG_DATE}" >/dev/null |
| 419 | 421 | RES=$RES$? |
| 420 | 422 | fi |
| @@ -429,12 +431,12 @@ split_file ( ) { · 8 unmodified lines | ||
| 429 | 431 | -T "${TRACKS_NUM}" >/dev/null |
| 430 | 432 | RES=$? |
| 431 | 433 | |
| 432 | − if [ -n "${TAG_DATE}" ]; then | |
| 434 | + if [ "${TAG_DATE}" ]; then | |
| 433 | 435 | ${MP4TAGS} "${FINAL}" -y "${TAG_DATE}" >/dev/null |
| 434 | 436 | RES=$RES$? |
| 435 | 437 | fi |
| 436 | 438 | |
| 437 | − if [ -n "${PIC}" ]; then | |
| 439 | + if [ "${PIC}" ]; then | |
| 438 | 440 | ${MP4TAGS} "${FINAL}" -P "${PIC}" >/dev/null |
| 439 | 441 | RES=$RES$? |
| 440 | 442 | fi |
| @@ -502,7 +504,7 @@ if [ -d "${INPATH}" ]; then · 61 unmodified lines | ||
| 502 | 504 | fi |
| 503 | 505 | $msg "${cG}Input dir :$cZ ${INPATH}$cZ" |
| 504 | 506 | split_dir "${INPATH}" |
| 505 | −elif [ -n "${INPATH}" ]; then | |
| 507 | +elif [ "${INPATH}" ]; then | |
| 506 | 508 | split_file "${INPATH}" |
| 507 | 509 | else |
| 508 | 510 | emsg "No input filename given. Use -h for help." |