Personal tools
Document Actions

amarok remote controlled

Up to Scripts

amarok remote controlled

Posted by Cheos at August 08. 2007

Here is a very simple script which allows to control amarok via tuxdroid's remote control. It uses dcop so that almost any other kde application could be controlled that way.




The code is not very clean atm because i plan to add the support of a few others kde apps :)


Attachments

Re: amarok remote controlled

Posted by Bastian Kennel at August 08. 2007

Hi Cheos,






I just posted about the Remote Keys, and there they are right inside your script!


Thank you very much. I will try to add kaffeine support... maybe I can pull it of.






cheers Bastian


Re: amarok remote controlled

Posted by Cheos at August 08. 2007

Hi,




In fact, adding support for another kde application is fairly easy :) Run kaffeine, then run kdcop. You sould find a "kafeine" line on the tree which you can expand to see what commands can be used to control kafeine (you may type the full commande in a terminal i.e. "dcope kafeine kafeineIface play" or drag&drop a line from kdcop to a terminal or text editor).




I've found remote control keys in the documentation but there is a mistake in it. You may type "tux.event.on_remote_bt[<key>]= < function> or ""tux.event.on_remote = <function" but not "tux.event.on_remote_bt = <function> as the documentation says.


Glad to see that such a simple script is already useful to someone :)






Regards,


Cheos


Re: amarok remote controlled

Posted by Bastian Kennel at August 09. 2007

Hi,




I forked your script to add both kaffeine support and a switching mechanism between the two key schemas. It is dirty work from me but it works.






Remarks:


- This is my first python script.... not even mine, it is a fork of Cheos'


- The Kaffeine support is currently aimed towards DVB playback, because this is what I use kaffeine for


- Tux tells you which program is currently selected, you might want to turn that off if you don't have speech


- My noobishness in python makes the code really ugly: if I link an event to a function it is done with


event = functionName


No brackets, no parameters. Of course, if i put event = funtionName() then the function is evaluated and the value of the evaluation is linked to the event. What i wanted to do is link an event to a function with a defined parameter. Like this:


event_key_5_pressed = processKey(5)


Again, entered as shown above results in the processing of key 5 during the initialization phase => not good.


my first and only guess was event_key_5_pressed = processKey 5 but python didn't like that. Does anyone know how to handle this and NOT do what I just did: event_key_5_pressed = processKey_5, resulting in the declaration of one function per event????






Thank you for reading.


Bastian


Attachments

Re: amarok remote controlled

Posted by Cheos at August 09. 2007

Well this script was one of my first python script too (i used to write small xchat scripts a few years ago :p) but i don't see what's wrong in the script. Everthing seems fine ?!


Powered by Ploneboard
You are here: Home Forum Scripts amarok remote controlled

Powered by Plone CMS, the Open Source Content Management System