line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: /mirror/perl/File-Extract/trunk/lib/File/Extract/MP3.pm 4210 2007-10-27T13:43:07.499967Z daisuke $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2005 Daisuke Maki |
4
|
|
|
|
|
|
|
# All rights reserved. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package File::Extract::MP3; |
7
|
2
|
|
|
2
|
|
16
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
104
|
|
8
|
2
|
|
|
2
|
|
14
|
use base qw(File::Extract::Base); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
213
|
|
9
|
2
|
|
|
2
|
|
2702
|
use MP3::Info qw(get_mp3tag); |
|
2
|
|
|
|
|
42028
|
|
|
2
|
|
|
|
|
670
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
1
|
7
|
sub mime_type { 'audio/mpeg' } |
12
|
|
|
|
|
|
|
sub extract |
13
|
|
|
|
|
|
|
{ |
14
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
15
|
0
|
|
|
|
|
|
my $file = shift; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $hash = get_mp3tag($file); |
18
|
0
|
|
|
|
|
|
my %p; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
while (my($field, $value) = each %$hash) { |
21
|
0
|
0
|
|
|
|
|
next unless $value; |
22
|
0
|
|
|
|
|
|
$p{lc $field} = $value; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $r = File::Extract::Result->new( |
26
|
|
|
|
|
|
|
metadata => %p, |
27
|
|
|
|
|
|
|
filename => $file, |
28
|
|
|
|
|
|
|
mime_type => $self->mime_type, |
29
|
|
|
|
|
|
|
); |
30
|
0
|
|
|
|
|
|
return $r; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |