diff options
author | Othmar Gsenger <otti@wirdorange.org> | 2011-01-13 23:46:16 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@wirdorange.org> | 2011-01-13 23:46:16 +0000 |
commit | 68f34d6c8f62086510286960e82ca1bbff2edd6a (patch) | |
tree | 954106bec3992733b0102aec4e6b1351ad0a20c9 /log.pl | |
parent | added inital svn dirs (diff) |
da files
Diffstat (limited to 'log.pl')
-rwxr-xr-x | log.pl | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +#!/usr/bin/perl +use strict; + +require RPC::XML; +require RPC::XML::Client; +use CGI qw(:standard); +use CGI::Carp 'fatalsToBrowser'; +use URI::Escape; + +print header; +print start_html('nzbget status'); + +print hr(); +my $cli = RPC::XML::Client->new('http://nzbget:tegbzn6789@127.0.0.1:6789/xmlrpc'); +print CGI::start_table(); +my $status = $cli->send_request('status') or die "Can't connect to nubget"; +print Tr(td['download speed', 'cur', int($status->{DownloadRate}->value/(1024*1024)).'MB/s','average',int($status->{AverageDownloadRate}->value/(1024*1024)).'MB/s']); +print CGI::end_table(); +print hr(); +print CGI::start_table(); +my $resp = $cli->send_request('log',0,10) or die "Can't connect to nubget"; +foreach my $row (@{ $resp->value}) +{ + print Tr(td[$row->{Text}]); +# foreach my $key (keys %$row) +# { +# if (ref $row->{$key} eq 'ARRAY') +# { +# print Tr(td([$key,join(',',@{$row->{$key}})])); +# } else { +# print Tr(td([$key,$row->{$key}])); +# } +# } +} +print CGI::end_table(); +print end_html; |