View previous topic :: View next topic |
Author |
Message |
theDOC_23 Tux's lil' helper
Joined: 02 Dec 2004 Posts: 121 Location: Aachen, GER
|
Posted: Wed Jun 28, 2006 2:37 pm Post subject: [HOWTO] control unfocused/remote MythTV with your keyboard |
|
|
HOWTO: control unfocused/remote MythTV Frontend with your keyboard
In this howto I will explain how I managed to control the MythFrontend with the multimedia keys of my keyboard. Since my ir-remote is always everywhere but at my pc, I wanted a way to start playing music, skip a song... without getting my lazy ass off the chair to get my remote . Little problem, I cannot focus the frontend, because it is running on my second screen and I patched my wm (xfwm4), so it doesn't touch it.
The solution, I came up with, will even work, if the frontend is running on another machine in your network! It is also WM independent, because we will use xhkeys to assign commands to your keyboard.
Let's get started then!
At first we have to enable the MythFrontend's control via telnet. It's in Settings -> General -> General (Enable Network Remote Control Interface). After that, we are able to telnet into the frondend and send commands to it. Here is some documentation about it.
Now we need a script that connects with telnet, sends a command and exits, when we call it. I did some googleing and the only working solution for automating telnet requests, I came up with, was with a little tool called expect.
Let's install it:
Code: | # emerge -av expect |
Here comes the script that does the telnet job:
Code: | #!/usr/bin/expect -f
set host "localhost"
set port "6546"
set timeout 1
set cmd [lindex $argv 0]
set key [lindex $argv 1]
spawn telnet $host $port
expect "# "
send -- "$cmd $key\n"
expect "# "
send -- "exit\n"
|
(Note: You should adjust the host and port vars to where the frontend is running.)
I called it ~/.mythtv/mythremote and made it executable
Code: | $ chmod +x ~/.mythtv/mythremote |
So, let's test it. Start mythmusic with some songs in the playlist and do:
Code: | $ ~/.mythtv/mythremote key greater |
If it works, it should have skipped to the next song.
Now we will assign controls to keyboard keys.
Therefore I use a little tool called xhkeys, because it makes me independent of the WM i'm using and is able to even use unbound keys, like the multimedia keys of my BenQ keyboard. It also has a little OSD, showing you the command it is performing.
Code: | # emerge -av xhkeys |
Start the config tool
press a key or combination and select [2] for command type "Application".
As shell command we now use our "mythremote" script.
Here's a list of some commands I use:
Code: |
// start mythmusic plugin
~/.mythtv/mythremote jump playmusic
// previous song
~/.mythtv/mythremote key less
// next song
~/.mythtv/mythremote key greater
// play / pause
~/.mythtv/mythremote key P
|
After you completed the config, start
and press an assigned button.
Here you can find documentation about xhkeys.
THAT'S IT! I hope, someone finds this useful... |
|
Back to top |
|
|
Hobbes-X l33t
Joined: 04 Feb 2004 Posts: 823 Location: Seattle, WA
|
Posted: Thu Jun 29, 2006 5:54 am Post subject: |
|
|
Cool idea! I never thought of using the multimedia keys with the telnet interface... |
|
Back to top |
|
|
fangorn Veteran
Joined: 31 Jul 2004 Posts: 1886
|
|
Back to top |
|
|
|
|
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 vote in polls in this forum
|
|