View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 6 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Auto-start 'Watch TV'?
PostPosted: Tue Oct 09, 2007 4:47 pm 
Offline
Joined: Sat Feb 25, 2006 8:14 pm
Posts: 5
Location: Rhinebeck, NY
Hi everyone. - I would like to find a way to have KnoppMyth automatically go straight into "Watch TV" mode upon boot. I've set up a KnoppMyth box to output a signal to televisions in a public viewing area (a college cafeteria). I've then used mythtvosd to set up scrolling text messages across the screen that are generated through a web page (informational messages related to cancelled classes, etc.). I would like the system to be comletely hands off, and able to recover all by itself from power interruptions, etc. At this point, everything works great except that one has to physically hit the enter key to select "Watch TV" to get things started. Does anyone know of a way to have mythfrontend start up and go directly into watch tv mode instead of waiting at the main menu? I haven't been able to find anything on the forum or through Google so far. Many thanks for any ideas!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 09, 2007 5:06 pm 
Offline
Joined: Fri Nov 18, 2005 9:22 am
Posts: 777
Location: spencerport, ny (USA)
You could probably figure out whatever command the web-based menu system uses, and go that way. Just insert a script in the startup somewhere. This would probably be a good admin tool for you (telnet/socket/web-based remote control), as you could control the boxes remotely. i.e. switch channels to breaking news, etc..

I haven't done this, but it's one approach.
Another one would be to see how LIRC works


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 09, 2007 5:08 pm 
Offline
Joined: Tue Mar 22, 2005 9:18 pm
Posts: 1422
Location: Brisbane, Queensland, Australia
Looking around you could probably write a script that connects to the telnet socket of MythTV and command it that way. In theory you should be able to do it locally after the frontend has started.

Here is the MythTV Doco: http://www.mythtv.org/docs/mythtv-HOWTO-11.html#ss11.6. There is also more info in the wiki: http://www.mythtv.org/wiki/index.php/Telnet_socket.

So the theory is:
1. Start up computer
2. Start mythfrontend
3. Pause giving frontend time to start
4. Telnet to local computer
5. issue command to start livetv

If you do write a script to do this, it would be nice if you posted it back to share it with the rest of the group.

Good luck.

_________________
Girkers


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 10, 2007 12:04 pm 
Offline
Joined: Sat Feb 25, 2006 8:14 pm
Posts: 5
Location: Rhinebeck, NY
Thank you for the excellent guidance!

I did manage to get this to work using telnet in a script on the local machine. The computer boots up, automatically starts watching tv, and displays the messages just as I had hoped. I'm pasting the script below in the interest of sharing. Please note that I am pretty much a noob at linux and scripting, so this script is probably pretty messy - but it works for what I'm doing. The part of the script that does what I asked about (starting Watch TV automatically) is simply this one line:

Code:
echo "jump livetv" | telnet 127.0.0.1 6546


For background info, this script grabs a plain text file from a web server and displays the text in that file as a scrolling message across the top of the screen. The contents of that text file are modified by a web based form that certain people on campus can access to enter new messages. Each time the script cycles, it pulls the file again, in case there are any new messages, like "Professor so-an-so's classes are cancelled today due to illness." We are also going to use the web-based remote control option to change channels remotely, if something comes up that the administration would like the TVs tuned to.

Again, thanks for the guidance on starting the Watch TV feature automatically. Here's the script:
Code:
#!/bin/bash
# This script is called by bootmisc.sh at startup
# It waits for mythfrontend to start, then starts
# the 'Watch TV' feature through telnet.  It also
# downloads a text file from a web page that
# contains messages to be displayed over live tv.
# Each loop retrieves a new file in case the
# message has been changed.

#Wait for mythfrontend to appear in process list
d=0
until [ $d = 1 ]
do
   d=`ps -e | grep mythfrontend | wc -l`
   sleep 5
done
sleep 10

# Start the 'Live TV' feature through telnet
echo "jump livetv" | telnet 127.0.0.1 6546

#Loop the rest of this file endlessly until interrupted
while true
do

#Retrieve the messages file from the web site
rm index.html
wget http://my.domain.com/_msg/

#Parse the file
cat "index.html" | while read line
do
if [ -n "${line}" ]; #Make sure the line is not null
then
time=`echo ${line} | wc -m` # Figure out how long the message is in characters
: $((time /= 6))  # Calculate number of seconds message will take to scroll
: $((time += 30)) # Add 30 seconds to message length for buffer
   mythtvosd --template=scroller --scroll_text="\"${line}"\" --bcastaddr=127.0.0.1 # Start the scrolling message
   sleep $time # Wait appropriate time before sending another message
fi
done
done
exit


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 10, 2007 1:37 pm 
Offline
Joined: Fri Nov 18, 2005 9:22 am
Posts: 777
Location: spencerport, ny (USA)
That's a cool script!

Hm.. the telnet interface is interesting. And it's got built-in help for commands. Nice.

For those wanting to play, install telnet as root:
Code:
apt-get install telnet


then

Code:
telnet 127.0.0.1 6546


To see the jump points:
Code:
help jump


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 10, 2007 6:08 pm 
Offline
Joined: Mon Mar 13, 2006 2:28 am
Posts: 143
Location: Brisbane, Australia
And don't forget to enable network control interface under General settings, and restart the frontend to use telnet.

_________________
MBE/FE ~ R5F27 ~ Asus A8N-VM-CSM ~ AMD64 3500+ ~ 1GB RAM ~ 1.5TB Storage ~ Nova-T-500 ~ SH-S183A DVDRW ~ LC20M Case ~ iMON-Pad Remote
FE ~ Diskless ~ Asus M2NPV-VM ~ AMD X2 BE-2350 (45w) ~ 1GB RAM ~ TT Lanbox Lite ~ iMON-Pad Remote


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 56 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu