Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

using telnet to improve mythtv menus

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


steve at priorityelectronics

Mar 14, 2008, 2:56 PM

Post #1 of 16 (1728 views)
Permalink
using telnet to improve mythtv menus

Hello all, I had the idea lately to use telnet to improve my mythtv menu.

I've got lots of recordings that i've been archiving away, like season
series (all from live tv recordings). I wanted to clean up the watch
recordings screen so that we could choose from the menu which type of
recordings to view (we have "myth wish", "default", and "archived" as the
options)

I checked out this page in the wiki:
http://www.mythtv.org/wiki/index.php/Creating_a_TV_Bouquet to help me with
my ideas.

When you hit watch recordings it now goes to an xml menu that has 3 options:

watch recordings
new recordings
tv show archives

The xml file looks like this:
____________________________________________
<mythmenu name="MAIN">
<button>
<type>TV_WATCH_RECORDINGS</type>
<text>All Recordings</text>
<action>TV_WATCH_RECORDING</action>
</button>
<button>
<type>TV_WATCH_RECORDINGS</type>
<text>New Recordings</text>
<action>EXEC /home/steve/Desktop/mythscripts/newrecordings.sh</action>
</button>
<button>
<type>TV_WATCH_RECORDINGS</type>
<text>TV Show Archives</text>
<action>EXEC
/home/steve/Desktop/mythscripts/archivedrecordings.sh</action>
</button>

</mythmenu>

____________________________________________

The newrecordings.sh file looks like this:

#!/bin/bash
#This takes you to the New (Default) Recordings
echo "jump playbackbox" | telnet 192.168.1.3 6546
echo "key n" | telnet 192.168.1.3 6546
#sleep is used cause it takes a while to get into the watch recordings view
sleep 2
echo "key enter" | telnet 192.168.1.3 6546
#again, sleep is used incase it takes time to pop up the menu
sleep 0.5
#Pageup brings you to the top of the menu
echo "key pageup" | telnet 192.168.1.3 6546
echo "key pageup" | telnet 192.168.1.3 6546
echo "key pageup" | telnet 192.168.1.3 6546
#down down get's you to default
echo "key down" | telnet 192.168.1.3 6546
echo "key down" | telnet 192.168.1.3 6546
echo "key enter" | telnet 192.168.1.3 6546
exit 0


My issue is that it doesn't seem to work from the myth gui, but works
perfectly from the command line.

If I can get this to work, i'll create more menues so i can do something
like this: TV Show Archives > The Simpsons > Season 1

Then i'll do a movies one where you can choose the genre right in the xml
menu file.

I just find this easier than pressing the "n" button ("enter" on my remote),
and i think the waf factor will go way up, especially for the movies, cause
we have a couple hundred movies and it's often hard to find a movie to
watch.

Any ideas?
-Thanks
-Steve


ron at ronfrazier

Mar 14, 2008, 3:54 PM

Post #2 of 16 (1698 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

> My issue is that it doesn't seem to work from the myth gui, but works
> perfectly from the command line.

My guesses would be either a permission or environment problem.
Presumably, when you run it from the command line, you are either
running as root or as your own personal user account. However, myth is
usually setup to run as the mythtv user. Does the mythtv user have
permission to execute your script? Is telnet in the path for the
mythtv user or will you need to specify a full path?


Also, you can optimize this to require fewer calls. Instead of

echo "key pageup" | telnet 192.168.1.3 6546
echo "key pageup" | telnet 192.168.1.3 6546
echo "key pageup" | telnet 192.168.1.3 6546

try

echo -e "key pageup\nkey pageup\nkey pageup" | telnet 192.168.1.3 6546

As long as you don't require a pause between, you can join all the
commands together.

--
Ron
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


msherman at projectile

Mar 14, 2008, 4:27 PM

Post #3 of 16 (1690 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

Steve Peters - Priority Electronics wrote:
>
> My issue is that it doesn't seem to work from the myth gui, but works
> perfectly from the command line.

You're hitting a deadlock; the telnet interface won't execute until the
menu processing completes, but the menu processing won't complete until
the telnet interface finishes executing.

To resolve it, you have to have the script run in the background, so
that the menu processing completes before the script finishes running.

Here is the script that I use to show the "Kids" recgroup:

#!/bin/bash
echo "jump playbackrecordings
key down down enter
quit" | nc localhost 6546 &

The & at the end runs it in the background, so that the script exits
before netcat does.

Note that I have myth configured to show the recgroup selector always on
entry to the playback recording screen, to avoid the delay required to
bring up the popup menu.

- Marc
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


steve at priorityelectronics

Mar 14, 2008, 8:54 PM

