- Timestamp:
- 05/15/14 21:11:52 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/flactrack
r12 r13 37 37 my $info; 38 38 if ($ALL || $TYPE eq 'mp3') { 39 my $discid = $flac->tags('MBZ_DISCID') or warn "No MBZ_DISCID tag in $FLAC_FILE\n" if $flac; 40 #TODO: calculate TOC and DISCID from cuesheet if there is no MBZ_DISCID tag present 39 (my $properties_file = $FLAC_FILE) =~ s/\.flac$/.properties/; 40 if (-e $properties_file) { 41 require Config::Properties; 41 42 42 $info = get_musicbrainz_info($discid); 43 my $properties = Config::Properties->new(file => $properties_file); 44 $info = $properties->getProperties; 45 } else { 46 47 my $discid = $flac->tags('MBZ_DISCID') or warn "No MBZ_DISCID tag in $FLAC_FILE\n" if $flac; 48 #TODO: calculate TOC and DISCID from cuesheet if there is no MBZ_DISCID tag present 49 50 $info = get_musicbrainz_info($discid); 51 } 43 52 exit unless $info; 44 53 … … 63 72 #TODO: default to just 01, 02, etc. if there is no $info 64 73 %TRACKS = map { 65 $_ => catfile($DIRECTORY, sprintf('%02d.%s', $_, to_filename($info->{ TRACKS}[$_]{TITLE})))74 $_ => catfile($DIRECTORY, sprintf('%02d.%s', $_, to_filename($info->{sprintf 'TRACK%02d.TITLE', $_}))) 66 75 } (1 .. $count); 67 76 #print Dump(\%TRACKS); … … 93 102 # if there is track info, add it as ID3 tags 94 103 if ($info) { 95 my $track = $info->{TRACKS}[$tracknum];104 my $track_key = sprintf 'TRACK%02d', $tracknum; 96 105 $cmd .= sprintf q{ --tt %s --ta %s --tl %s --tn %d}, 97 quote($ track->{TITLE}),98 quote($ track->{ARTIST}),106 quote($info->{"$track_key.TITLE"}), 107 quote($info->{"$track_key.ARTIST"}), 99 108 quote($info->{ALBUM}), 100 109 $tracknum;
Note: See TracChangeset
for help on using the changeset viewer.