From 42ce929e755c9397f22f3495f773c9fa4d825b19 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Wed, 21 Nov 2007 06:34:44 +1300 Subject: [PATCH] Handle the schedule conflicts output block in a way I'm happier with. --- bin/mythtv-status | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/mythtv-status b/bin/mythtv-status index 9fa9f24..072a1c6 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -144,8 +144,9 @@ my @blocks = ( # Conflicts { 'name' => 'Schedule Conflicts', - 'type' => 'Perl MythTV API', + 'type' => 'sub', 'defaults' => 'schedule', + 'sub' => \&process_conflicts }, # How many hours till the next recording. @@ -213,10 +214,10 @@ for my $block (@blocks) { $output = process_xml($block, $xml); - } elsif ($block->{'type'} eq 'Perl MythTV API') { - $myth ||= load_perl_api(); + } elsif ($block->{'type'} eq 'sub') { - $output = process_perl($block, $myth); + $output = &{ $block->{'sub'} }($block) + if defined $block->{'sub'}; } elsif ($block->{'type'} eq 'sub') { $output = substitute_vars($block, { 'next_time' => $next_time }); @@ -280,8 +281,9 @@ sub process_xml { return join("\n", @lines); } -sub process_perl { - my ($block, $myth) = @_; +sub process_conflicts { + my ($block) = @_; + $myth ||= load_perl_api(); return "Unable to access MythTV Perl API." unless defined $myth; -- 2.30.2