summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2007-12-08 08:35:18 +0000
committerAndreas Brachold <vdr07@deltab.de>2007-12-08 08:35:18 +0000
commitd986ff1c851b7169d5d9537b03858eaaaae621d1 (patch)
tree6b74b9b96600c4a31c3b2d406bdc7c425f97ee08 /lib
parenta2b756c0349f83e8bfa860a24a0255d0cd09fb8f (diff)
downloadxxv-d986ff1c851b7169d5d9537b03858eaaaae621d1.tar.gz
xxv-d986ff1c851b7169d5d9537b03858eaaaae621d1.tar.bz2
* MEDIALIB: Add image if no actor image present
* MEDIALIB: Align image at middle * STATUS: avoid some filter warning (is'nt numeric) * RECORDS: don't use inotify as global object * RECORDS: delayed preview image generation
Diffstat (limited to 'lib')
-rw-r--r--lib/XXV/MODULES/MEDIALIB.pm7
-rw-r--r--lib/XXV/MODULES/RECORDS.pm23
-rw-r--r--lib/XXV/MODULES/STATUS.pm53
3 files changed, 60 insertions, 23 deletions
diff --git a/lib/XXV/MODULES/MEDIALIB.pm b/lib/XXV/MODULES/MEDIALIB.pm
index 83d5593..193b84c 100644
--- a/lib/XXV/MODULES/MEDIALIB.pm
+++ b/lib/XXV/MODULES/MEDIALIB.pm
@@ -939,8 +939,11 @@ WHERE
my $ret = [];
foreach my $actor ( split /\n/, $input ) {
- $erg->{uc($actor)}->{imgurl} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
- push @$ret, [$actor, $erg->{uc($actor)}->{imgurl}];
+ if($actor) {
+ $erg->{uc($actor)}->{imgurl} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg
+ if($erg->{uc($actor)}->{imgurl});
+ push @$ret, [$actor, $erg->{uc($actor)}->{imgurl}];
+ }
}
#print Dumper($erg, $ret);
diff --git a/lib/XXV/MODULES/RECORDS.pm b/lib/XXV/MODULES/RECORDS.pm
index 58cf8e1..f29758a 100644
--- a/lib/XXV/MODULES/RECORDS.pm
+++ b/lib/XXV/MODULES/RECORDS.pm
@@ -303,22 +303,23 @@ sub _init {
my $updatefile = sprintf("%s/.update",$obj->{videodir});
if( -r $updatefile) {
- $obj->{inotify} = new Linux::Inotify2
+ my $inotify = new Linux::Inotify2
or panic sprintf("Unable to create new inotify object: %s",$!);
- if($obj->{inotify}) {
+ if($inotify) {
# Bind watch to event::io
Event->io(
- fd =>$obj->{inotify}->fileno,
+ fd => $inotify->fileno,
poll => 'r',
- cb => sub { $obj->{inotify}->poll }
+ cb => sub { $inotify->poll }
);
# watch update file
- $obj->{inotify}->watch(
+ $inotify->watch(
$updatefile,
IN_ALL_EVENTS,
sub { my $e = shift; $obj->_notify_readData($e); }
);
+ $obj->{inotify} = 'active';
}
}
@@ -359,16 +360,18 @@ sub _notify_readData {
$obj->{lastupdate} = time;
# Update preview images after five minutes
- my $after = ($obj->{timers}->{prevminutes}) * 2;
+ my $after = ($obj->{timers}->{prevminutes}) * 60 * 2;
$after = 300 if($after <= 300);
Event->timer(
+ interval => 60,
after => $after,
cb => sub {
- $_[0]->w->cancel;
- if((time - $obj->{lastupdate}) >= ($after - 30)
- && $obj->readData()) {
- $obj->{lastupdate} = time;
+ if((time - $obj->{lastupdate}) >= ($after - 30)) {
+ $_[0]->w->cancel;
+ if($obj->readData()) {
+ $obj->{lastupdate} = time;
+ }
}
}
);
diff --git a/lib/XXV/MODULES/STATUS.pm b/lib/XXV/MODULES/STATUS.pm
index 3cbf009..8ad4abc 100644
--- a/lib/XXV/MODULES/STATUS.pm
+++ b/lib/XXV/MODULES/STATUS.pm
@@ -169,7 +169,7 @@ sub remember {
my $longsteps = int(($obj->{history} * 60 * 60) / $obj->{interval});
- $obj->watchDog($obj->mounts());
+ $obj->watchDog($obj->mounts(undef,'rawdata'));
my $data = {
timestamp => time,
@@ -269,7 +269,7 @@ sub memory {
my $watcher = shift || return error('No watcher defined!');
my $console = shift || return error('No console defined!');
- my $ret = $obj->meminfo();
+ my $ret = $obj->meminfo(undef,$console->typ eq 'HTML');
my $param = {
headingText => gettext('Memory'),
stack => $obj->{rememberstack},
@@ -287,7 +287,7 @@ sub filesys {
my $watcher = shift || return error('No watcher defined!');
my $console = shift || return error('No console defined!');
- my $ret = $obj->mounts();
+ my $ret = $obj->mounts(undef,$obj->{graphic} eq 'y' && $console->typ eq 'HTML');
my $param = {
headingText => gettext('Filesystems'),
usage => $ret,
@@ -418,8 +418,20 @@ sub netDevs {
my $clr = shift || 0;
my $buffer = load_file('/proc/net/dev');
- my $interfaces = [[qw/Interface RxBytes RxPackets RxErrs RxDrop TxBytes TxPackets TxErrs TxDrop/]];
- $interfaces = [] if($clr);
+ my $interfaces = [
+ [
+ gettext("Interface"),
+ gettext("RxBytes"),
+ gettext("RxPackets"),
+ gettext("RxErrs"),
+ gettext("RxDrop"),
+ gettext("TxBytes"),
+ gettext("TxPackets"),
+ gettext("TxErrs"),
+ gettext("TxDrop")
+ ]
+ ];
+ $interfaces = [] if($clr);
foreach my $line (split(/\n/, $buffer)) {
my @data = split(/[:|\s]+/, $line);
@@ -438,6 +450,7 @@ sub netDevs {
sub meminfo {
my $obj = shift || return error('No object defined!');
my $clr = shift || 0;
+ my $rawdata = shift || 0;
my $ret = {};
my $buffer = load_file "/proc/meminfo";
@@ -447,7 +460,7 @@ sub meminfo {
$value =~ s/ kB//sig;
$value = convert($value * 1024)
- unless($clr);
+ unless($clr || $rawdata);
$ret->{$name} = $value;
}
@@ -569,7 +582,14 @@ sub ide {
my $count = 0;
my @dirList = glob ("/proc/ide/*");
- my $ret = [[qw/Device Model Capacity Cache/]];
+ my $ret = [
+ [
+ gettext("Device"),
+ gettext("Model"),
+ gettext("Capacity"),
+ gettext("Cache")
+ ]
+ ];
foreach my $device (@dirList) {
next unless($device =~ /ide\/hd/);
@@ -681,17 +701,28 @@ sub load {
sub mounts{
my $obj = shift || return error('No object defined!');
my $clr = shift || 0;
+ my $rawdata = shift || 0;
my $df = `$obj->{dfBinary} -TP -x cdfs -x iso9660 -x udf`
or return error "Couldn't execute $obj->{dfBinary} $!\n";
- my $ret = [[qw/FS Typ Space Used Free Cap. Mount/]];
+ my $ret = [
+ [
+ gettext("Filesystem"),
+ gettext("Typ"),
+ gettext("Space"),
+ gettext("Used"),
+ gettext("Free"),
+ gettext("Capacity"),
+ gettext("Mount")
+ ]
+ ];
foreach my $zeile (split('\n', $df)) {
my @data = split('\s+', $zeile);
next if($data[2] !~ /^\d+$/);
$data[0] =~ s/[\-\s]/_/sg;
-
+ $data[5] =~ s/\%//sg if($rawdata);
if($clr) {
push(@$ret, $data[5]);
} else {
@@ -754,10 +785,10 @@ sub watchDog {
foreach my $m (@$mou) {
next unless($m->[0] =~ /^\//);
- if(int($m->[5]) >= 98 ) {
+ if($m->[5] >= 90 ) {
my $rm = main::getModule('REPORT');
$rm->news(
- sprintf(gettext("PANIC! Only %s%% space left on device %s"),(100 - int($m->[5])),$m->[0]),
+ sprintf(gettext("PANIC! Only %s%% space left on device %s"),(100 - $m->[5]),$m->[0]),
sprintf(gettext("Device has space %s from %s used!"), $m->[3], $m->[2]),
'sa',
undef,