Post #4 of 16 (1675 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

>>
>> My issue is that it doesn't seem to work from the myth gui, but works
>> perfectly from the command line.
>
>To resolve it, you have to have the script run in the background, so
>that the menu processing completes before the script finishes running.
>
>Here is the script that I use to show the "Kids" recgroup:
>
>#!/bin/bash
>echo "jump playbackrecordings
>key down down enter
>quit" | nc localhost 6546 &
>
>The & at the end runs it in the background, so that the script exits
>before netcat does.
>
>Note that I have myth configured to show the recgroup selector
>always on
>entry to the playback recording screen, to avoid the delay required to
>bring up the popup menu.
>
>- Marc
>_______________________________________________
>mythtv-users mailing list
>mythtv-users [at] mythtv
>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users



Marc, thanks for the reply. Ok, I tried to do what you're doing, but it just
didn't work. So then I thought, what if my script just called another
script, so now I have archivedrecordings.sh and archivedrecordingsrun.sh

Now the script I made works, but 1 out of 5 times, myth takes longer to open
the recorded tv module (usually it takes about 4 seconds, but sometimes up
to 6-7 seconds on my fast core 2 duo). So on the time it takes 6-7 seconds,
my script ends up making a recording start playing. It seems as though since
myth is taking a long time, the "key n" command is ignored, and the "down
down enter" command is received. So it plays the third recording on the
list.

Any ideas on how to address this one? Really strange.

I really like the idea that I am able to do this type of customization, but
am somewhat surprised that nobody has written the actual setting for myth to
have options on when it opens the recordings other than the single default
you can set in the settings menu. Same goes for the videos. I'd really like
to get this one going.

-Thanks
-Steve


_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


ron at ronfrazier

Mar 14, 2008, 9:11 PM

Post #5 of 16 (1683 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

> Now the script I made works, but 1 out of 5 times, myth takes longer to open
> the recorded tv module (usually it takes about 4 seconds, but sometimes up
> to 6-7 seconds on my fast core 2 duo). So on the time it takes 6-7 seconds,
> my script ends up making a recording start playing. It seems as though since
> myth is taking a long time, the "key n" command is ignored, and the "down
> down enter" command is received. So it plays the third recording on the
> list.
>
> Any ideas on how to address this one? Really strange.

Do you have any coding skills? Enough to at least write some basic
perl scripts? You could always communicate interactively with the
network control port, and keep executing a "query location" until the
screen you need loads. You can take a look at the code for my
irwatch.pl to see how I worked with it and did that sort of thing.

http://www.ronfrazier.net/ronfrazier.net/mythtv/#IRWatch


--
Ron
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


cpinkham at bc2va

Mar 14, 2008, 9:17 PM

Post #6 of 16 (1674 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

* On Fri Mar 14, 2008 at 02:56:58PM -0700, Steve Peters - Priority Electronics wrote:
> When you hit watch recordings it now goes to an xml menu that has 3 options:
>
> watch recordings
> new recordings
> tv show archives
>
> The xml file looks like this:
> ____________________________________________
> <mythmenu name="MAIN">
> <button>
> <type>TV_WATCH_RECORDINGS</type>
> <text>All Recordings</text>
> <action>TV_WATCH_RECORDING</action>
> </button>

It wouldn't take that much code to modify Myth to allow you to optionally
specify a Recording Group name in the TV_WATCH_RECORDING action like this:

<button>
<type>TV_WATCH_RECORDINGS</type>
<text>All Programs</text>
<action>TV_WATCH_RECORDING All Programs</action>
</button>
<button>
<type>TV_WATCH_RECORDINGS</type>
<text>Default RecGroup</text>
<action>TV_WATCH_RECORDING Default</action>
</button>
<button>
<type>TV_WATCH_RECORDINGS</type>
<text>Mom's Stuff</text>
<action>TV_WATCH_RECORDING Mom</action>
</button>

--
Chris
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


pebender at san

Mar 14, 2008, 9:32 PM

Post #7 of 16 (1675 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

