[mythtv-users] MythTV Status in your MOTD
Michael T. Dean
mtdean at thirdcontact.com
Fri Nov 16 20:47:11 UTC 2007
On 11/15/2007 03:23 PM, Andrew Ruthven wrote:
> The other day I was recompiling some kernels during the day on our
> MythTV backend, which at the time happened to be recording my wifes
> favourite program (Grey's Anatomy, we discovered it part way through the
> season, so the repeats are good). It turns out the compiling caused
> some issues with the recording (which reduced the WAF).
> So to increase the WAF, I'm making sure this doesn't happen again. I've
> written a script that spits out the MythTV status which is then
> displayed in the MOTD.
> I've found this is a pretty effective way of letting me know of any
> upcoming recordings and what is going to be happening on the system in
> the next little while. It is a whole lot easier than using the status
> page on MythWeb.
> I thought some of you might be interested. If you are, check out:
> Sample output:
> MythTV status for localhost
> Status: Mon Oct 15 2007, 8:41 AM
> cerberus (9) - Idle
> cerberus (12) - Idle
> Scheduled Recordings:
> 2007-10-15 13:30:00 - Grey's Anatomy
> 2007-10-15 18:00:00 - 3 News
> 2007-10-15 20:30:00 - Mythbusters
> 2007-10-15 22:00:00 - Flight Of The Conchords
> 2007-10-16 13:30:00 - Grey's Anatomy
> 2007-10-16 18:00:00 - 3 News
> I run Debian, so there is a .deb. For those not running Debian there is
> a tarball (but the MOTD updating glue is Debian specific at the moment).
> For those interested in hacking there is a git repository.
> Hopefully I'm not the only one that finds this useful.
SVN trunk already has a script, myth_upcoming_recordings.pl, which could
be used to get the recording output. It also has the benefit
that--since it doesn't use the backend status page--it won't crash your
backend when polling (it was actually put in trunk as an example script
when we added miscellaneous status support so we could take the
lm-sensors stuff--which has been known to cause some instability in the
backend status page--out of Myth).
As far as the encoder status, that may be something that can be obtained
through the bindings, but I haven't looked (as I hadn't yet found a
reason to do so). The script doesn't do the current time, though it
could be added (or even added by the mythtv_update_motd script, which,
presumably, would be used to call the myth_upcoming_recordings.pl script
with appropriate arguments to get the recordings list.
contrib/misc_status_info/myth_upcoming_recordings.pl --plain_text \
--text_format '%Y-%n-%j %H:%i:%s %T - %S\n' \
--heading 'MythTV status for localhost\n'
Gives output like you showed above, but with the subtitle (as someone
requested in the thread). Adding "%R\n\n" to the end of the text_format
would give the description (with an extra blank line to make it more
readable). Adding "%rs\n" at the beginning would print out the
recording status (i.e. WillRecord or Conflict or whatever), too, or you
can add --no_show_conflicts to get only scheduled recordings. The
script also supports getting a list of only conflicts, printing
information about any number of recordings (--recordings) or only about
recordings that will occur within some specified amount of time
(--hours, --minutes, and --seconds). See --help output for more.
For those not using trunk, polling the status page is a relatively
straightforward approach, though, using the output of mythbackend
--printsched may be a more stable approach.
Anyway, just thought I'd mention myth_upcoming_recordings.pl. There's
another script, myth_recent_recordings.pl that does basically the same
thing, but looking to the past instead of the future.
More information about the mythtv-users