2 # A getter which calls a remote URL in order to trigger a
11 use LWP::Simple qw(!get);
15 my $self = $class->SUPER::new();
17 $self->{'NAME'} = 'HTTPRPCGetter';
18 $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"]};
21 $self->_prepare_parameters();
31 $callurl = sprintf($self->_getval('URL'),
32 $self->_encode($video->{'SOURCE'}),
33 $self->_encode($video->{'ID'}),
34 $self->_encode($video->{'TITLE'}),
35 $self->_encode($video->{'DLURL'}),
36 $self->_encode($video->{'URL'}));
38 $self->debug('Going to call %s', $callurl);
40 unless(defined(LWP::Simple::get($callurl))) {
41 $self->error("Error calling RPC");
52 $s =~ s/(.)/sprintf("%%%02x", ord($1))/ge;