/usr/share/perl5/URI/Title/MP3.pm is in liburi-title-perl 1.900-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | package URI::Title::MP3;
$URI::Title::MP3::VERSION = '1.900';
use warnings;
use strict;
use MP3::Info;
use File::Temp qw(tempfile);
sub types {(
'audio/mp3',
)}
sub _get_tag {
my $data = shift;
my (undef, $temp) = tempfile();
open FILE, ">$temp" or die $!;
print FILE $data;
close FILE;
my $tag = get_mp3tag($temp);
if ($tag) {
my $info = get_mp3info($temp);
$tag->{info} = $info;
}
unlink($temp);
return $tag;
}
sub title {
my ($class, $url, $data, $type) = @_;
my $tag;
if (-f $url) {
$tag = get_mp3tag($url);
if ($tag) {
my $info = get_mp3info($url);
$tag->{info} = $info;
}
} else {
$tag = _get_tag( $data . URI::Title::_get_end($url) );
}
return unless $tag;
return unless ($tag->{ARTIST} or $tag->{TITLE});
$tag->{ARTIST} ||= "Unknown Artist";
$tag->{TITLE} ||= "Unknown Title";
my $title = "$tag->{ARTIST} - $tag->{TITLE}";
if (my $total = $tag->{info}{SECS} and -f $url) {
my $m = $total / 60;
my $s = $total % 60;
$title .= sprintf(" (%d:%02d)", $m, $s);
}
return $title;
}
1;
__END__
=for Pod::Coverage::TrustPod types title
=head1 NAME
URI::Title::MP3 - get titles of MP3 files
=cut
|