| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package URI::Title::MP3; |
|
2
|
|
|
|
|
|
|
$URI::Title::MP3::VERSION = '1.902'; |
|
3
|
2
|
|
|
2
|
|
1439
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
58
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
33
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1320
|
use MP3::Info; |
|
|
2
|
|
|
|
|
77295
|
|
|
|
2
|
|
|
|
|
259
|
|
|
7
|
2
|
|
|
2
|
|
1321
|
use File::Temp qw(tempfile); |
|
|
2
|
|
|
|
|
18444
|
|
|
|
2
|
|
|
|
|
890
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub types {( |
|
10
|
2
|
|
|
2
|
0
|
4
|
'audio/mp3', |
|
11
|
|
|
|
|
|
|
)} |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _get_tag { |
|
14
|
0
|
|
|
0
|
|
|
my $data = shift; |
|
15
|
0
|
|
|
|
|
|
my (undef, $temp) = tempfile(); |
|
16
|
0
|
0
|
|
|
|
|
open FILE, ">$temp" or die $!; |
|
17
|
0
|
|
|
|
|
|
print FILE $data; |
|
18
|
0
|
|
|
|
|
|
close FILE; |
|
19
|
0
|
|
|
|
|
|
my $tag = get_mp3tag($temp); |
|
20
|
0
|
0
|
|
|
|
|
if ($tag) { |
|
21
|
0
|
|
|
|
|
|
my $info = get_mp3info($temp); |
|
22
|
0
|
|
|
|
|
|
$tag->{info} = $info; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
0
|
|
|
|
|
|
unlink($temp); |
|
25
|
0
|
|
|
|
|
|
return $tag; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub title { |
|
29
|
0
|
|
|
0
|
0
|
|
my ($class, $url, $data, $type) = @_; |
|
30
|
0
|
|
|
|
|
|
my $tag; |
|
31
|
0
|
0
|
|
|
|
|
if (-f $url) { |
|
32
|
0
|
|
|
|
|
|
$tag = get_mp3tag($url); |
|
33
|
0
|
0
|
|
|
|
|
if ($tag) { |
|
34
|
0
|
|
|
|
|
|
my $info = get_mp3info($url); |
|
35
|
0
|
|
|
|
|
|
$tag->{info} = $info; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} else { |
|
39
|
0
|
|
|
|
|
|
$tag = _get_tag( $data . URI::Title::_get_end($url) ); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
0
|
0
|
|
|
|
|
return unless $tag; |
|
42
|
0
|
0
|
0
|
|
|
|
return unless ($tag->{ARTIST} or $tag->{TITLE}); |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
0
|
|
|
|
$tag->{ARTIST} ||= "Unknown Artist"; |
|
45
|
0
|
|
0
|
|
|
|
$tag->{TITLE} ||= "Unknown Title"; |
|
46
|
0
|
|
|
|
|
|
my $title = "$tag->{ARTIST} - $tag->{TITLE}"; |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
0
|
0
|
|
|
|
if (my $total = $tag->{info}{SECS} and -f $url) { |
|
49
|
0
|
|
|
|
|
|
my $m = $total / 60; |
|
50
|
0
|
|
|
|
|
|
my $s = $total % 60; |
|
51
|
0
|
|
|
|
|
|
$title .= sprintf(" (%d:%02d)", $m, $s); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $title; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |