'&date' => sub {
my ($value, $vars) = @_;
- if (defined $vars->{ISODate} && $vars->{ISODate} =~ /Z$/) {
- return process_iso_date($vars->{ISODate});
- } else {
- return $vars->{date} . ", " . $vars->{time};
- }
+ if (defined $vars->{ISODate} && $vars->{ISODate} =~ /Z$/) {
+ return process_iso_date($vars->{ISODate});
+ } else {
+ return $vars->{date} . ", " . $vars->{time};
+ }
},
},
},
'^1$' => "${warning}Watching LiveTV${normal}",
'^2$' => "${warning}Watching Pre-recorded${normal}",
'^3$' => "${warning}Watching Recording${normal}",
- '^4$' => "${warning}Recording${normal}" },
+ '^4$' => "${warning}Recording${normal}",
+ },
},
'filter' => {
'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 },
'^3$' => "${warning}Watching DVD${normal}",
'^4$' => "${warning}Watching Video${normal}",
'^5$' => "${warning}Watching Recording${normal}",
- '^6$' => "${warning}Recording${normal}" },
+ '^6$' => "${warning}Recording${normal}",
+ },
},
'filter' => {
'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 },
'^4$' => "${warning}Watching Blu-ray${normal}",
'^5$' => "${warning}Watching Video${normal}",
'^6$' => "${warning}Watching Recording${normal}",
- '^7$' => "${warning}Recording${normal}" },
+ '^7$' => "${warning}Recording${normal}",
+ },
},
'filter' => {
'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 },
'xpath' => "//Status/Encoders/Encoder/Program",
'hide' => 'after',
'attrs' => [ qw/title endTime channelName:.\/Channel[@channelName]
- encoderId:.\/Recording[@encoderId]
- chanNum:.\/Channel[@chanNum]/ ],
+ encoderId:.\/Recording[@encoderId]
+ chanNum:.\/Channel[@chanNum]/ ],
'template' => "__title__ (__channelName__) "
. ($c->{'encoder_details'} ? ", Enc: __encoderId__, Chan: __chanNum__ " : '')
. "Ends: __endTime__",
'&endTime' => sub {
my ($value, $vars) = @_;
- if ($value =~ /Z$/) {
- $value = process_iso_date($value, { date => 0 });
- } else {
- $value =~ s/.*T//;
- }
+ if ($value =~ /Z$/) {
+ $value = process_iso_date($value, { date => 0 });
+ } else {
+ $value =~ s/.*T//;
+ }
- return $value;
+ return $value;
},
},
'subs' => {
- 'find_next' =>
- sub {
- $warn_present ||= 1;
- $next_time = $c->{'date'} || 'now';
- }
- }
+ 'find_next' => sub {
+ $warn_present ||= 1;
+ $next_time = $c->{'date'} || 'now';
+ },
+ },
},
# The upcoming recordings.
if ($next_time eq 'Never' || Date_Cmp($date, $next_time) < 0) {
$next_time = $date
};
- }
- }
+ },
+ },
},
# Conflicts
'subs' => {
'percent' => sub {
calc_disk_space_percentage("$_[0]->{'_total_used'} $_[0]->{'_total_used_unit'}", "$_[0]->{'_total_total'} $_[0]->{'_total_total_unit'}")
- },
- }
+ },
+ },
},
# Diskspace, with storage groups
'subs' => {
'percent' => sub {
calc_disk_space_percentage("$_[0]->{'drive_total_used'} $_[0]->{'drive_total_used_unit'}", "$_[0]->{'drive_total_total'} $_[0]->{'drive_total_total_unit'}")
- }
- }
+ },
+ },
},
# Diskspace, with storage groups and sensible XML layout.
'subs' => {
'percent' => sub {
calc_disk_space_percentage("$_[0]->{'used'} $_[0]->{'used_unit'}", "$_[0]->{'total'} $_[0]->{'total_unit'}")
- }
- }
+ },
+ },
},
# Diskspace, with storage groups and sensible XML layout.
return ! (
(defined $c->{'display'}{'Disk Space'} && $c->{'display'}{'Disk Space'})
|| ($_[1]->{'used'} / $_[1]->{'total'}) * 100 > $c->{'disk_space_warn'})
- }
},
+ },
'subs' => {
'percent' => sub {
calc_disk_space_percentage("$_[0]->{'used'} $_[0]->{'used_unit'}", "$_[0]->{'total'} $_[0]->{'total_unit'}")
- }
- }
+ },
+ },
},
# How many hours till the next recording.
my $delta = DateCalc($c->{'date'} || 'now', $next_time, \$err, 1);
my $seconds = Delta_Format($delta, 'approx', 0, '%sh');
- # If the next recording is more than 1 day in the future,
- # print out the days and hours.
- my $str;
- if ($seconds > 24 * 3600) {
- $str = Delta_Format($delta, 0, '%dh Days, %hv Hours');
- } else {
- $str = Delta_Format($delta, 0, '%hh Hours, %mv Minutes');
- }
+ # If the next recording is more than 1 day in the future,
+ # print out the days and hours.
+ my $str;
+ if ($seconds > 24 * 3600) {
+ $str = Delta_Format($delta, 0, '%dh Days, %hv Hours');
+ } else {
+ $str = Delta_Format($delta, 0, '%hh Hours, %mv Minutes');
+ }
$str =~ s/\b1 (Day|Hour|Minute)s/1 $1/g;
$str =~ s/\b0 (Days|Hours)(, )?//;
}
return $str;
- }
},
+ },
'filter' => {
'next_time' => sub { return $_[0] eq 'now' }
- },
+ },
'sub' => sub {
return substitute_vars($_[0], { 'next_time' => $next_time });
- }
+ },
},
# Check how much Guide data we have
push @alerts, "GUIDE DATA";
return 0;
}
- },
},
+ },
'rewrite' => {
'&guideDays' => sub {
if ($_[0] <= $c->{'guide_days_warn'}) {
} else {
return "$safe$_[0]$normal";
}
- },
+ },
'/guideThru/' => { 'T\d+:\d+:\d+' => ' ' },
'&guideThru' => sub {
if ($_[1]->{'guideDays'} <= $c->{'guide_days_warn'}) {
} else {
return "$safe$_[0]$normal";
}
- },
},
+ },
},
{
'xpath' => '//Status/MachineInfo/Guide[@status=""]',
'template' => "${warning}No guide data!${normal}",
},
- );
+);
###
### Set some useful variables
if ($verbose) {
warn "Failed to load Perl API\n";
print $@;
- return undef;
+ return undef;
}
} elsif ($verbose) {
warn "Loaded Perl API\n";
foreach my $row (@{$rows{'rows'}}) {
my $show;
{
-
# MythTV::Program currently has a slightly broken line with a numeric
# comparision.
local($^W) = undef;
'channelName' => $show->{'channame'},
'inputId' => $show->{'inputid'},
'chanNum' => $show->{'channum'},
- );
+ );
my $str = substitute_vars($block, \%vars);
push @lines, decode('UTF-8', $str)
foreach my $row (reverse @{$rows{'rows'}}) {
my $show;
{
-
# MythTV::Program currently has a slightly broken line with a numeric
# comparision.
local($^W) = undef;
'channelName' => $show->{'callsign'},
'inputId' => $show->{'inputid'},
'chanNum' => $show->{'chanid'},
- );
+ );
my $str = substitute_vars($block, \%vars);
push @lines, decode('UTF-8', $str)
my $result;
warn "Our child has stopped talking to us, kill it off.\n";
do {
- kill 9, $pid;
+ kill 9, $pid;
$result = waitpid($pid, WNOHANG);
} while $result > 0;