Be a bit more forgiving on the XML we're receiving.
Show how much disk space is used - currently only total.
Rename "Time till next recording" to "Next Recording In".
+ Put all the one liners together in the output and make them line
+ up nicely.
2007-11-23 Andrew Ruthven
Don't set the background when changing the colour.
'v|version' => \&print_version,
'email=s@' => \@email,
'email-only-on-conflict' => \$email_only_on_conflict,
+
'status!' => \$display{'Status'},
'encoders!' => \$display{'Encoders'},
'recording-now!' => \$display{'Recording Now'},
# The blocks of output which we might generate.
my @blocks = (
+ # All the one liners together
+ {
+ 'name' => 'One Liners',
+ 'type' => 'sub',
+ 'template' => '',
+ 'sub' => sub { return 'Place holder' },
+ },
+
# Date/Time from server
{
'name' => 'Status',
}
if (defined $result && $result ne '' && ! defined $hide) {
- $output .= "$block->{'name'}:" . ($block->{'format'} eq 'one line' ? ' ' : "\n");
- $output .= $result . "\n\n";
+ if ($block->{'format'} eq 'one line') {
+ push @oneliners, [ $block->{'name'}, $result ];
+ } else {
+ $output .= "$block->{'name'}:\n";
+ $output .= $result . "\n\n";
+ }
}
}
+# Deal with the one liners.
+if (scalar(@oneliners) > 0) {
+ # Find the longest header
+ my $length = 0;
+ for $line (@oneliners) {
+ if (length($line->[0]) > $length) {
+ $length = length($line->[0]);
+ }
+ }
+
+ # Put the one liners together, with leading dots to the colon.
+ my $oneliners = "";
+ for $line (@oneliners) {
+ $oneliners .= "$line->[0]"
+ . ('.' x ($length - length($line->[0]))) . ": $line->[1]\n";
+ }
+
+ # What a hacky way of putting the one liners where I want them...
+ $output =~ s/^One Liners:\nPlace holder\n/$oneliners/m;
+}
+
# Either print the status out, or email it.
if (scalar(@email) == 0) {
print "\n$output";