Changeset 40 in mp3-find for trunk/lib/MP3/Find/Util.pm
- Timestamp:
- 06/07/11 23:10:52 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/MP3/Find/Util.pm
r39 r40 51 51 my $mp3 = { 52 52 FILENAME => $filename, 53 # ID3v2 tags, if present, override ID3v1 tags 54 %{ get_mp3tag($filename, 0, 2) || {} }, 55 %{ get_mp3info($filename) || {} }, 53 %{ get_mp3tag($filename) || {} }, 54 %{ get_mp3info($filename) || {} }, 56 55 }; 56 57 if ($CAN_USE_ID3V2 and $args->{use_id3v2}) { 58 # add ID3v2 tag info, if present 59 my $mp3_tags = MP3::Tag->new($filename); 60 unless (defined $mp3_tags) { 61 warn "Can't get MP3::Tag object for $filename\n"; 62 } else { 63 $mp3_tags->get_tags; 64 if (my $id3v2 = $mp3_tags->{ID3v2}) { 65 for my $frame_id (keys %{ $id3v2->get_frame_ids }) { 66 my ($info) = $id3v2->get_frame($frame_id); 67 if (ref $info eq 'HASH') { 68 # use the "Text" value as the value for this frame, if present 69 $mp3->{$frame_id} = $info->{Text} if exists $info->{Text}; 70 } else { 71 $mp3->{$frame_id} = $info; 72 } 73 } 74 } 75 } 76 } 57 77 58 78 return $mp3;
Note: See TracChangeset
for help on using the changeset viewer.