[2008.12] Mediaplayer

Timo Jyrinki timo.jyrinki at gmail.com
Wed Jan 7 15:13:44 CET 2009


2009/1/6 Giovanni <pino.otto at gmail.com>:
> can you share your python app for switching the profiles?

Actually no, since I've just extended the mokoservices.py from
freeyourphone.de forums
(http://freeyourphone.de/portal_v1/viewtopic.php?f=21&t=295), and
there is no indication that the script would be public domain or free
software. So I can't distribute the changed version unless the author
has somewhere publicly stated that the script is indeed actually GPL'd
or public domain.

Anyway, I've basically just added a few GTK buttons to the script, for example:
---
        # music profile

        button = gtk.Button("music")
        button.connect("clicked", self.musicprofile,"musicprofile")
        table.attach(button, 2, 3, 2, 3,xoptions=gtk.EXPAND, yoptions=gtk.EXPAND
)
        button.show()
---
...with callbacks which simply call scripts in the home dir /home/root:
---
    def musicprofile(self,button,data):
        output=subprocess.Popen(["sh","/home/root/m"], stdout=subprocess.PIPE).c
ommunicate()[0]

    def phoneprofile(self,button,data):
        output=subprocess.Popen(["sh","/home/root/p"], stdout=subprocess.PIPE).c
ommunicate()[0]

    def speakerprofile(self,button,data):
        output=subprocess.Popen(["sh","/home/root/s"], stdout=subprocess.PIPE).c
ommunicate()[0]
---

The scripts are, in order, just:
m:
 alsactl -f /usr/share/openmoko/scenarios/headset.state restore
p:
 alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore
s:
 alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore

These huge efforts are in public domain on my behalf ;)

-Timo




More information about the community mailing list