README
1NAME
2 Template::Plugin::MP3 - Interface to the MP3::Info Module
3
4SYNOPSIS
5 [% USE mp3 = MP3("Montana.mp3") %]
6
7 [% mp3.title %]
8 [% mp3.album %]
9
10 # perldoc MP3::Info for more ideas
11
12DESCRIPTION
13 "Template::Plugin::MP3" provides a simple wrapper for using "MP3::Info"
14 in object oriented mode; see the MP3::Info manpage for more details.
15
16CONSTRUCTOR and CONFIGURATION
17 "Template::Plugin::MP3" takes a filename as its primary argument:
18
19 [% USE MP3("Tryin_To_Grow_A_Chin.mp3") %]
20
21 Optional configuration info can also be specified in the constructor:
22
23 [% USE MP3("Camarillo_Brillo.mp3", utf8 => 1, dir => "/mp3") %]
24
25 The name of the file can also be specified as a named parameter
26 ("name"):
27
28 [% USE MP3(name => "A_Token_Of_My_Extreme.mp3", dir => "/mp3") %]
29
30 "Template::Plugin::MP3" understands the following options:
31
32 name The name of the MP3 file. Note that if both a positional
33 argument and a "name" parameter are passed the positional
34 argument will take precedence.
35
36 dir Specify a base directory name; will be prepended to the
37 filename, if it is defined.
38
39 utf8 Determines whether results should be returned in UTF-8, as
40 handled by "MP3::Info"'s use_mp3_utf8() function. See the
41 use_mp3_utf8 entry in the MP3::Info manpage. Note that this
42 requires Unicode::String.
43
44 If the constructor cannot create an instance using the filename passed,
45 a "plugin.mp3" Exception is thrown, which will need to be caught
46 appropriately:
47
48 [% TRY %]
49 [% USE mp3 = MP3("Willie The Pimp.mp3") %]
50 [% CATCH plugin.mp3 %]
51 Can't find that MP3; are you sure you spelled it right?
52 [% CATCH %]
53 Unexpected exception: [% error %]
54 [% END %]
55
56METHODS
57 "Template::Plugin::MP3" provides the following, mostly intuitive,
58 methods:
59
60 file Name of the file.
61
62 artist Name of the artist.
63
64 album Name of the album.
65
66 bitrate Bitrate at which the mp3 was encoded.
67
68 size Size of the file, in bytes.
69
70 time, secs, mm, ss, ms
71 Length of the song, in various permutations. For
72 example:
73
74 time 03:37
75
76 secs 217.0253125
77
78 mm 3
79
80 ss 27
81
82 ms 25.3125000000125
83
84 genre Genre of the MP3.
85
86 tagversion Full name of the version of the MP3 tag, e.g. "ID3v1.1"
87
88 version Version of the MP3 tag: 1 or 2
89
90 "MP3::Info" defines some other fields that I don't grok; try
91
92 [% MP3.Dump %]
93
94 to see them all.
95
96 Of course, all of the above methods don't return the advertised value if
97 the tag being read does not contain useful information.
98
99OTHER STUFF
100 "Template::Plugin::MP3" provides access to the @mp3_genres and
101 @winamp_genres arrays via the mp3_genres() and winamp_genres() class
102 methods, or collectively through the genres() class method:
103
104 [% FOREACH genre = MP3.genres %]
105 * [% genre;
106 END %]
107
108AUTHORS
109 darren chamberlain <darren@cpan.org>
110
111 Doug Gorley <douggorley@shaw.ca>
112
113COPYRIGHT
114 (C) 2003 darren chamberlain
115
116 This library is free software; you may distribute it and/or modify it
117 under the same terms as Perl itself.
118
119SEE ALSO
120 the Template::Plugin manpage, the MP3::Info manpage
121
122