.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "FreeDB 3pm" .TH FreeDB 3pm 2024-03-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Net::FreeDB \- Perl interface to freedb server(s) .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 5 \& use Net::FreeDB; \& $freedb = Net::FreeDB\->new(); \& $discdata = $freedb\->getdiscdata(\*(Aq/dev/cdrom\*(Aq); \& my $cddb_file_object = $freedb\->read(\*(Aqrock\*(Aq, $discdata\->{ID}); \& print $cddb_file_object\->id; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" .Vb 6 \& Net::FreeDB was inspired by Net::CDDB. And in\-fact \& was designed as a replacement in\-part by Net::CDDB\*(Aqs \& author Jeremy D. Zawodny. Net::FreeDB allows an \& oop interface to the freedb server(s) as well as \& some basic cdrom functionality like determining \& disc ids, track offsets, etc. .Ve .SS METHODS .IX Subsection "METHODS" .ie n .IP "new(remote_host => $h, remote_port => $p, user => $u, hostname => $hn, timeout => $to)" 4 .el .IP "new(remote_host => \f(CW$h\fR, remote_port => \f(CW$p\fR, user => \f(CW$u\fR, hostname => \f(CW$hn\fR, timeout => \f(CW$to\fR)" 4 .IX Item "new(remote_host => $h, remote_port => $p, user => $u, hostname => $hn, timeout => $to)" .Vb 2 \& Constructor: \& Creates a new Net::FreeDB object. \& \& Parameters: \& Set to username or user\-string you\*(Aqd like to be logged as. Defaults to $ENV{USER} \& \& HOSTNAME: (optional) \& Set to the hostname you\*(Aqd like to be known as. Defaults to $ENV{HOSTNAME} \& \& TIMEOUT: (optional) \& Set to the number of seconds to timeout on freedb server. Defaults to 120 \& \& \& new() creates and returns a new Net::FreeDB object that is connected \& to either the given host or gnudb.gnudb.org as default. .Ve .IP lscat 4 .IX Item "lscat" .Vb 2 \& Returns a list of all available categories on the server. \& Sets $obj\->error on error .Ve .ie n .IP "query($id, $num_trks, $trk_offset1, $trk_offset2, $trk_offset3...)" 4 .el .IP "query($id, \f(CW$num_trks\fR, \f(CW$trk_offset1\fR, \f(CW$trk_offset2\fR, \f(CW$trk_offset3\fR...)" 4 .IX Item "query($id, $num_trks, $trk_offset1, $trk_offset2, $trk_offset3...)" .Vb 1 \& Parameters: \& \& query($$$...) takes: \& 1: a discid \& 2: the number of tracks \& 3: first track offset \& 4: second track offset... etc. \& \& Query expects $num_trks number of extra params after the first two. \& \& query() returns an array of hashes. The hashes looks like: \& \& { \& Category => \*(Aqnewage\*(Aq, \& DiscID => \*(Aqdiscid\*(Aq, \& Artist => \*(Aqartist\*(Aq, \& Album => \*(Aqtitle\*(Aq \& } \& \& Sets $obj\->error on error \& \& NOTE: query() can return \*(Aqinexact\*(Aq matches and/or \*(Aqmultiple exact\*(Aq \& matches. The returned array is the given returned match(es). .Ve .ie n .IP "read($server_category_string, $disc_id)" 4 .el .IP "read($server_category_string, \f(CW$disc_id\fR)" 4 .IX Item "read($server_category_string, $disc_id)" .Vb 1 \& Parameters: \& \& read($$) takes 2 parameters, the first being a server category name. \& This can be any string either that you make up yourself or \& that you believe the disc to be. The second is the disc id. This \& may be generated for the current cd in your drive by calling get_local_disc_id() \& \& Sets $obj\->error on error \& \& NOTE: \& Using an incorrect category will result in either no return or an \& incorrect return. Please check the CDDB::File documentation for \& information on this module. \& \& read() requests a freedb record for the given information and returns a \& CDDB::File object. .Ve .ie n .IP "unlink($server_category_string, $disc_id)" 4 .el .IP "unlink($server_category_string, \f(CW$disc_id\fR)" 4 .IX Item "unlink($server_category_string, $disc_id)" .Vb 1 \& Parameters: \& \& 1: a server category name \& 2: a valid disc_id \& \& This will delete the given entry on the server (if you have permission). \& Check the docs for the read() method to get more information on the parameters. \& \& Sets $obj\->error on error. .Ve .ie n .IP "write($server_category_string, $disc_id, $cddb_formatted_data)" 4 .el .IP "write($server_category_string, \f(CW$disc_id\fR, \f(CW$cddb_formatted_data\fR)" 4 .IX Item "write($server_category_string, $disc_id, $cddb_formatted_data)" .Vb 1 \& Parameters: \& \& 1: a server category name \& 2: a valid disc_id \& 3: a properly formatted array of lines from a cddb file \& \& Returns true on success, otherwise $obj\->error will be set. .Ve .ie n .IP "discid($number_of_tracks, $track_1_offset, $track_2_offset, ..., $total_number_of_seconds_of_disc)" 4 .el .IP "discid($number_of_tracks, \f(CW$track_1_offset\fR, \f(CW$track_2_offset\fR, ..., \f(CW$total_number_of_seconds_of_disc\fR)" 4 .IX Item "discid($number_of_tracks, $track_1_offset, $track_2_offset, ..., $total_number_of_seconds_of_disc)" .Vb 1 \& Parameters: \& \& 1: The total number of tracks of the current disc \& 2: An array of the track offsets in seconds \& 3: The total number of seconds of the disc. \& \& Returns a valid disc_id if found, otherwise $obj\->error will be set. .Ve .IP get($filename) 4 .IX Item "get($filename)" .Vb 1 \& Parameters: \& \& 1: The filename to retrieve from the server. \& \& Returns a scalar containing raw file contents. Returns $obj\->error on error. .Ve .ie n .IP "log($number_of_lines_per_section, start_date, end_date, 'day', $number_of_days, 'get')" 4 .el .IP "log($number_of_lines_per_section, start_date, end_date, 'day', \f(CW$number_of_days\fR, 'get')" 4 .IX Item "log($number_of_lines_per_section, start_date, end_date, 'day', $number_of_days, 'get')" .Vb 1 \& Parameters: \& \& 1: The number of lines per section desired \& 2: (Optional) A date after which statistics should be calculated in the format of hh[mm[ss[MM[DD[[CC]YY]]]]] \& 3: (Optional) Must pass a start_date if passing this. A date after start date at which time statistics \& to not be calculated in the format of hh[mm[ss[MM[DD[[CC]YY]]]]] \& 4: (Optional) The string \*(Aqday\*(Aq to indicate that statistics should be calcuated for today. \& 5: (Optional) A number of days to be calculated, default is 1 \& 6: (Optional) The string \*(Aqget\*(Aq which will cause the log data to be recorded on the server\*(Aqs machine. \& \& NOTE: You must provide at least one of the optional options (2,3,4). \& Sets $obj\->error on error. .Ve .IP motd 4 .IX Item "motd" .Vb 2 \& Parameters: \& None \& \& Returns the message of the day as a string. \& Sets $obj\->error on error. .Ve .IP proto($desired_protocol_level) 4 .IX Item "proto($desired_protocol_level)" .Vb 1 \& Parameters: (Optional) The desired protocol level as a number. \& \& When called with NO parameters, will set the current and maximum allowed procotol levels, \& when called with a desired protocol level it will be set, $obj\->errror will be set if an error occurs. \& \& Returns the currently selected protocol level. .Ve .ie n .IP "put($type, $file)" 4 .el .IP "put($type, \f(CW$file\fR)" 4 .IX Item "put($type, $file)" .Vb 1 \& Parameters: \& \& 1: type is either sites or motd \& 2: based on param 1, an array of lines, either a list of mirror sites \& or a new message of the day \& \& Assuming you have permission to do so the server content will be updated. \& Sets $obj\->error on error. .Ve .IP quit 4 .IX Item "quit" .Vb 2 \& Parameters: \& None \& \& Disconnects from the server. .Ve .IP \fBsites()\fR 4 .IX Item "sites()" .Vb 2 \& Parameters: \& None \& \& sites() returns an array reference of urls that can be used as \& a new remote_host. .Ve .IP stat 4 .IX Item "stat" .Vb 2 \& Parameters: \& None \& \& Returns undef on error (and sets $obj\->error). Otherwise returns a hashref \& where the keys/values are: \& \& max proto => \& An integer representing the server\*(Aqs current operating protocol level. \& \& gets => \& The maximum protocol level. \& \& updates => \& Whether or not the client is allowed to initiate a database update. \& \& posting => \& Whether or not the client is allowed to post new entries. \& \& quotes => \& Whether or not quoted arguments are enabled. \& \& current users => \& The number of users currently connected to the server. \& \& max users => \& The number of users that can concurrently connect to the server. \& \& strip ext => \& Whether or not extended data is stripped by the server before presented to the user. \& \& Database entries => \& The total number of entries in the database. \& \& \& The total number of entries in the database by category. .Ve .IP update 4 .IX Item "update" .Vb 1 \& Parameters: \& \& None \& \& Tells the server to update the database (if you have permission). \& Sets $obj\->error on error. .Ve .IP validate($validating_string) 4 .IX Item "validate($validating_string)" .Vb 1 \& Parameters: \& \& 1: A string to be validated. \& \& If you have permission, given a string the server will validate the string \& as valid for use in a write call or not. \& \& Sets $obj\->error on error. .Ve .IP ver 4 .IX Item "ver" .Vb 1 \& Parameters: \& \& None \& \& Returns a string of the server\*(Aqs version. .Ve .IP whom 4 .IX Item "whom" .Vb 1 \& Parameters: \& \& None \& \& If you have permission, returns a list of usernames of all connected users. \& Sets $obj\->error on error. .Ve .IP get_local_disc_id 4 .IX Item "get_local_disc_id" .Vb 6 \& Parameters: \& getdiscid($) takes the device you want to use. \& Basically this means \*(Aq/dev/cdrom\*(Aq or whatever on linux machines \& but it\*(Aqs an array index in the number of cdrom drives on windows \& machines starting at 0. (Sorry, I may change this at a later time). \& So, if you have only 1 cdrom drive then getdiscid(0) would work fine. \& \& getdiscid() returns the discid of the current disc in the given drive. \& \& NOTE: See BUGS .Ve .IP get_local_disc_data 4 .IX Item "get_local_disc_data" .Vb 3 \& Parameters: \& getdiscdata($) takes the device you want to use. See getdiscid() \& for full description. \& \& getdiscdata() returns a hash of the given disc data as you would \& require for a call to query. The returns hash look like: \& \& { \& ID => \*(Aqd00b3d10\*(Aq, \& NUM_TRKS => \*(Aq3\*(Aq, \& TRACKS => [ \& \*(Aq150\*(Aq, \& \*(Aq18082\*(Aq, \& \*(Aq29172\*(Aq \& ], \& SECONDS => \*(Aq2879\*(Aq \& } \& \& NOTE: A different return type/design may be developed. .Ve .SH BUGS .IX Header "BUGS" .Vb 8 \& The current version of getdiscid() and getdiscdata() \& on the Windows platform takes ANY string in a single \& cdrom configuration and works fine. That is if you \& only have 1 cdrom drive; you can pass in ANY string \& and it will still scan that cdrom drive and return \& the correct data. If you have more then 1 cdrom drive \& giving the correct drive number will return in an \& accurate return. .Ve .SH "AUTHOR David Shultz Peter Pentchev " .IX Header "AUTHOR David Shultz Peter Pentchev " .SH "CREDITS Jeremy D. Zawodny Pete Jordon " .IX Header "CREDITS Jeremy D. Zawodny Pete Jordon " .SH "COPYRIGHT Copyright (c) 2002, 2014 David Shultz. Copyright (c) 2005, 2006 Peter Pentchev. All rights reserved. This program is free software; you can redistribute it and/or modify if under the same terms as Perl itself." .IX Header "COPYRIGHT Copyright (c) 2002, 2014 David Shultz. Copyright (c) 2005, 2006 Peter Pentchev. All rights reserved. This program is free software; you can redistribute it and/or modify if under the same terms as Perl itself."