Changeset 28 in mp3-find for trunk/lib/MP3/Find/Filesystem.pm
- Timestamp:
- 04/29/06 20:44:39 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/MP3/Find/Filesystem.pm
r25 r28 17 17 my $USE_SORT_KEY = $@ ? 0 : 1; 18 18 19 20 eval { require MP3::Tag }; 21 my $CAN_USE_ID3V2 = $@ ? 0 : 1; 22 19 23 use_winamp_genres(); 20 24 … … 47 51 } 48 52 53 if ($$options{use_id3v2} and not $CAN_USE_ID3V2) { 54 # they want to use ID3v2, but don't have MP3::Tag 55 warn "MP3::Tag is required to search ID3v2 tags\n"; 56 } 57 49 58 # run the actual find 50 59 my @results; … … 95 104 }; 96 105 97 if ($ $options{use_id3v2}) {98 eval { require MP3::Tag };99 if ($@) {100 # we weren't able to load MP3::Tag!101 warn " MP3::Tag is required to search ID3v2 tags";106 if ($CAN_USE_ID3V2 and $$options{use_id3v2}) { 107 # add ID3v2 tag info, if present 108 my $mp3_tags = MP3::Tag->new($filename); 109 unless (defined $mp3_tags) { 110 warn "Can't get MP3::Tag object for $filename\n"; 102 111 } else { 103 # add ID3v2 tag info, if present104 my $mp3_tags = MP3::Tag->new($filename);105 112 $mp3_tags->get_tags; 106 113 if (my $id3v2 = $mp3_tags->{ID3v2}) { … … 108 115 my ($info) = $id3v2->get_frame($frame_id); 109 116 if (ref $info eq 'HASH') { 110 #TODO: how should we handle these? 117 # use the "Text" value as the value for this frame, if present 118 $mp3->{$frame_id} = $info->{Text} if exists $info->{Text}; 111 119 } else { 112 120 $mp3->{$frame_id} = $info;
Note: See TracChangeset
for help on using the changeset viewer.