]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - config/mldonkey/mldonkey_submit
3 # Submit an eDonkey download request to mldonkey
5 # Argument(s): An ed2k URI of the form:
7 # ed2k://|file|<filename>|<filesize>|<MD4-sum|
10 ($#ARGV >= 0) || die "Usage: mldonkey_submit <ed2kURI> ...
13 $vars{'HTTPURL'} = "http://192.168.181.70:4080";
14 $vars{'HTTPUSER'} = "admin";
15 $vars{'HTTPPASS'} = "";
17 my $ua = LWP
::UserAgent
->new;
19 while (my $uri = shift @ARGV) {
20 $_ = URI
::Escape
::uri_unescape
($uri);
21 if (/^ed2k:\/\
/\|file\|[^|]+\|(\d+)\|([\dabcdef]+)\|$/) {
24 my $req = HTTP
::Request
->new(
25 GET
=> "$vars{'HTTPURL'}/submit?q=dllink+$uri"
27 if (($vars{'HTTPUSER'}) && ($vars{'HTTPPASS'})) {
28 $req->authorization_basic($vars{'HTTPUSER'},
31 my $response = $ua->request($req);
32 if (!($response->is_success)) {
33 print $response->error_as_HTML;
37 print "Not an ed2k URI: $_