- Timestamp:
- 09/19/14 22:37:22 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/flactrack
r13 r15 15 15 use Audio::FLAC::Header; 16 16 use MusicBrainz; 17 use Text::Unidecode; 17 18 18 19 GetOptions( … … 22 23 'all|a' => \my $ALL, 23 24 'dir|d=s' => \my $DIRECTORY, 25 'ascii-tags' => \my $ASCII_TAGS, 24 26 ); 25 27 … … 41 43 require Config::Properties; 42 44 43 my $properties = Config::Properties->new(file => $properties_file); 45 # the properties are in UTF-8; mark them as such so unidecode works correctly later 46 my $properties = Config::Properties->new(file => $properties_file, encoding => 'utf8'); 44 47 $info = $properties->getProperties; 45 48 } else { … … 103 106 if ($info) { 104 107 my $track_key = sprintf 'TRACK%02d', $tracknum; 105 $cmd .= sprintf q{ --tt %s --ta %s --tl %s --tn %d}, 106 quote($info->{"$track_key.TITLE"}), 107 quote($info->{"$track_key.ARTIST"}), 108 quote($info->{ALBUM}), 108 $cmd .= sprintf q{ --tt %s --ta %s --tl %s --ty %d --tn %d}, 109 quote($ASCII_TAGS ? unidecode($info->{"$track_key.TITLE"}) : $info->{"$track_key.TITLE"}), 110 quote($ASCII_TAGS ? unidecode($info->{"$track_key.ARTIST"}) : $info->{"$track_key.ARTIST"}), 111 quote($ASCII_TAGS ? unidecode($info->{ALBUM}) : $info->{ALBUM}), 112 ($info->{ORIGINALDATE} =~ /^(\d\d\d\d)/)[0], 109 113 $tracknum; 110 114 } … … 130 134 sub to_filename { 131 135 my @strings = @_; 132 #TODO: deal with non-ascii characters (unidecode) e.g. ü --> ue133 136 return map { 134 137 s/&/ and /g; 138 unidecode($_); 135 139 s/[^a-z0-9-_ ]+//gi; 136 140 s/ +/_/g;
Note: See TracChangeset
for help on using the changeset viewer.