[SCM] Video extraction utility for YouTube, Google Video and other video sites (Debian packaging) branch, master, updated. upstream/2.1.9-120-g5cdb4a5
legatvs
legatvs at gmail.com
Thu Apr 9 07:25:58 UTC 2009
The following commit has been merged in the master branch:
commit fd317e8c6a4deddbf2db3481786d29cebae5521e
Author: legatvs <legatvs at gmail.com>
Date: Fri Apr 3 23:55:03 2009 +0300
Add --limit-rate option.
diff --git a/CHANGES b/CHANGES
index a69202a..5441078 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,8 @@ clive (2.1.10+).
* Add abby (front-end) compatibility
- Change output similar to cclive
- http://code.google.com/p/abby/
+ * Add --limit-rate option
+ - config: [http]:limit_rate
* Improve file suffix parsing from content-type
- Rewrite the content-type handling block in query_video_length
- Use whatever is found after slash in the content-type string
diff --git a/clive b/clive
index dc0ad70..9f584d9 100755
--- a/clive
+++ b/clive
@@ -106,8 +106,7 @@ my $c = Config::Tiny->read($CONFIGFILE);
progress => $c->{_}->{progress},
agent => $c->{http}->{agent},
proxy => $c->{http}->{proxy},
- maxspeed => $c->{http}->{maxspeed},
- minspeed => $c->{http}->{minspeed},
+ limitrate => $c->{http}->{limit_rate},
format => $c->{output}->{format},
savedir => $c->{output}->{savedir},
cclass => $c->{output}->{cclass},
@@ -139,8 +138,6 @@ GetOptions(
'hosts' => \&print_hosts,
'version|v' => \&print_version,
- # Commented out until WWW::Curl is fixed:
- # 'maxspeed!', 'minspeed!',
# Workarounds since $longopt!|$shortopt cannot be used.
'no-extract|n' => sub { $opts{extract} = 0 },
'no-login|L' => sub { $opts{login} = 0 },
@@ -156,6 +153,7 @@ GetOptions(
'emit-xml|E' => sub { $opts{emitxml} = 1 },
'stream-exec=s' => sub { $opts{streamexec} = $_[1] },
'output-video|O=s' => sub { $opts{outputfname} = $_[1] },
+ 'limit-rate=i', => sub { $opts{limitrate} = $_[1] },
) or exit(1);
if ($opts{help})
@@ -192,12 +190,6 @@ sub init_curl
$curl->setopt(CURLOPT_PROXY, $opts{proxy})
if defined $opts{proxy};
-
- $curl->setopt(CURLOPT_MAX_RECV_SPEED_LARGE, $opts{maxspeed})
- if $opts{maxpseed}; # NOTE: No effect. Bug in WWW::Curl::Easy?
-
- $curl->setopt(CURLOPT_LOW_SPEED_LIMIT, $opts{minspeed})
- if $opts{minspeed}; # Ditto.
}
sub auth_youtube
@@ -568,9 +560,14 @@ sub extract_video
}
}
+ $curl->setopt(CURLOPT_MAX_RECV_SPEED_LARGE, $opts{limitrate}*1024)
+ if defined $opts{limitrate};
+
$rc = $curl->perform;
close $fh;
+ $curl->setopt(CURLOPT_MAX_RECV_SPEED_LARGE, 0);
+
if ($rc == 0)
{
$rc = $curl->getinfo(CURLINFO_RESPONSE_CODE);
@@ -2039,3 +2036,4 @@ Download Options:
-x, --exec=COMMAND execute COMMAND subsequently
--stream-exec=COMMAND stream COMMAND to be executed
--stream=PERCENT execute stream command when transfer reaches %
+ --limit-rate=AMOUNT limit video download rate to amount KB/s
diff --git a/clive.1 b/clive.1
index cb35e89..6a2e4e6 100644
--- a/clive.1
+++ b/clive.1
@@ -132,7 +132,7 @@
.\" ========================================================================
.\"
.IX Title "clive 1"
-.TH clive 1 "2009-04-01" "2.1.10" "clive manual"
+.TH clive 1 "2009-04-03" "2.1.10" "clive manual"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -395,6 +395,9 @@ transfer progress reaches \fIpercent\fR.
.Sp
Example:
% clive \-\-stream\-exec=\*(L"mplayer \-really\-quiet \f(CW%i\fR\*(R" \-\-stream=20 \s-1URL\s0
+.IP "\fB\-\-limit\-rate=\fR\fIamount\fR" 4
+.IX Item "--limit-rate=amount"
+Limit video download rate to \fIamount\fR KB/s.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
.IP "Typical use:" 4
diff --git a/clive.pod b/clive.pod
index 3ea2717..47086ea 100644
--- a/clive.pod
+++ b/clive.pod
@@ -320,6 +320,10 @@ transfer progress reaches I<percent>.
Example:
% clive --stream-exec="mplayer -really-quiet %i" --stream=20 URL
+=item B<--limit-rate=>I<amount>
+
+Limit video download rate to I<amount> KB/s.
+
=back
=head1 EXAMPLES
--
Video extraction utility for YouTube, Google Video and other video sites (Debian packaging)
More information about the Pkg-perl-cvs-commits
mailing list