1 # (c) 2007 by Ralf Ertzinger <ralf@camperquake.de>
2 # licensed under GNU GPL v2
4 # A getter which calls a remote URL in order to trigger a
10 @ISA = qw(GetterBase);
13 use LWP::Simple qw(!get);
17 my $self = $class->SUPER::new();
19 $self->{'NAME'} = 'HTTPRPCGetter';
20 $self->{'_PARAMS'} = {'URL' => ['http://www.example.com/get.pl?type=%s&vid=%s&title=%s&url=%s', "The URL to call in order to trigger a download. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are hexencoded"]};
23 $self->_prepare_parameters();
33 $callurl = sprintf($self->_getval('URL'),
34 $self->_encode($video->{'SOURCE'}),
35 $self->_encode($video->{'ID'}),
36 $self->_encode($video->{'TITLE'}),
37 $self->_encode($video->{'DLURL'}),
38 $self->_encode($video->{'URL'}));
40 $self->debug('Going to call %s', $callurl);
42 unless(defined(LWP::Simple::get($callurl))) {
43 $self->error("Error calling RPC");
54 $s =~ s/(.)/sprintf("%%%02x", ord($1))/ge;