From: Andrew Ruthven Date: Mon, 12 Nov 2018 11:10:18 +0000 (+1300) Subject: Allow showing device type in the encoder output X-Git-Tag: 1.0.0~61 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f98ee137cfd9e377b9878c329e1dd87a5c107843;p=mythtv-status.git Allow showing device type in the encoder output Original patch is from Eric Wilde, but made some assumptions that wouldn't scale. Let's try this which is more general. --- diff --git a/bin/mythtv-status b/bin/mythtv-status index 2dc99ab..8cf3417 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -291,8 +291,8 @@ my @blocks = ( 'type' => 'xpath', 'xpath' => "//Status/Encoders/Encoder", 'protocol_version' => [ ">= 58" ], - 'attrs' => [ qw/hostname id state connected/ ], - 'template' => "__hostname__ (__id__) - __state____connected__", + 'attrs' => [ qw/hostname id state devlabel connected/ ], + 'template' => "__hostname__ (__id____devtype__) - __state____connected__", 'rewrite' => { '/connected/' => { '1' => '', '0' => "${warning}(Disconnected)${normal}" }, '/state/' => { @@ -309,6 +309,12 @@ my @blocks = ( 'filter' => { 'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 }, }, + 'subs' => { + 'devtype' => sub { + if ($_[0]->{'devlabel'} =~ /\[ (.+) :/) { ", $1" } + else { '' } + }, + }, }, # What programs (if any) are being recorded right now?