1MusicBrainz::DiscID(3)User Contributed Perl DocumentationMusicBrainz::DiscID(3)
2
3
4
6 MusicBrainz::DiscID - Perl interface for the MusicBrainz libdiscid
7 library
8
10 use MusicBrainz::DiscID;
11
12 my $discid = MusicBrainz::DiscID->new();
13 if ( $disc->read() == 0 ) {
14 print STDERR "Error: " . $discid->error_msg() . "\n";
15 exit(1);
16 }
17 print "DiscID: " . $discid->id() . "\n";
18
20 MusicBrainz::DiscID is a class to calculate a MusicBrainz DiscID from
21 an audio CD in the drive. The coding style is slightly different to the
22 C interface to libdiscid, because it makes use of perl's Object
23 Oriented functionality.
24
25 MusicBrainz::DiscID::default_device()
26 Returns a device string for the default device for this platform.
27
28 MusicBrainz::DiscID::new( [$device] )
29 Construct a new DiscID object.
30
31 As an optional argument the name of the device to read the ID from
32 may be given. If you don't specify a device here you can later read
33 the ID with the read method.
34
35 $discid->error_msg()
36 Return a human-readable error message of the last error that
37 occured.
38
39 $discid->first_track_num()
40 Return the number of the first track on this disc (usually 1).
41 Returns undef if no ID was yet read.
42
43 $discid->last_track_num()
44 Return the number of the last track on this disc.
45
46 $discid->id()
47 Returns the DiscID as a string. Returns undef if no ID was yet
48 read.
49
50 $discid->last_track_num()
51 Return the number of the last track on this disc. Returns undef if
52 no ID was yet read.
53
54 $discid->put( $first_track, $sectors, $offset1, $offset2, ... )
55 This function may be used if the TOC has been read earlier and you
56 want to calculate the disc ID afterwards, without accessing the
57 disc drive.
58
59 $discid->read( [$device] )
60 Read the disc ID from the given device. If no device is given the
61 default device of the platform will be used. On error, this
62 function returns false and sets the error message which you can
63 access $discid->error_msg().
64
65 $discid->sectors()
66 Return the length of the disc in sectors. Returns undef if no ID
67 was yet read.
68
69 $discid->submission_url()
70 Returns a submission URL for the DiscID as a string. Returns undef
71 if no ID was yet read.
72
73 $discid->track_length( $track_num )
74 Return the length of a track in sectors.
75
76 $discid->track_offset( $track_num )
77 Return the sector offset of a track.
78
80 <http://musicbrainz.org/doc/libdiscid>
81
83 Nicholas J. Humfrey <njh@aelius.com>
84
86 The MIT License (MIT)
87
88 Copyright (c) 2009-2019 Nicholas J Humfrey
89
90 Permission is hereby granted, free of charge, to any person obtaining a
91 copy of this software and associated documentation files (the
92 "Software"), to deal in the Software without restriction, including
93 without limitation the rights to use, copy, modify, merge, publish,
94 distribute, sublicense, and/or sell copies of the Software, and to
95 permit persons to whom the Software is furnished to do so, subject to
96 the following conditions:
97
98 The above copyright notice and this permission notice shall be included
99 in all copies or substantial portions of the Software.
100
101 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
102 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
103 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
104 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
105 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
106 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
107 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108
109
110
111perl v5.38.0 2023-07-21 MusicBrainz::DiscID(3)