summaryrefslogtreecommitdiffstats
path: root/abs/core
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2012-09-01 21:55:46 (GMT)
committerBritney Fransen <brfransen@gmail.com>2012-09-01 21:55:46 (GMT)
commit2fc24e3699697bf406338eea7b9f8c475399e79b (patch)
tree7a2693c501853ffc78ff69cf0c8c848b16ec731b /abs/core
parente0c0e2b0962375dfc62740cafd1620df719d4d31 (diff)
downloadlinhes_pkgbuild-2fc24e3699697bf406338eea7b9f8c475399e79b.zip
linhes_pkgbuild-2fc24e3699697bf406338eea7b9f8c475399e79b.tar.gz
linhes_pkgbuild-2fc24e3699697bf406338eea7b9f8c475399e79b.tar.bz2
LinHES-system: Add scripts for misc status in MythWeb. closes #845.
Diffstat (limited to 'abs/core')
-rw-r--r--abs/core/LinHES-system/LinHES-system.install12
-rw-r--r--abs/core/LinHES-system/PKGBUILD15
-rwxr-xr-xabs/core/LinHES-system/misc_recent_recordings.pl194
-rwxr-xr-xabs/core/LinHES-system/misc_status_config.py15
-rwxr-xr-xabs/core/LinHES-system/misc_status_info.sh23
-rwxr-xr-xabs/core/LinHES-system/misc_upcoming_recordings.pl328
-rwxr-xr-xabs/core/LinHES-system/misc_which_recorder.pl105
7 files changed, 690 insertions, 2 deletions
diff --git a/abs/core/LinHES-system/LinHES-system.install b/abs/core/LinHES-system/LinHES-system.install
new file mode 100644
index 0000000..f2185cd
--- /dev/null
+++ b/abs/core/LinHES-system/LinHES-system.install
@@ -0,0 +1,12 @@
+## arg 1: the new package version
+post_install() {
+ /usr/LH/bin/misc_status_config.py
+}
+
+## arg 1: the new package version
+## arg 2: the old package version
+post_upgrade() {
+ /usr/LH/bin/misc_status_config.py
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index cf2d688..9a62ccf 100644
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
pkgver=2
-pkgrel=53
+pkgrel=54
arch=('i686')
MVDIR=$startdir/pkg/usr/LH
BINDIR=$startdir/pkg/usr/bin
@@ -8,6 +8,7 @@ install=LinHES.install
pkgdesc="scripts and things related to having an automated system"
depends=(linhes-sounds xdotool fluxbox tilda keylaunch python_aosd 'linhes-scripts>=7-24' 'runit-scripts>=2.1.1-43' 'udisks' 'LinHES-config>=2.3-59')
backup=(etc/modprobe.d/alsa-base)
+install=LinHES-system.install
binfiles="LinHES-start optimize_mythdb.py
myth_mtc.py myth_mtc.sh LinHES-run
firstboot.sh load-modules-mythvantage.sh
@@ -21,7 +22,12 @@ binfiles="LinHES-start optimize_mythdb.py
lh_system_all_host_update
add_storage.py
diskspace.sh
- cacheclean lh_message.sh switch_web.sh"
+ cacheclean lh_message.sh switch_web.sh
+ misc_recent_recordings.pl
+ misc_status_config.py
+ misc_status_info.sh
+ misc_upcoming_recordings.pl
+ misc_which_recorder.pl"
source=(LinHES-session LinHES-profile.sh $binfiles alsa-base myth_mtc.lr
diskspace smolt.cron cacheclean.cron)
@@ -78,6 +84,11 @@ md5sums=('d1a5963c5a440a608031c6d750232633'
'9603b0ca6e090eff31e76482a3c335e7'
'b798ee0796d1b760a2998f90eb8ce9cc'
'4a3cd8f9b33b2b86fdba47a8f1fa2859'
+ '06a628469051237943b7c874f2e29b8a'
+ '0512f859cd5ea1d9eb972840caef2f0e'
+ '45f46d1f9193c8dde18e56369ec29a1e'
+ 'a8edbe7bc37e9932e8749d9f5f89c16f'
+ '14cea9e87654441b766a97576233ba5a'
'eb879fee9603a05d5420d4ce8ed9e450'
'f1870a9522c79e6b248fcbf81dec3280'
'84492954db16740f949d795b74383189'
diff --git a/abs/core/LinHES-system/misc_recent_recordings.pl b/abs/core/LinHES-system/misc_recent_recordings.pl
new file mode 100755
index 0000000..92dda8a
--- /dev/null
+++ b/abs/core/LinHES-system/misc_recent_recordings.pl
@@ -0,0 +1,194 @@
+#!/usr/bin/perl -w
+#
+# Outputs information about the most-recently-recorded shows.
+#
+# Automatically detects database settings.
+#
+
+# Includes
+ use DBI;
+ use Getopt::Long;
+ use MythTV;
+
+# Some variables we'll use here
+ our ($num_recordings, $live, $heading, $plain_text, $text_format, $usage);
+ our ($hours, $minutes, $seconds);
+ our ($dnum_recordings, $dheading, $dtext_format);
+ our ($dhours, $dminutes, $dseconds);
+ our ($status_text_format, $status_value_format);
+ our ($dstatus_text_format, $dstatus_value_format);
+
+# Default number of recent recordings to show
+ $dnum_recordings = 5;
+# Default period in which to show recordings
+ $dhours = -1;
+ $dminutes = -1;
+ $dseconds = -1;
+# Default status output heading
+ $dheading='Recent Recordings:\n';
+# Default format of plain-text output
+ $dtext_format='%n/%j, %g:%i %A - %cc\n%T - %S\n%R\n\n';
+# Default format of status output display text
+ $dstatus_text_format= '<a href="javascript:void(0)">%n/%j %g:%i %A - %cc - %T - %S<br />'.
+ '<span><strong>%T</strong> %n/%j, %g:%i %A<br />'.
+ '<em>%S</em><br /><br />%R<br /></span></a><hr />';
+# Default format of status output value
+ $dstatus_value_format = '%n/%j, %g:%i %A - %T - %S';
+
+# Provide default values for GetOptions
+ $num_recordings = $dnum_recordings;
+ $hours = $dhours;
+ $minutes = $dminutes;
+ $seconds = $dseconds;
+ $heading = $dheading;
+ $text_format = $dtext_format;
+ $status_text_format = $dstatus_text_format;
+ $status_value_format = $dstatus_value_format;
+
+# Load the cli options
+ GetOptions('num_recordings|recordings=s' => \$num_recordings,
+ 'hours|o=i' => \$hours,
+ 'minutes=i' => \$minutes,
+ 'seconds|e=i' => \$seconds,
+ 'live' => \$live,
+ 'heading=s' => \$heading,
+ 'plain_text' => \$plain_text,
+ 'text_format=s' => \$text_format,
+ 'status_text_format=s' => \$status_text_format,
+ 'status_value_format=s' => \$status_value_format,
+ 'usage|help' => \$usage
+ );
+
+# Print usage
+ if ($usage) {
+ print <<EOF;
+$0 usage:
+
+options:
+
+--recordings [number of recordings]
+
+ Outputs information on the last [number of recordings] shows recorded by
+ MythTV. To output information on all recordings, specify -1.
+
+ default: $dnum_recordings
+
+--hours [number of hours]
+
+ Outputs information on recordings that occurred within [number of hours].
+ This option may be specified in conjunction with --minutes and --seconds.
+ To output information on all matching recordings regardless of start time,
+ specify -1 for --hours, --minutes, and --seconds.
+
+ default: $dhours
+
+--minutes [number of minutes]
+
+ Outputs information on recordings that occurred within [number of minutes].
+ This option may be specified in conjunction with --hours and --seconds.
+ To output information on all matching recordings regardless of start time,
+ specify -1 for --hours, --minutes, and --seconds.
+
+ default: $dminutes
+
+--seconds [number of seconds]
+
+ Outputs information on recordings that occurred within [number of seconds].
+ This option may be specified in conjunction with --hours and --minutes.
+ To output information on all matching recordings regardless of start time,
+ specify -1 for --hours, --minutes, and --seconds.
+
+ default: $dseconds
+
+--live
+ Include information on recent LiveTV recordings.
+
+--heading [heading]
+ Output the [heading] before printing information about recordings.
+
+ default: \'$dheading\'
+
+--plain_text
+ Output information in plain text format (i.e. for inclusion in an e-mail
+ notification).
+
+--text_format [format]
+ Use the provided [format] to display information on the recordings. The
+ format should use the same format specifiers used by mythlink.pl, but
+ may also use \\r and/or \\n for line breaks. This option is ignored
+ if --plain_text is not used.
+
+ default: \'$dtext_format\'
+
+--help
+
+ Show this help text.
+
+EOF
+ exit;
+ }
+
+# Determine the period of interest
+ my $now = time();
+ my $start_after = $now;
+ $start_after = $start_after - ($hours * 3600) if ($hours > 0);
+ $start_after = $start_after - ($minutes * 60) if ($minutes > 0);
+ $start_after = $start_after - $seconds if ($seconds > 0);
+ $start_after = 0 if (!($start_after < $now));
+
+# Fix the heading.
+ if (defined($plain_text)) {
+ $heading =~ s/\\r/\r/g;
+ $heading =~ s/\\n/\n/g;
+ }
+ else {
+ # Remove line break format specifiers from heading for status output
+ $heading =~ s/(\\r|\\n)//g;
+ }
+
+# Connect to mythbackend
+ my $Myth = new MythTV();
+
+# Get the list of recordings
+ my $count = 0;
+ my %rows = $Myth->backend_rows('QUERY_RECORDINGS Delete');
+ our $show;
+ foreach my $row (@{$rows{'rows'}}) {
+ last unless (($count < $num_recordings) || ($num_recordings < 0));
+ $show = new MythTV::Program(@$row);
+ # Skip LiveTV recordings?
+ next unless (defined($live) || $show->{'recgroup'} ne 'LiveTV');
+ # Within the period of interest?
+ last if (($start_after) && ($show->{'recstartts'} < $start_after));
+ # Print the recording information in the desired format
+ if (defined($plain_text)) {
+ text_print($count);
+ }
+ else {
+ status_print($count);
+ }
+ $count++;
+ }
+
+# Print the output for use in the backend status page.
+ sub status_print {
+ my $count = shift;
+ my $text = $show->format_name($status_text_format, ' ', ' ', 1, 0 ,1);
+ my $value = $show->format_name($status_value_format, ' ', ' ',
+ 1, 0 ,1);
+ print("$heading<div class=\"schedule\">") if ($count == 0);
+ print("$text");
+ print("</div>") if ($count == ($num_recordings - 1));
+ print("[]:[]recording$count");
+ print("[]:[]$value\n");
+ }
+
+# Print the output in plain text format
+ sub text_print {
+ my $count = shift;
+ my $text = $show->format_name($text_format, ' ', ' ', 1, 0 ,1);
+ $text =~ s/\\r/\r/g;
+ $text =~ s/\\n/\n/g;
+ print("$heading") if ($count == 0);
+ print("$text");
+ }
diff --git a/abs/core/LinHES-system/misc_status_config.py b/abs/core/LinHES-system/misc_status_config.py
new file mode 100755
index 0000000..0a0ba6c
--- /dev/null
+++ b/abs/core/LinHES-system/misc_status_config.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python2
+
+# This script will configure the myth db to use the misc_status_info scripts
+
+from socket import gethostname
+from MythTV import MythDB
+mythdb = MythDB()
+localhostname = gethostname()
+
+# mythtv-setup
+if mythdb.settings[localhostname].MiscStatusScript == u'':
+ mythdb.settings[localhostname].MiscStatusScript = u'/usr/LH/bin/misc_status_info.sh'
+ print 'The MythTV database setting MiscStatusScript was updated to /usr/LH/bin/misc_status_info.sh.'
+else:
+ print 'The MythTV database setting MiscStatusScript is already set and will not be updated.'
diff --git a/abs/core/LinHES-system/misc_status_info.sh b/abs/core/LinHES-system/misc_status_info.sh
new file mode 100755
index 0000000..14a972c
--- /dev/null
+++ b/abs/core/LinHES-system/misc_status_info.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Show all upcoming conflicts
+/usr/LH/bin/misc_upcoming_recordings.pl --recordings -1 \
+ --no_show_scheduled \
+ --heading '<h3>Recording Conflicts</h3>' \
+ --no_conflicts_message '<h3>No Recording Conflicts</h3>'
+
+# Show all the shows recorded today
+/usr/LH/bin/misc_recent_recordings.pl --recordings=-1 --hours=24 \
+ --heading '<h3>Shows Recorded In The Last 24 Hours</h3>'
+
+# Get Encoder that was used for recordings from the backend log
+firstrun=1
+loglist=`find /var/log/ -name *_mythbackend.*.log*`
+for i in `ls -t $loglist`
+do
+ if [ $firstrun -eq 1 ]; then
+ echo "<h3>Encoder Information</h3><div class=\"schedule\""
+ firstrun=0
+ fi
+ /usr/LH/bin/misc_which_recorder.pl --noheader $i
+done
diff --git a/abs/core/LinHES-system/misc_upcoming_recordings.pl b/abs/core/LinHES-system/misc_upcoming_recordings.pl
new file mode 100755
index 0000000..377c2dc
--- /dev/null
+++ b/abs/core/LinHES-system/misc_upcoming_recordings.pl
@@ -0,0 +1,328 @@
+#!/usr/bin/perl -w
+#
+# Provides notification of upcoming recordings.
+#
+# Automatically detects database settings.
+#
+
+# Includes
+ use DBI;
+ use Getopt::Long;
+ use MythTV;
+
+# Some variables we'll use here
+ our ($num_recordings, $heading, $plain_text, $text_format, $usage);
+ our ($hours, $minutes, $seconds, $no_conflicts_message);
+ our ($scheduled, $duplicates, $deactivated, $conflicts);
+ our ($dnum_recordings, $dheading, $dtext_format);
+ our ($dhours, $dminutes, $dseconds, $dno_conflicts_message);
+ our ($dscheduled, $dduplicates, $ddeactivated, $dconflicts);
+ our ($status_text_format, $status_value_format);
+ our ($dstatus_text_format, $dstatus_value_format);
+
+# Default number of upcoming recordings to show
+ $dnum_recordings = 5;
+# Default period in which to show recordings
+ $dhours = -1;
+ $dminutes = -1;
+ $dseconds = -1;
+# Default recording status types to show
+ $dscheduled = 1;
+ $dduplicates = 0;
+ $ddeactivated = 0;
+ $dconflicts = 1;
+# Default status output heading
+ $dheading='Upcoming Recordings:\n';
+# Default format of plain-text output
+ $dtext_format='%rs\n%n/%j, %g:%i %A - %cc\n%T - %S\n%R\n\n';
+# Default "no conflicts" message
+ $dno_conflicts_message='No conflicts.\n';
+# Default format of status output display text
+ $dstatus_text_format= '<a href="javascript:void(0)">%rs - %n/%j %g:%i %A - %cc - '.
+ '%T - %S<br />'.
+ '<span><strong>%T</strong> %n/%j, %g:%i %A<br />'.
+ '<em>%S</em><br /><br />%R<br /></span></a><hr />';
+# Default format of status output value
+ $dstatus_value_format = '%n/%j %g:%i %A - %T - %S';
+
+# Provide default values for GetOptions
+ $num_recordings = $dnum_recordings;
+ $hours = $dhours;
+ $minutes = $dminutes;
+ $seconds = $dseconds;
+ $scheduled = $dscheduled;
+ $duplicates = $dduplicates;
+ $deactivated = $ddeactivated;
+ $conflicts = $dconflicts;
+ $heading = $dheading;
+ $text_format = $dtext_format;
+ $no_conflicts_message = $dno_conflicts_message;
+ $status_text_format = $dstatus_text_format;
+ $status_value_format = $dstatus_value_format;
+
+# Load the cli options
+ GetOptions('num_recordings|recordings=s' => \$num_recordings,
+ 'hours|o=i' => \$hours,
+ 'minutes=i' => \$minutes,
+ 'seconds|s=i' => \$seconds,
+ 'show_scheduled|_show_scheduled|scheduled|_scheduled|e!'
+ => \$scheduled,
+ 'show_duplicates|_show_duplicates|duplicates|_duplicates|p!'
+ => \$duplicates,
+ 'show_deactivated|_show_deactivated|deactivated|_deactivated|v!'
+ => \$deactivated,
+ 'show_conflicts|_show_conflicts|conflicts|_conflicts!'
+ => \$conflicts,
+ 'heading=s' => \$heading,
+ 'plain_text' => \$plain_text,
+ 'text_format=s' => \$text_format,
+ 'no_conflicts_message=s' => \$no_conflicts_message,
+ 'status_text_format=s' => \$status_text_format,
+ 'status_value_format=s' => \$status_value_format,
+ 'usage|help' => \$usage
+ );
+
+# Print usage
+ if ($usage) {
+ # Make default "--show_*" options readable
+ $dscheduled = ($dscheduled ? '--show_scheduled' :
+ '--no_show_scheduled');
+ $dduplicates = ($dduplicates ? '--show_duplicates' :
+ '--no_show_duplicates');
+ $ddeactivated = ($ddeactivated ? '--show_deactivated' :
+ '--no_show_deactivated');
+ $dconflicts = ($dconflicts ? '--show_conflicts' :
+ '--no_show_conflicts');
+ print <<EOF;
+$0 usage:
+
+options:
+
+--recordings [number of recordings]
+
+ Outputs information on the next [number of recordings] shows to be recorded
+ by MythTV and that match the criteria specified for --scheduled,
+ --duplicates, --deactivated, and --conflicts. To output information on all
+ matching recordings, specify -1.
+
+ default: $dnum_recordings
+
+--hours [number of hours]
+
+ Outputs information on recordings starting in the next [number of hours]
+ and that match the criteria specified for --scheduled, --duplicates,
+ --deactivated, and --conflicts. This option may be specified in
+ conjunction with --minutes and --seconds. To output information on all
+ matching recordings regardless of start time, specify -1 for --hours,
+ --minutes, and --seconds.
+
+ default: $dhours
+
+--minutes [number of minutes]
+
+ Outputs information on recordings starting in the next [number of minutes]
+ and that match the criteria specified for --scheduled, --duplicates,
+ --deactivated, and --conflicts. This option may be specified in
+ conjunction with --hours and --seconds. To output information on all
+ matching recordings regardless of start time, specify -1 for --hours,
+ --minutes, and --seconds.
+
+ default: $dminutes
+
+--seconds [number of seconds]
+
+ Outputs information on recordings starting in the next [number of seconds]
+ and that match the criteria specified for --scheduled, --duplicates,
+ --deactivated, and --conflicts. This option may be specified in
+ conjunction with --hours and --minutes. To output information on all
+ matching recordings regardless of start time, specify -1 for --hours,
+ --minutes, and --seconds.
+
+ default: $dseconds
+
+--show_scheduled|--no_show_scheduled
+
+ Outputs information about scheduled recordings. Scheduled recordings are
+ those that MythTV plans to actually record.
+
+ default: $dscheduled
+
+--show_duplicates|--no_show_duplicates
+
+ Outputs information about duplicate recordings. Duplicate recordings are
+ those that will not be recorded because of the specified duplicate matching
+ policy for the rule.
+
+ default: $dduplicates
+
+--show_deactivated|--no_show_deactivated
+
+ Outputs information about deactivated recordings. Deactivated recordings
+ are those that MythTV will not record because the schedule is inactive,
+ because the showing was set to never record, because the show is being
+ recorded in an earlier or later showing, because there are too many
+ recordings or not enough disk space to allow the recording, or because
+ the show you\'ve specified for recording is not listed in the timeslot
+ specified.
+
+ default: $ddeactivated
+
+--show_conflicts|--no_show_conflicts
+
+ Outputs information about conflicts (those shows that MythTV cannot record
+ because of other higher-priority scheduled recordings).
+
+ default: $dconflicts
+
+--heading [heading]
+ Output the [heading] before printing information about recordings.
+
+ default: \'$dheading\'
+
+--plain_text
+ Output information in plain text format (i.e. for inclusion in an e-mail
+ notification).
+
+--text_format [format]
+ Use the provided [format] to display information on the recordings. The
+ format should use the same format specifiers used by mythlink.pl, but
+ may also use \\r and/or \\n for line breaks and %rs for recording status.
+ This option is ignored if --plain_text is not used.
+
+ default: \'$dtext_format\'
+
+--no_conflicts_message [message]
+ Use the provided [message] to specify there are no conflicts. This option
+ is used when only information about conflicts is requested and there are
+ no conflicts. I.e. it is only used with the combination of show_*
+ options --show_conflicts, --no_show_scheduled, --no_show_deactivated,
+ and --no_show_duplicates .
+
+ default: \'$dno_conflicts_message\'
+
+--help
+
+ Show this help text.
+
+EOF
+ exit;
+ }
+
+# Determine the period of interest
+ my $now = time();
+ my $start_before = $now;
+ $start_before = $start_before + ($hours * 3600) if ($hours > 0);
+ $start_before = $start_before + ($minutes * 60) if ($minutes > 0);
+ $start_before = $start_before + $seconds if ($seconds > 0);
+ $start_before = 0 if (!($start_before > $now));
+
+# Fix the heading.
+ if (defined($plain_text)) {
+ $heading =~ s/\\r/\r/g;
+ $heading =~ s/\\n/\n/g;
+ }
+ else {
+ # Remove line break format specifiers from heading for status output
+ $heading =~ s/(\\r|\\n)//g;
+ }
+
+# Connect to mythbackend
+ my $Myth = new MythTV();
+
+# Get the list of recordings
+ my $count = 0;
+ my %rows = $Myth->backend_rows('QUERY_GETALLPENDING', 2);
+ my $has_conflicts = $rows{'offset'}[0];
+ if ((!$has_conflicts) &&
+ (($conflicts) &&
+ (!(($scheduled) || ($duplicates) || ($deactivated))))) {
+ $no_conflicts_message =~ s/\\r/\r/g;
+ $no_conflicts_message =~ s/\\n/\n/g;
+ print "$no_conflicts_message";
+ exit 0;
+ }
+ my $num_scheduled = $rows{'offset'}[1];
+ our $show;
+ foreach my $row (@{$rows{'rows'}}) {
+ last unless (($count < $num_recordings) || ($num_recordings < 0));
+ $show = new MythTV::Program(@$row);
+ last if (($start_before) && ($show->{'recstartts'} > $start_before));
+ next if ((!$scheduled) && (is_scheduled($show->{'recstatus'})));
+ next if ((!$duplicates) && (is_duplicate($show->{'recstatus'})));
+ next if ((!$deactivated) && (is_deactivated($show->{'recstatus'})));
+ next if ((!$conflicts) && (is_conflict($show->{'recstatus'})));
+
+ # Print the recording information in the desired format
+ if (defined($plain_text)) {
+ text_print($count);
+ }
+ else {
+ status_print($count);
+ }
+ $count++;
+ }
+
+# Returns true if the show is scheduled to record
+ sub is_scheduled {
+ my $recstatus = (shift() or 0);
+ return (($MythTV::recstatus_willrecord == $recstatus) ||
+ ($MythTV::recstatus_recorded == $recstatus) ||
+ ($MythTV::recstatus_recording == $recstatus));
+ }
+
+# Returns true if the show is a duplicate
+ sub is_duplicate {
+ my $recstatus = (shift() or 0);
+ return (($MythTV::recstatus_repeat == $recstatus) ||
+ ($MythTV::recstatus_previousrecording == $recstatus) ||
+ ($MythTV::recstatus_currentrecording == $recstatus));
+ }
+
+# Returns true if the recording is deactivated
+ sub is_deactivated {
+ my $recstatus = (shift() or 0);
+ return (($MythTV::recstatus_inactive == $recstatus) ||
+ ($MythTV::recstatus_toomanyrecordings == $recstatus) ||
+ ($MythTV::recstatus_cancelled == $recstatus) ||
+ ($MythTV::recstatus_deleted == $recstatus) ||
+ ($MythTV::recstatus_aborted == $recstatus) ||
+ ($MythTV::recstatus_notlisted == $recstatus) ||
+ ($MythTV::recstatus_dontrecord == $recstatus) ||
+ ($MythTV::recstatus_lowdiskspace == $recstatus) ||
+ ($MythTV::recstatus_tunerbusy == $recstatus) ||
+ ($MythTV::recstatus_neverrecord == $recstatus) ||
+ ($MythTV::recstatus_earliershowing == $recstatus) ||
+ ($MythTV::recstatus_latershowing == $recstatus));
+ }
+
+# Returns true if the show cannot be recorded due to a conflict
+ sub is_conflict {
+ my $recstatus = (shift() or 0);
+ return ($MythTV::recstatus_conflict == $recstatus);
+ }
+
+# Print the output for use in the backend status page.
+ sub status_print {
+ my $count = shift;
+ my $text = $show->format_name($status_text_format, ' ', ' ', 1, 0 ,1);
+ $text =~ s/%rs/$MythTV::RecStatus_Types{$show->{'recstatus'}}/g;
+ my $value = $show->format_name($status_value_format, ' ', ' ',
+ 1, 0 ,1);
+ $value =~ s/%rs/$MythTV::RecStatus_Types{$show->{'recstatus'}}/g;
+ print("$heading<div class=\"schedule\">") if ($count == 0);
+ print("$text");
+ print("</div>") if ($count == ($num_recordings - 1));
+ print("[]:[]recording$count");
+ print("[]:[]$value\n");
+ }
+
+# Print the output in plain text format
+ sub text_print {
+ my $count = shift;
+ my $text = $show->format_name($text_format, ' ', ' ', 1, 0 ,1);
+ $text =~ s/%rs/$MythTV::RecStatus_Types{$show->{'recstatus'}}/g;
+ $text =~ s/\\r/\r/g;
+ $text =~ s/\\n/\n/g;
+ print("$heading") if ($count == 0);
+ print("$text");
+ }
diff --git a/abs/core/LinHES-system/misc_which_recorder.pl b/abs/core/LinHES-system/misc_which_recorder.pl
new file mode 100755
index 0000000..f8a1022
--- /dev/null
+++ b/abs/core/LinHES-system/misc_which_recorder.pl
@@ -0,0 +1,105 @@
+#!/usr/bin/perl -w
+#
+# Parses the backend log file and includes information on which encoder was used to record shows.
+
+my ($time, $title, $subtitle, $chanid, $cardid, $sourceid);
+my $index = 0;
+
+sub print_text
+{
+ print "$time - $title";
+ print ": $subtitle" if ($subtitle);
+ print "\n";
+ print " - Encoder ID: $cardid\n";
+ print " - Video Source ID: $sourceid\n";
+ print " - Channel ID: $chanid\n";
+}
+
+sub print_xml
+{
+ print "<a href=\"javascript:void(0)\">$time - $title";
+ print ": $subtitle" if ($subtitle);
+ print " - Encoder: $cardid<br />".
+ "<span><strong>$title</strong> $time<br />";
+ print "<em>$subtitle</em><br />" if ($subtitle);
+ print "<br />Channel ID: $chanid<br />Encoder ID: $cardid<br />".
+ "Video Source ID: $sourceid<br /></span></a><hr />";
+ # For XML parsers
+ print "[]:[]capture_info$index\[]:[]time='$time':title='$title'".
+ ":subtitle='$subtitle':chanid='$chanid':cardid='$cardid'".
+ ":sourceid='$sourceid'\n";
+}
+
+my $mode = shift;
+my $log_file = shift;
+
+if (($mode ne "--text") && ($mode ne "--noheader"))
+{
+ $log_file = $mode;
+}
+
+if ($log_file =~ m/^--.*/i)
+{
+ die ("Only one option can be used at a time.\n");
+}
+
+if ($log_file =~ /\.gz$/)
+{
+# read top down
+# open($fh, "gunzip -c $log_file |") or die "Unable to open log file '$log_file', stopping:";
+ open($fh, "gunzip -c $log_file |tac |") or die "Unable to open log file '$log_file', stopping:";
+}
+else
+{
+# read top down
+# open($fh, "<$log_file") or die "Unable to open log file '$log_file', stopping:";
+ open($fh, "tac $log_file |") or die "Unable to open log file '$log_file', stopping:";
+}
+
+while (<$fh>)
+{
+# Myth .24 regex to find start of recording
+# if (/^(.*)(?:\d(?: I )?|I.* -) (?:Started|Tuning) recording: (.*): channel (\d+) on cardid (\d+), sourceid (\d+)/)
+ if (/^(\d+-\d+-\d+T\d+\:\d+\:\d+)(?:.*) (?:Started|Tuning) recording: (.*): channel (\d+) on cardid (\d+), sourceid (\d+)/)
+ {
+ if ($mode eq "--noheader")
+ {
+ print "<div class=\"schedule\">"
+ if (($index == 0) && ($mode ne "--text"));
+ }
+ else
+ {
+ print "<h3>Encoder Information</h3><div class=\"schedule\">"
+ if (($index == 0) && ($mode ne "--text"));
+ }
+ $index++;
+
+ ($time, $title, $chanid, $cardid, $sourceid) = ($1, $2, $3, $4, $5);
+ $time = `date -d $time +%a' '%m/%d' '%H:%M' '%p`;
+ chomp ($time);
+ if (($title =~ /"?(.+)"?:"?(.*)"?/) || ($title =~ /(.+) "(.*)"/))
+ {
+ $title = $1;
+ $subtitle = $2;
+ }
+ else
+ {
+ $subtitle = '';
+ }
+ $title =~ s/^"//;
+ $subtitle =~ s/^"//;
+ $title =~ s/"$//;
+ $subtitle =~ s/"$//;
+ if ($mode eq "--text")
+ {
+ print_text;
+ }
+ else
+ {
+ print_xml;
+ }
+ }
+}
+print "</div>" if (($index > 0) && ($mode ne "--text"));
+
+close $fh;