LinHES Forums
http://forum.linhes.org/

MythTV PlayTimer (mythalarm alternative) scripts working?
http://forum.linhes.org/viewtopic.php?f=11&t=10067
Page 1 of 1

Author:  randomhtpcguy [ Tue May 16, 2006 12:44 pm ]
Post subject:  MythTV PlayTimer (mythalarm alternative) scripts working?

My goal is to have the mythfrontend wake me up with either the newest episode of a particular tv show it recorded or to play the most recent podcast in a series.

I used to do something very similar years ago on the pc in my bedroom using jriver mediacenter's smartlist (smart playlist) and a the scheduler and it worked great with video and music but i converted to linux for mythtv and stability. One day a nice plugin MythAlarm would be great, but for now I'd be happy if I could get a simple script working with cron that would play for example the 6am TV news at 7am after mythcommflag had run. Every other morning it would do a music scan of the directory that my podcasts download to. Then it would have mythmusic play the smartlist that begins with the newest podcast.

Sounds easy to me, but I have not figured it out yet. A CLI to mythfrontend would be the optimal I guess and people seem to not like LIRC (with jump points and keybindings)because there is no feedback to make sure commands work.

This link looks most promising now.

http://www.mythtv.org/wiki/index.php/TV_Wakeup_Timer

The script failed for me. I couldn't even telnet localhost 6546, connection refused. I would rather use ssh of course, but it fails too.

http://www.mythtv.org/docs/mythtv-HOWTO-11.html#ss11.6

http://ubuntu.wordpress.com/2006/01/22/ ... -an-alarm/

Author:  nickread [ Wed May 17, 2006 4:29 am ]
Post subject: 

Quote:
I couldn't even telnet localhost 6546

Have you enabled the telnet interface to the mythfront end? Its off by default. Its somewhere under settings...

Author:  randomhtpcguy [ Wed May 17, 2006 9:47 am ]
Post subject: 

Ok. I got this to work and i love it. A very simple solution now that i learned a little bit more about linux.

i enabled the TCP port front end remote telnet socket option under Settings>General>General as mentioned and restarted the frontend.

Code:
/etc/init.d/gdm restart


Its called telnet but you don't need to turn on telnet in inet.d or install telnetd or anything because it uses a socket connection to localhost to the mythfrontend. Anyway, there was two issues for me.

1. It didn't work from root but did work from user mythtv
Code:
root@mythtvmaster:/home/mythtv# telnet mythtvmaster 6546
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused


2. I needed a pearl module, but i had never used perl.

Code:
#!/usr/bin/perl

use Net::Telnet;

$host = "localhost";
$port = 6546;
$channel = 26;

$telnet = new Net::Telnet ( Timeout=>10,
                            Port=>$port,
                            Errmode=>'die');

my $length = length($channel);
my $counter = 0;
my $temp;

$telnet->open( $host );

$telnet->waitfor('/#/i');
$telnet->print('jump playbackrecordings');
$telnet->waitfor('/#/i');
$telnet->print('key enter');
$telnet->waitfor('/#/i');
$telnet->print('key enter');
$telnet->waitfor('/#/i');
$telnet->print('exit');


3. I needed the Net::Telnet module

From memory this is what i did:

/usr/src# perl -MCPAN -e shell

follow configuration

install Term::ReadLine
install Term::ReadKey
install CPAN:Bundle


cpan> install Net:Telnet
Net::Telnet is up to date (3.03).

Now the perl script worked.

Obviously this is rough.
If there is any interest I will go through this more carefully and make a wiki page. Please comment below if you try this with your corrections or suggestions.

I use the script to simply play the most recent recording to wake me up. It works very well. It happens to be the morning news every day. I'd be interested if anyone knows how to play a search result or a filter for say the most recent colbert report recorded. Probably not possible yet unless you have a predictable recording schedule and use the down key a certain number of times. This should work well with mythtmusic too. Shouldn't be long before some smart person adds a config to mythweb thus reviving the mythalarm concept.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/