$c->{'description'} ||= 0;
$c->{'encoder_details'} ||= 0;
$c->{'encoder_skip_idle'} //= 1;
+$c->{'encoder_warn_non_idle'} //= 1;
$c->{'email_only_on_alert'} ||= 0;
my $help = 0;
my $verbose = 0;
'auto-expire-count=i' => \$c->{'auto_expire_count'},
'recording-in-warn=i' => \$c->{'recording_in_warn'},
'encoder-skip-idle!' => \$c->{'encoder_skip_idle'},
+ 'encoder-warn-non-idle!' => \$c->{'encoder_warn_non_idle'},
'oneliner-bullets!' => \$c->{'oneliner_bullets'},
'status!' => \$c->{'display'}{'Status'},
'xpath' => "//Status/Encoders/Encoder",
'protocol_version' => [ "<= 43" ],
'attrs' => [ qw/hostname id state connected/ ],
- 'template' => "__hostname__ (__id__) - __state____connected__",
+ 'template' => "__hostname__ (__id__) - __state_colour____state____state_normal____connected__",
'rewrite' => {
'/connected/' => { '1' => '', '0' => "${warn}(Disconnected)${warn_to_normal}" },
'/state/' => {
- '^0$' => "${safe}Idle${safe_to_normal}",
- '^1$' => "${warn}Watching LiveTV${warn_to_normal}",
- '^2$' => "${warn}Watching Pre-recorded${warn_to_normal}",
- '^3$' => "${warn}Watching Recording${warn_to_normal}",
- '^4$' => "${warn}Recording${warn_to_normal}",
+ '^0$' => "Idle",
+ '^1$' => "Watching LiveTV",
+ '^2$' => "Watching Pre-recorded",
+ '^3$' => "Watching Recording",
+ '^4$' => "Recording",
},
},
'filter' => {
'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 },
},
+ 'subs' => {
+ 'state_colour' => sub {
+ if ($c->{'encoder_warn_non_idle'}) {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe;
+ } else {
+ return $warn;
+ }
+ } else {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe;
+ } elsif ($_[0]->{'state'} eq '-1') {
+ return $warn;
+ } else {
+ return '';
+ }
+ }
+ },
+ 'state_normal' => sub {
+ if ($c->{'encoder_warn_non_idle'}) {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe_to_normal;
+ } else {
+ return $warn_to_normal;
+ }
+ } else {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe_to_normal;
+ } elsif ($_[0]->{'state'} eq '-1') {
+ return $warn_to_normal;
+ } else {
+ return '';
+ }
+ }
+ },
+ },
},
# Info about the encoders after TV OSD Declutter (Changeset 20037).
'xpath' => "//Status/Encoders/Encoder",
'protocol_version' => [ ">= 44", "< 58" ],
'attrs' => [ qw/hostname id state connected/ ],
- 'template' => "__hostname__ (__id__) - __state____connected__",
+ 'template' => "__hostname__ (__id__) - __state_colour____state____state_normal____connected__",
'rewrite' => {
'/connected/' => { '1' => '', '0' => "${warn}(Disconnected)${warn_to_normal}" },
'/state/' => {
'filter' => {
'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 },
},
+ 'subs' => {
+ 'state_colour' => sub {
+ if ($c->{'encoder_warn_non_idle'}) {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe;
+ } else {
+ return $warn;
+ }
+ } else {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe;
+ } elsif ($_[0]->{'state'} eq '-1') {
+ return $warn;
+ } else {
+ return '';
+ }
+ }
+ },
+ 'state_normal' => sub {
+ if ($c->{'encoder_warn_non_idle'}) {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe_to_normal;
+ } else {
+ return $warn_to_normal;
+ }
+ } else {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe_to_normal;
+ } elsif ($_[0]->{'state'} eq '-1') {
+ return $warn_to_normal;
+ } else {
+ return '';
+ }
+ }
+ },
+ },
},
# Info about the encoders after adding Blu-ray (Changeset 25058).
'xpath' => "//Status/Encoders/Encoder",
'protocol_version' => [ ">= 58" ],
'attrs' => [ qw/hostname id state devlabel connected/ ],
- 'template' => "__hostname__ (__id____devtype__) - __state____connected__",
+ 'template' => "__hostname__ (__id____devtype__) - __state_colour____state____state_normal____connected__",
'rewrite' => {
'/connected/' => { '1' => '', '0' => "${warn}(Disconnected)${warn_to_normal}" },
'/state/' => {
if ($_[0]->{'devlabel'} =~ /\[ (.+) :/) { ", $1" }
else { '' }
},
+ 'state_colour' => sub {
+ if ($c->{'encoder_warn_non_idle'}) {
+ warn "non idle";
+ if ($_[0]->{'state'} eq '0') {
+ return $safe;
+ } else {
+ return $warn;
+ }
+ } else {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe;
+ } elsif ($_[0]->{'state'} eq '-1') {
+ return $warn;
+ } else {
+ return '';
+ }
+ }
+ },
+ 'state_normal' => sub {
+ if ($c->{'encoder_warn_non_idle'}) {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe_to_normal;
+ } else {
+ return $warn_to_normal;
+ }
+ } else {
+ if ($_[0]->{'state'} eq '0') {
+ return $safe_to_normal;
+ } elsif ($_[0]->{'state'} eq '-1') {
+ return $warn_to_normal;
+ } else {
+ return '';
+ }
+ }
+ },
},
},
Suppress displaying idle encoders in the Encoders block.
+=item B<--encoder-warn-non-idle>
+
+Display warnings if an encoder is not idle. This is the default, it allows
+you to know if an encoder or the MythTV system is busy. To disable, use
+B<--no-encoder-warn-non-idle>.
+
=item B<-e, --episode>
Display the episode (subtitle) for the scheduled recordings.