Steve Peters - Priority Electronics wrote:
>>>
>>> My issue is that it doesn't seem to work from the myth gui, but works
>>> perfectly from the command line.
>> To resolve it, you have to have the script run in the background, so
>> that the menu processing completes before the script finishes running.
>>
>> Here is the script that I use to show the "Kids" recgroup:
>>
>> #!/bin/bash
>> echo "jump playbackrecordings
>> key down down enter
>> quit" | nc localhost 6546 &
>>
>> The & at the end runs it in the background, so that the script exits
>> before netcat does.
>>
>> Note that I have myth configured to show the recgroup selector
>> always on
>> entry to the playback recording screen, to avoid the delay required to
>> bring up the popup menu.
>>
>> - Marc
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users [at] mythtv
>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
>
>
> Marc, thanks for the reply. Ok, I tried to do what you're doing, but it just
> didn't work. So then I thought, what if my script just called another
> script, so now I have archivedrecordings.sh and archivedrecordingsrun.sh
>
> Now the script I made works, but 1 out of 5 times, myth takes longer to open
> the recorded tv module (usually it takes about 4 seconds, but sometimes up
> to 6-7 seconds on my fast core 2 duo). So on the time it takes 6-7 seconds,
> my script ends up making a recording start playing. It seems as though since
> myth is taking a long time, the "key n" command is ignored, and the "down
> down enter" command is received. So it plays the third recording on the
> list.
>
> Any ideas on how to address this one? Really strange.

What I do in MiniMyth is use the telnet interface to query the location
using a shell script netpipes' hose. I have attached a snippet of the
script as an example.
Attachments: snippet.sh.gz (0.51 KB)


steve at priorityelectronics

Mar 14, 2008, 9:55 PM

Post #8 of 16 (1676 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

>* On Fri Mar 14, 2008 at 02:56:58PM -0700, Steve Peters -
>Priority Electronics wrote:
>> When you hit watch recordings it now goes to an xml menu
>that has 3 options:
>>
>> watch recordings
>> new recordings
>> tv show archives
>>
>> The xml file looks like this:
>> ____________________________________________
>> <mythmenu name="MAIN">
>> <button>
>> <type>TV_WATCH_RECORDINGS</type>
>> <text>All Recordings</text>
>> <action>TV_WATCH_RECORDING</action>
>> </button>
>
>It wouldn't take that much code to modify Myth to allow you to
>optionally
>specify a Recording Group name in the TV_WATCH_RECORDING
>action like this:
>
> <button>
> <type>TV_WATCH_RECORDINGS</type>
> <text>All Programs</text>
> <action>TV_WATCH_RECORDING All Programs</action>
> </button>
> <button>
> <type>TV_WATCH_RECORDINGS</type>
> <text>Default RecGroup</text>
> <action>TV_WATCH_RECORDING Default</action>
> </button>
> <button>
> <type>TV_WATCH_RECORDINGS</type>
> <text>Mom's Stuff</text>
> <action>TV_WATCH_RECORDING Mom</action>
> </button>
>
>--
>Chris
>_______________________________________________
>mythtv-users mailing list
>mythtv-users [at] mythtv
>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>


Chris, does that mean that myth can do that already? If so, it didn't work
for me. I'm no coder, but I have been able to do quite a bit in my time by
taking code and making tweaks to it to get it to do what I need it to do.

I've never done any perl coding, just some bash stuff. But I'm willing to
check it out to get this new great feature.

Thanks for the tips, and keep them coming if you guys have any more of them.
-Steve


_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


roo.watt at gmail

Mar 14, 2008, 11:51 PM

Post #9 of 16 (1674 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

On 15/03/2008, Chris Pinkham <cpinkham [at] bc2va> wrote:
> It wouldn't take that much code to modify Myth to allow you to optionally
> specify a Recording Group name in the TV_WATCH_RECORDING action

Chris, I *really* like this idea! I might take a stab at it very soon.


Cheers,

Roo.
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


cpinkham at bc2va

Mar 15, 2008, 2:28 AM

Post #10 of 16 (1676 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

* On Fri Mar 14, 2008 at 09:55:04PM -0700, Steve Peters - Priority Electronics wrote:
> > <action>TV_WATCH_RECORDING Mom</action>

> Chris, does that mean that myth can do that already?

No... (waits a little while) Yes. (with svn trunk)

> If so, it didn't work
> for me. I'm no coder, but I have been able to do quite a bit in my time by
> taking code and making tweaks to it to get it to do what I need it to do.

Sorry, when I said "It wouldn't take that much code", I meant
C++ code in the mythtv/programs/mythfrontend directory. :)

I thought about it and had a little free time at 3:00AM tonight
so I hooked it up and committed it to svn trunk.

If you compile from source and are running 0.21-fixes, you should be able
to apply the patch from my commit to your source tree.

http://cvs.mythtv.org/trac/changeset/16559

--
Chris
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


cpinkham at bc2va

Mar 15, 2008, 2:29 AM

Post #11 of 16 (1677 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

* On Sat Mar 15, 2008 at 05:51:08PM +1100, Roo wrote:
> On 15/03/2008, Chris Pinkham <cpinkham [at] bc2va> wrote:
> > It wouldn't take that much code to modify Myth to allow you to optionally
> > specify a Recording Group name in the TV_WATCH_RECORDING action
>
> Chris, I *really* like this idea! I might take a stab at it very soon.

