Showing the changes to split2flac (1 of 1 file). Show all
Unified · Split
| @@ -67,7 +67,7 @@ unset PIC INPATH CUE CHARSET · 66 unmodified lines | |||
| 67 | FORCE=0 | 67 | FORCE=0 |
| 68 | 68 | ||
| 69 | # do not forget to update before commit | 69 | # do not forget to update before commit |
| 70 | VERSION=111 | 70 | VERSION=112 |
| 71 | 71 | ||
| 72 | HELP="\${cG}split2flac version: ${VERSION} | 72 | HELP="\${cG}split2flac version: ${VERSION} |
| 73 | 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. | 73 | 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. |
| @@ -108,6 +108,8 @@ Usage: \${cZ}split2\${FORMAT} [\${cU}OPTIONS\$cZ] \${cU}FILE\$cZ [\${cU}OPTIONS\ · 34 unmodified lines | |||
| 108 | Supported tags for \$cU\${cG}PATTERN\${cZ}: @artist, @album, @year, @track, @performer, @title, @genre, @ext. | 108 | Supported tags for \$cU\${cG}PATTERN\${cZ}: @artist, @album, @year, @track, @performer, @title, @genre, @ext. |
| 109 | @performer tag is useful with 'various artists' albums, when you want to add | 109 | @performer tag is useful with 'various artists' albums, when you want to add |
| 110 | each artist's name to the track filename. It works as @artist if track performer is undefined. | 110 | each artist's name to the track filename. It works as @artist if track performer is undefined. |
| 111 | Special \"underscored\" tags are also supported (@_artist, @_album, etc). If used, spaces will be replaced with | ||
| 112 | underscores. It's useful if you want to have filenames without spaces. | ||
| 111 | 113 | ||
| 112 | It's better to pass \$cP'-p'\$cZ option to see what will happen when actually splitting tracks. | 114 | It's better to pass \$cP'-p'\$cZ option to see what will happen when actually splitting tracks. |
| 113 | You may want to pass \$cP'-s'\$cZ option for the first run to save default configuration | 115 | You may want to pass \$cP'-s'\$cZ option for the first run to save default configuration |
| @@ -251,15 +253,26 @@ fi · 137 unmodified lines | |||
| 251 | 253 | ||
| 252 | $msg "${cG}Output dir :$cZ ${DIR:?Output directory was not set}\n" | 254 | $msg "${cG}Output dir :$cZ ${DIR:?Output directory was not set}\n" |
| 253 | 255 | ||
| 256 | # replaces a tag name with the value of the tag. $1=pattern $2=tag_name $3=tag_value | ||
| 257 | update_pattern_aux () { | ||
| 258 | tag_name="$2" | ||
| 259 | tag_value="$3" | ||
| 260 | expr_match="@${tag_name}" | ||
| 261 | expr_match_opt="[{]${expr_match}\([^}]*\)[}]" | ||
| 262 | |||
| 263 | echo "$1" | { [ "${tag_value}" ] \ | ||
| 264 | && sed "s/${expr_match_opt}/${tag_value}\1/g;s/${expr_match}/${tag_value}/g" \ | ||
| 265 | || sed "s/${expr_match_opt}//g;s/${expr_match}//g"; } | ||
| 266 | } | ||
| 267 | |||
| 254 | # replaces a tag name with the value of the tag. $1=pattern $2=tag_name $3=tag_value | 268 | # replaces a tag name with the value of the tag. $1=pattern $2=tag_name $3=tag_value |
| 255 | update_pattern () { | 269 | update_pattern () { |
| 256 | # replace '/' with '\' and '&' with '\&' for proper sed call | 270 | # replace '/' with '\' and '&' with '\&' for proper sed call |
| 257 | tag_name=$(echo "$2" | sed 's,/,\\\\,g;s,&,\\&,g') | 271 | tag_name=$(echo "$2" | sed 's,/,\\\\,g;s,&,\\&,g') |
| 258 | tag_value=$(echo "$3" | sed 's,/,\\\\,g;s,&,\\&,g') | 272 | tag_value=$(echo "$3" | sed 's,/,\\\\,g;s,&,\\&,g') |
| 259 | 273 | ||
| 260 | echo "$1" | { [ "$3" ] \ | 274 | v=$(update_pattern_aux "$1" "${tag_name}" "${tag_value}") |
| 261 | && sed "s/[{]@${tag_name}\([^}]*\)[}]/${tag_value}\1/g;s/@${tag_name}/${tag_value}/g" \ | 275 | update_pattern_aux "$v" "_${tag_name}" $(echo "${tag_value}" | sed "s/ /_/g") |
| 262 | || sed "s/[{]@${tag_name}\([^}]*\)[}]//g;s/@${tag_name}//g"; } | ||
| 263 | } | 276 | } |
| 264 | 277 | ||
| 265 | # splits a file | 278 | # splits a file |