From b2c00d4ba1235096ca0730fd45ce8008dc1ddcfa Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Wed, 27 Jul 2011 01:37:54 +0300 Subject: [PATCH] Revise manual --- doc/Quvi.pod | 309 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 148 insertions(+), 161 deletions(-) rewrite doc/Quvi.pod (79%) diff --git a/doc/Quvi.pod b/doc/Quvi.pod dissimilarity index 79% index c361b00..548dad3 100644 --- a/doc/Quvi.pod +++ b/doc/Quvi.pod @@ -1,161 +1,148 @@ -=head1 NAME - -WWW::Quvi - Perl extension interface for libquvi - -=head1 SYNOPSIS - - use WWW::Quvi; - my $opts = new WWW::Quvi::Options; - my $query = new WWW::Quvi::Query; - my $video = $query->parse ($url, $opts); - if ($video->{ok}) { - # ... - } - else { - die "libquvi: error: $query->{last_error}"; - } - -=head1 DESCRIPTION - -WWW::Quvi provides a Perl interface to libquvi, a library for parsing video -download links. - -=head1 DOCUMENTATION - -This module provides a Perl interface to libquvi. This documentation -contains the Perl specific details and some sample code. The libquvi -documentation should be consulted for the API details at -L. - -=head1 WWW::Quvi::version - -A wrapper function that returns WWW::Quvi version and libquvi version -information. - - use warnings; - use strict; - - print WWW::Quvi::version; # Module version - print WWW::Quvi::version (WWW::Quvi::ModuleVersion); # Same as above. - print WWW::Quvi::version (WWW::Quvi::libquviVersion); - print WWW::Quvi::version (WWW::Quvi::libquviVersionLong); - -=head1 WWW::Quvi::Options - -A container hash for the options used with libquvi that would normally -(using the C API) be set with C. - - use warnings; - use strict; - - use WWW::Quvi; - - my $opts = new WWW::Quvi::Options; - - $opts->{user_agent} = 'Foo/1.0'; # Default: "" - $opts->{http_proxy} = 'http://foo:1234'; # Default: "" - $opts->{format} = 'hd'; # Default: "default" - $opts->{verify} = 0; # Default: 1 - $opts->{verbose_libcurl} = 1; # Default: 0 - $opts->{shortened} = 0; # Default: 1 - $opts->{category} = WWW::Quvi::ProtoAll; # Default: ProtoHttp - -=head1 WWW::Quvi::Video - -A container hash that holds the parsed video details. - - print " - $video->{title} - $video->{host} - $video->{url} - $video->{id} - $video->{ok} - $video->{start_time} - "; - -=head1 WWW::Quvi::Link - -A container hash that holds the parsed video link details. A member of -the L hash. - - print " - $video->{link}->{content_type} - $video->{link}->{file_suffix} - $video->{link}->{length_bytes} - $video->{link}->{url} - "; - -=head1 WWW::Quvi::Query - -Glues the above together. - - # An Options instance is required. - # See WWW::Quvi::Options above for the available keys. - - my $opts = new WWW::Quvi::Options; - - # Initializes libquvi (quvi_init), croaks if that fails. - - my $query = new WWW::Quvi::Query; - - # Perform a query. - - my $url = "http://www.youtube.com/watch?v=DUM1284TqFc"; - my $video = $query->parse ($url, $opts); - - if ($video->{ok}) { - # Do whatever with the parsed video details. - } - else { - croak "libquvi: error: $query->{last_error}"; - # Other things to check: - # * $query->{quvi_code} - # * $query->{resp_code} - } - - # Iterate supported websites: - - while (1) { - my ($done, $domain, $formats) = $query->next_website; - - last if $done; - - print "$domain\t$formats\n"; - } - - # Check if URL is supported. Make a note of "compressed" URLs, as - # this function fails with most of them. Refer to the libquvi C API - # for the details. - - print - $query->supported("http://dai.ly") != WWW::Quvi::OK - ? $query->{last_error} - : "supported"; - -=head1 NOT IMPLEMENTED - -=over 4 - -=item B - -e.g. quvi_callback_status, quvi_callback_write. - -=item B