From: Andrew Ruthven Date: Sat, 8 Dec 2018 13:03:26 +0000 (+1300) Subject: Allow attrs to be flagged as optional. X-Git-Tag: 1.0.0~45 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fc3746a04e2a9ffed28d21933c44b8615e9c7bd;p=mythtv-status.git Allow attrs to be flagged as optional. --- diff --git a/bin/mythtv-status b/bin/mythtv-status index 8798b14..3a1ed86 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -249,6 +249,7 @@ my @blocks = ( 'type' => 'xpath', 'xpath' => "//Status", 'attrs' => [ qw/ISODate time date/ ], + 'optional_attrs' => [ qw/ISODate/ ], 'template' => "__date__", 'format' => 'one line', 'rewrite' => { @@ -1082,7 +1083,8 @@ sub substitute_vars { if $verbose; return undef; } else { - warn "Unable to find any value for $key while looking at $block->{'name'}\n"; + warn "Unable to find any value for $key while looking at $block->{'name'}\n" + if $verbose || ! grep /^$key$/, @{$block->{'optional_attrs'}}; next; } }