WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

BASH commands with WMD

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> General Linux Wiimote
View previous topic :: View next topic  
Author Message
boutch55555



Joined: 01 Mar 2008
Posts: 1

Digg It
PostPosted: Sat Mar 01, 2008 6:38 pm    Post subject: BASH commands with WMD

For those who might be interested in running BASH commands from WMD (0.1.2), I just spent a couple of hours finding a *working* solution. Right now, i'm using it to control xmms through xmms-shell.

how it's done :
first I edited CommandMapper.py

1 : after
from wmd.EventBridges.uinputKeymap import * (line 3)

I added

import os

2 : add bash to the valid commands (line 9)

valid_commands = [ 'quit', 'key', 'click', 'WMDPower', 'bash' ]

3 : add a new def for the bash event (i did it between do_key & do_click)(around line 44)

def do_bash( self, state, parms ):
keyss = parms
self.os.system( state, keyss )

4 : save

5 : edit Config.py to add your custom BASH commands

example :
'A': ['bash', '/usr/local/bin/xmms-shell -e play &' ], # A key: xmms play
'L': ['bash', '/usr/local/bin/xmms-shell -e previous &' ], # prev
'R': ['bash', '/usr/local/bin/xmms-shell -e next &'] # next

i had to do two small scripts to control the incremental volume. they stored in /usr/bin/ and named volup & voldown

here is volup :
#!/bin/bash
x=`xmms-shell -e status |grep Left |tail -c3`
z=$(($x + 5))
xmms-shell -e "volume $z"

then just call them from Config.py, same as before :
'+': ['bash', '/usr/bin/volup &' ], # volup
'-': ['bash', '/usr/bin/voldown &' ], # voldown

et voila !


note : it may not be the best way to do it(I aint a programmer) but at least it works Smile

have fun

Boutch
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> General Linux Wiimote All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group