Rename doc/ to man1/
[www-quvi.git] / man1 / Quvi.pod
blob548dad30966b5be04822823488c4812193549248
1 =head1 NAME
3 WWW::Quvi - Perl extension interface for libquvi
5 =head1 SYNOPSIS
7   use WWW::Quvi;
8   my $opts  = new WWW::Quvi::Options;
9   my $query = new WWW::Quvi::Query;
10   my $media = $query->parse ($url, $opts);
11   if ($media->{ok}) {
12     # ...
13   }
14   else {
15     die "libquvi: error: $query->{last_error}";
16   }
18 =head1 DESCRIPTION
20 WWW::Quvi provides a Perl interface to libquvi, a small C library for
21 parsing Flash media stream URLs.
23 =head1 DOCUMENTATION
25 This module provides a Perl interface to libquvi. This documentation
26 contains the Perl specific details and some sample code. The libquvi
27 documentation should be consulted for the API details at
28 L<http://quvi.sourceforge.net/>.
30 =head1 WWW::Quvi::version
32 A wrapper function that returns WWW::Quvi version and libquvi version
33 information.
35   WWW::Quvi::version;                           # Module version
36   WWW::Quvi::version(WWW::Quvi::ModuleVersion); # Ditto.
37   WWW::Quvi::version(WWW::Quvi::libquviVersion);
38   WWW::Quvi::version(WWW::Quvi::libquviVersionLong);
40 =head1 WWW::Quvi::Options
42 A container hash for the options used with libquvi that would normally
43 (using the C API) be set with C<quvi_setopt(3)>.
45   $opts->{verbose_libcurl} = 1;                      # Default: 0
46   $opts->{user_agent}      = 'Foo/1.0';              # Default: ""
47   $opts->{http_proxy}      = 'http://foo:1234';      # Default: ""
48   $opts->{category}        = WWW::Quvi::ProtoHttp;   # Default: ProtoAll
49   $opts->{format}          = 'best';                 # Default: "default"
50   $opts->{resolve}         = 0;                      # Default: 1
51   $opts->{verify}          = 0;                      # Default: 1
53 =head1 WWW::Quvi::Media
55 A container hash that holds the parsed media details accessible using
56 C<quvi_getprop(3)>.
58   $media->{start_time} - Start time for media (if any)
59   $media->{page_url}   - Page URL
60   $media->{title}      - Media title
61   $media->{host}       - Host ID
62   $media->{id}         - Media ID
63   $media->{ok}         - Non-zero value if parsing succeeded
65 =head1 WWW::Quvi::Url
67 A container hash that holds the parsed media url details. A member of
68 the L</WWW::Quvi::Media> hash.
70   $url->{content_type} - Content-type as returned by the server
71   $url->{file_suffix}  - File suffix parsed from the content-type
72   $url->{length_bytes} - Content length as returned by the server
73   $url->{url}          - Media stream URL
75 =head1 WWW::Quvi::Query
77 Glues the above together.
79   # An Options instance is required.
80   # See WWW::Quvi::Options above for the available keys.
81   my $opts  = new WWW::Quvi::Options;
83   # Initializes libquvi (quvi_init), croaks if that fails.
84   my $query = new WWW::Quvi::Query;
86   # Perform a query.
87   my $url   = "http://www.youtube.com/watch?v=DUM1284TqFc";
88   my $media = $query->parse ($url, $opts);
90   if ($media->{ok}) {
91     # Do whatever with the parsed media details.
92   }
93   else {
94     croak "libquvi: error: $query->{last_error}";
95     # Other things to check:
96     #  $query->{quvi_code}
97     #  $query->{resp_code}
98   }
100   # Iterate supported websites:
102   while (1) {
103     my ($done, $domain, $formats) = $query->next_website;
104     last if $done;
105     print "$domain\t$formats\n";
106   }
108   # Check if URL is supported. Make a note of "compressed" URLs, as
109   # this function fails with most of them. Refer to the libquvi C API
110   # for the details.
112   print
113     $query->supported("http://dai.ly") != WWW::Quvi::OK
114     ? $query->{last_error}
115     : "supported";
117 =head1 NOT IMPLEMENTED
119 =over 4
121 =item B<Linked list interface>
123 =item B<Network interface>
125 =item B<Media segments>
127 =item B<Callbacks>
129 =back
131 =head1 WWW
133  Home  : http://www-quvi.sourceforge.net/
134  gitweb: http://repo.or.cz/w/www-quvi.git
136 =head1 LICENSE
138 WWW::Quvi is free software, licensed under the LGPLv2.1+.
140 =head1 SEE ALSO
142 C<quvi(1)>
144 =head1 AUTHOR
146 Toni Gundogdu <legatvs at sign gmail com>
148 =cut