From: Andrew Ruthven Date: Wed, 12 Dec 2007 23:11:30 +0000 (+1300) Subject: Show the channel name along with each program. X-Git-Tag: 0.6.1~1 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3498f8d352a72ac8823703bac0a709a1a30d226b;p=mythtv-status.git Show the channel name along with each program. --- diff --git a/ChangeLog b/ChangeLog index 2b01696..0a76e0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2007-12-13 Andre Ruthven Warn if there isn't enough guide data present. + Show the channel name next to program details. 2007-12-12 Andrew Ruthven Release version 0.6.0 diff --git a/bin/mythtv-status b/bin/mythtv-status index 3e8d23c..5e4fed3 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -91,9 +91,10 @@ if (defined $colour && scalar(@email) == 0) { # Allow setting some defaults for the output blocks. my %defaults = ( 'schedule' => { - 'attrs' => [ qw/title startTime NODE_TEXT subTitle/ ], + 'attrs' => [ qw/title startTime NODE_TEXT subTitle .\/Channel[@channelName]:channelName/ ], 'template' => "__startTime__ - __title__" . (defined $episode ? " - __subTitle__" : '') + . " (__channelName__)" . (defined $description ? "\n__NODE_TEXT__" : ''), 'filter' => { # Only show recordings for today and tomorrow. @@ -156,8 +157,8 @@ my @blocks = ( 'type' => 'xpath', 'xpath' => "//Status/Encoders/Encoder/Program", 'hide' => 'after', - 'attrs' => [ qw/title endTime/ ], - 'template' => "__title__ (Ends: __endTime__)", + 'attrs' => [ qw/title endTime .\/Channel[@channelName]:channelName/ ], + 'template' => "__title__ (__channelName__) Ends: __endTime__", 'rewrite' => { '/endTime/' => { '.*T' => '' }, }, @@ -562,7 +563,13 @@ sub process_xml { for my $item (@{ $items }) { my %vars; for my $key (@{ $block->{'attrs'} }) { - $vars{$key} = $key eq 'NODE_TEXT' ? $item->string_value : $item->getAttribute($key); + if ($key =~ /(.*?):(.*)/) { + my $subitem = $item->findnodes($1); + $vars{$2} = @{ $subitem }[0]->getAttribute($2) + if defined @{ $subitem }[0]; + } else { + $vars{$key} = $key eq 'NODE_TEXT' ? $item->string_value : $item->getAttribute($key); + } } my $str = substitute_vars($block, \%vars);