LinHES Forums http://forum.linhes.org/ |
|
Method of displaying recording programs on a VFD/LCD display http://forum.linhes.org/viewtopic.php?f=3&t=6216 |
Page 1 of 1 |
Author: | no2u [ Tue Sep 27, 2005 9:02 pm ] |
Post subject: | Method of displaying recording programs on a VFD/LCD display |
I just assembled a little HD44780-based LCD display that uses the LCDd driver and built it into the front of my Myth box (I ran the parallel cable through the inside of the case). Instructions for LCDd and wiring up such a display are available here: http://lcdproc.omnipotent.net/ As mentioned elsewhere, of course LCDd support is already in Knoppmyth (thanks Cesman!) but you must configure LCDd.conf and start LCDd, perhaps via a line like this in bootmisc.sh: Quote: /etc/init.d/LCDd start After getting it all working, I thought the LCD display was neat, but using setup in MythTV 0.18 I could not find any option to display TV program titles on the LCD display as they are being recorded. For example, my wife asks if program X is being recorded and we'd end up having to turn on the TV (or stop watching something else) to make sure -- but not anymore... Perhaps there's a better way to do this, but below is a little perl script I wrote that goes through the mythbackend.log file and displays the title of the last 2 shows that started recording (today) and the time that the recording started. To use it, save the text below as "/usr/local/bin/lcdrec.pl" and use "chmod a+x lcdrec.pl" to make it executable (you might also have to fix the end-line characters since this was pasted via windows). Then go into webmin and set up a crontab entry to make it execute at 00 and 30 minutes past the hour, every hour. Also, be sure to disable the LCD support in the mythfrontend so it doesn't overwrite what's displayed on the screen. 9/29 UPDATE: To use this, you must also modify /etc/init.d/LCDd to add "-i" to DAEMON_OPTS, so that LCDd does not revert back to the server screen when no TCP clients are connected. For example: Quote: DAEMON_OPTS="-i -s -f -c /etc/LCDd.conf" I hope someone else finds this useful. Quote: #!/usr/bin/perl -w
# # lcdrec.pl - display MythTV recording programs to a VFD/LCD display # Mark Thompson 2005 # # Use webmin to add a crontab entry to execute this at 00 and 30 # minutes past each hour # use IO::Socket; use Fcntl; use strict; my $path = "/var/log/mythtv/mythbackend.log"; # Sleep a few seconds to make sure that myth logfile has been updated; sleep 10; # Open mythbackend.log to check recording history sysopen( LOGFILE, $path, O_RDONLY | O_NONBLOCK ) || die "Cannot read logfile $path\n"; # Open TCP port to LCDd my $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "localhost", PeerPort => 13666)|| die "Cannot connect to LCDd\n"; $remote->autoflush(1); sleep 1; # give the server time to notice us... print $remote "hello\n"; # we must read the response even if we ignore it: my $lcdresponse = <$remote>; # Turn off blocking mode... fcntl($remote, F_SETFL, O_NONBLOCK); # Set up some screen widgets... print $remote "client_set name lcdmsg\n"; $lcdresponse = <$remote>; print $remote "screen_add scr1\n"; $lcdresponse = <$remote>; print $remote "screen_set scr1 -duration 10 -priority 2 -heartbeat off\n"; $lcdresponse = <$remote>; print $remote "widget_add scr1 wid1 string\n"; $lcdresponse = <$remote>; print $remote "widget_add scr1 wid2 string\n"; $lcdresponse = <$remote>; # my $s; my $t; my $l1; my $l2; while( $s = <LOGFILE> ) { if ($s =~ /scheduler:/) {} else { #(move this # to the next line down if you want to finished recordings #to be displayed as well:) # if ($s =~ /recording/) if ($s =~ /Started recording/) { $t = substr($s, 11, 5); if ($s =~ /Started recording/) { $s = substr($s, index($s, "Started recording")+18); $s = "$t $s"; } else { if ($s =~ /Finished recording/) { $s = substr($s, index($s, "Finished recording")+19); $s = "$t f:$s"; } } $_ = substr($s, 0, rindex($s, " on channel")); tr/"'//d; $l1=$l2; $l2=$_; } } } close(LOGFILE); # I'm assuming here that the LCD is only 2 lines if ($l1) { print $remote "widget_set scr1 wid1 1 1 \"$l1\"\n"; $lcdresponse = <$remote>; } if ($l2) { print $remote "widget_set scr1 wid2 1 2 \"$l2\"\n"; $lcdresponse = <$remote>; } # sleep so TCP connection will stay open until LCD has been updated sleep 5; |
Author: | cesman [ Tue Sep 27, 2005 9:24 pm ] |
Post subject: | |
![]() You're welcome. Cool little program! |
Author: | Kamy [ Tue Jan 03, 2006 10:10 pm ] |
Post subject: | |
I ran through al the steps to run this with the exception of editing /etc/crontab to get lcdrec.pl to run every half hour. Could some show me the edits that need to be made to /etc/crontab in order to Quote: set up a crontab entry to make it execute at 00 and 30 minutes past the hour, every hour.
I looked at it, but I'm not sure what to write where... Code: # /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file. # This file also has a username field, that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily 47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly 52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly # Thanks much! |
Author: | tjc [ Tue Jan 03, 2006 10:24 pm ] |
Post subject: | |
Kamy wrote: Code: # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file. # This file also has a username field, that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily 47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly 52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly # Add a line like this: Code: 0,30 * * * * root /the/full/path/to/your/script/here.pl
|
Author: | Kamy [ Wed Jan 04, 2006 4:29 am ] |
Post subject: | |
Thanks tjc, I'll give it a shot after work today. |
Author: | no2u [ Wed Jan 04, 2006 7:11 pm ] |
Post subject: | |
FYI, you can also set up crontab jobs via webmin: While running webmin, select the "System" tab, then select "Scheduled Cron Jobs", then "Create a new cron job". Enter "root" as the user to execute this cron job, enter the full path to the command, click "Selected" under minutes, then choose 1 and 31 under Minutes. (I've selected 1 and 31 minutes past each hour since some networks like to start shows at one minute past the hour). |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |