]> git.etc.gen.nz Git - mythtv-status.git/commitdiff
By default only show storage groups that are over the warning threshold.
authorAndrew Ruthven <andrew@etc.gen.nz>
Tue, 11 Dec 2007 18:19:24 +0000 (07:19 +1300)
committerAndrew Ruthven <andrew@etc.gen.nz>
Tue, 11 Dec 2007 18:19:40 +0000 (07:19 +1300)
bin/mythtv-status
testing/xml/multiple-storage-groups.pucks-patches.one-warn.xml [new file with mode: 0644]

index b94c17e2dcd9f8daa5e7d872bac42266cde1b2ae..db72a53708fe68498bdbf72dfd1f9e2e1f08e81e 100755 (executable)
@@ -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 (file)
index 0000000..e3f8a8d
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE Status>
+<Status version="0.21.20071202-1" protoVer="36" xmlVer="1" ISODate="2007-12-07T16:26:55" time="4:26 PM" date="12/7/2007" >
+ <Encoders count="0" />
+ <Scheduled count="0" />
+ <JobQueue count="0" />
+ <MachineInfo>
+  <Storage>
+   <Group dir="cyclops:/home/andrew/myth6" free="18818" id="1" total="50396" used="31578" />
+   <Group dir="cyclops:/scratch/myth2,cyclops:/tmp/myth1,cyclops:/tmp/myth3,cyclops:/tmp/myth4" free="10644" id="2" total="20746" used="20101" />
+   <Group dir="TotalDiskSpace" free="29463" id="total" total="71143" used="41679" />
+  </Storage>
+  <Load avg1="0.04" avg2="0.1" avg3="0.19" />
+  <Guide status="" next="1970-01-01T00:00:00" end="" start="" ></Guide>
+ </MachineInfo>
+</Status>