Too late... http://cvs.mythtv.org/trac/changeset/16559

Let me know if you find any issues with it.

--
Chris
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


msherman at projectile

Mar 15, 2008, 6:49 AM

Post #12 of 16 (1668 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

Chris Pinkham wrote:
>
> Sorry, when I said "It wouldn't take that much code", I meant
> C++ code in the mythtv/programs/mythfrontend directory. :)
>
> I thought about it and had a little free time at 3:00AM tonight
> so I hooked it up and committed it to svn trunk.
>
> If you compile from source and are running 0.21-fixes, you should be able
> to apply the patch from my commit to your source tree.
>
> http://cvs.mythtv.org/trac/changeset/16559

Thanks Chris, but I have to ask, where were you in November? :)

http://mythtv.org/pipermail/mythtv-users/2007-November/202101.html

I guess there's no chance of getting this patch applied to the
0.21-fixes branch (from which it will be included in the pre-built
debian packages), is there?

Time to start building my own packages, I guess.

- Marc
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


steve at priorityelectronics

Mar 15, 2008, 9:53 AM

Post #13 of 16 (1662 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

>> > specify a Recording Group name in the TV_WATCH_RECORDING action
>>
>> Chris, I *really* like this idea! I might take a stab at it
>very soon.
>
>Too late... http://cvs.mythtv.org/trac/changeset/16559
>
>Let me know if you find any issues with it.
>
>--
>Chris
>_______________________________________________
>mythtv-users mailing list
>mythtv-users [at] mythtv
>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users



Chris you rock. That's really fast. Just one question: I'm running the svn
build for myth, so do I just re-download the svn and build it again to get
your changes? Or do I have to download some specific files you uploaded
somewhere then build again?

Also, how much trouble would it be to do the same for the videos section. I
want to be able to have a menu something like this (all in gallery view):

Movies by Rating (highest first)
Movies by Year (newest first)
Movies Alphabetically
Movies by Genre (this would lead to another xml menu)


And in the Movies by Genre menu:
Action
Comedy
Drama
Etc etc etc


The scripts I wrote would probably work better in the videos section since
that loads really really quickly, unlike the recorded programs section. But
anyhow, just thought I'd ask.
-Steve


_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


cpinkham at bc2va

Mar 15, 2008, 10:12 AM

Post #14 of 16 (1655 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

* On Sat Mar 15, 2008 at 09:53:09AM -0700, Steve Peters - Priority Electronics wrote:
> >Too late... http://cvs.mythtv.org/trac/changeset/16559

> Chris you rock. That's really fast. Just one question: I'm running the svn
> build for myth, so do I just re-download the svn and build it again to get
> your changes? Or do I have to download some specific files you uploaded
> somewhere then build again?

You need to "svn update", make, and "make install".

> Also, how much trouble would it be to do the same for the videos section. I
> want to be able to have a menu something like this (all in gallery view):

I don't know much about the MythVideo code, it's been a few years since I've
messed with it and it wasn't on this level. MythVideo is also a plugin
which means it's not a simple fix like the Watch Recordings screen change
was. This would require changing the plugin api probably. It's not
something I could crank out in 30 minutes after 10 minutes of thought. It's
probably best to put this on the feature request wiki page.

--
Chris
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


cpinkham at bc2va

Mar 15, 2008, 10:16 AM

Post #15 of 16 (1656 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

* On Sat Mar 15, 2008 at 09:49:35AM -0400, Marc Sherman wrote:
> > http://cvs.mythtv.org/trac/changeset/16559
>
> Thanks Chris, but I have to ask, where were you in November? :)

I think I had less free time then than I do now, and that's not
saying much... :(

> http://mythtv.org/pipermail/mythtv-users/2007-November/202101.html

I guess this thread didn't catch my attention while the one
mentioning the telnet/network control interface did since I
wrote that portion of code.

> I guess there's no chance of getting this patch applied to the
> 0.21-fixes branch (from which it will be included in the pre-built
> debian packages), is there?

No, sorry.

--
Chris
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


msherman at projectile

Mar 15, 2008, 6:44 PM

Post #16 of 16 (1640 views)
Permalink
Re: using telnet to improve mythtv menus [In reply to]

Chris Pinkham wrote:
>
> I guess this thread didn't catch my attention while the one
> mentioning the telnet/network control interface did since I
> wrote that portion of code.

Well, thanks very much for implementing it. Thanks as well for the
telnet implementation, which I've been using for this purpose with 0.20.

- Marc
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.