From 5c939c4231f8c8af850234b1c4b55b64c2709ca1 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Wed, 12 Dec 2007 07:19:24 +1300 Subject: [PATCH] By default only show storage groups that are over the warning threshold. --- bin/mythtv-status | 13 ++++++++++--- ...iple-storage-groups.pucks-patches.one-warn.xml | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 testing/xml/multiple-storage-groups.pucks-patches.one-warn.xml diff --git a/bin/mythtv-status b/bin/mythtv-status index b94c17e..db72a53 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -256,7 +256,12 @@ my @blocks = ( 'commify' => [ qw/total used/ ], 'template' => "Total space for group __id__ is __total__ GB, with __used__ GB used (__percent__)", 'filter' => { - 'id' => sub { return $_[0] eq 'total' } + 'id' => sub { return $_[0] eq 'total' }, + 'used' => sub { + return ! ( + (defined $display{'Disk Space'} && $display{'Disk Space'}) + || ($_[1]->{'used'} / $_[1]->{'total'}) * 100 > $disk_space_warn) + } }, 'subs' => { 'percent' => sub { @@ -591,7 +596,7 @@ sub substitute_vars { $skip = 1 if defined $block->{'filter'}{$key} && - &{ $block->{'filter'}{$key} }($value); + &{ $block->{'filter'}{$key} }($value, $vars); if (defined $block->{'rewrite'}{"/$key/"}) { my ($search, $replace); @@ -779,7 +784,9 @@ the next recording is displayed. =item Disk Space -Details about each storage group that MythTV knows about. +Details about each storage group that MythTV knows about. By default this +only shows storage groups that are above the warning level. Use +B<--disk-space> to turn on display of all storage groups. =back diff --git a/testing/xml/multiple-storage-groups.pucks-patches.one-warn.xml b/testing/xml/multiple-storage-groups.pucks-patches.one-warn.xml new file mode 100644 index 0000000..e3f8a8d --- /dev/null +++ b/testing/xml/multiple-storage-groups.pucks-patches.one-warn.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + -- 2.30.2