From: Andrew Ruthven Date: Fri, 16 Nov 2007 00:07:43 +0000 (+1300) Subject: Optionally display the subtitle. X-Git-Tag: 0.4~17 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd59110173e8d08591123529fe94ce4a68518d63;p=mythtv-status.git Optionally display the subtitle. --- diff --git a/bin/mythtv-status b/bin/mythtv-status index d2cc2ca..2c2f88c 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -18,10 +18,12 @@ use Text::Wrap; my $host = "localhost"; my $port = "6544"; my $description = undef; +my $episode = undef; GetOptions( 'h|host=s' => \$host, 'p|port=s' => \$port, + 'e|episode' => \$episode, 'd|descripton' => \$description ); @@ -82,8 +84,10 @@ my @blocks = ( { 'name' => 'Scheduled Recordings', 'xpath' => '//Status/Scheduled/Program', - 'attrs' => [ qw/title startTime NODE_TEXT/ ], - 'template' => "__startTime__ - __title__" . (defined $description ? "\n__NODE_TEXT__" : ''), + 'attrs' => [ qw/title startTime NODE_TEXT subTitle/ ], + 'template' => "__startTime__ - __title__" + . (defined $episode ? " - __subTitle__" : '') + . (defined $description ? "\n__NODE_TEXT__" : ''), 'filter' => { # Only show recordings for today and tomorrow. 'startTime' => sub { @@ -118,6 +122,8 @@ for my $block (@blocks) { my $value = $key eq 'NODE_TEXT' ? wrap(' ', ' ', $item->string_value()) : $item->getAttribute($key); $value =~ s/\s+$//; + $value ||= 'Unknown'; + $skip = 1 if defined $block->{'filter'}{$key} && &{ $block->{'filter'}{$key} }($value); @@ -167,6 +173,10 @@ The host to check, defaults to localhost. The port to use when connecting to MythTV, defaults to 6544. +=item B<-e, --episode> + +Display the episode (subtitle) for the scheduled recordings. + =item B<-d, --description> Display the description for the scheduled recordings.