1 # (c) 2007 by Ralf Ertzinger <ralf@camperquake.de>
2 # licensed under GNU GPL v2
4 # A getter which POSTs the JSONified metadata to a remote URL
6 package videosite::HTTPJSONGetter;
8 use videosite::GetterBase;
9 @ISA = qw(videosite::GetterBase);
13 use JSON -support_by_pp;
17 my $self = $class->SUPER::new(
18 NAME => 'HTTPJSONGetter',
20 URL => ['http://www.example.com/getjson.pl', "The URL to call in order to trigger a download. The JSON encoded information will be POSTed to this URL."]
25 return bless($self, $class);
32 my $ua = LWP::UserAgent->new('agent' => 'Mozilla/5.0');
36 $jdata = $j->encode($video);
38 $self->debug("Encoded metadata to %s", $jdata);
39 $r = $ua->post($self->_getval('URL'), {'json' => $jdata});
40 unless ($r->is_success()) {
41 $self->error("Error calling RPC: %s", $r->code());