Reply
Thread Tools
Guitaroach's Avatar
Posts: 13 | Thanked: 1 time | Joined on Dec 2010 @ U.S.
#1
Hi everyone. I was wondering if anyone could do me the big favor of developing a tiny desktop widget(probably just a 'play' button) for the N900 with the sole purpose of playing back a single user-selected audio clip once. Nothing more, nothing less.

I want it just for good timing. Ever thought about cricket noises after a friend tells a bad joke? That's pretty much the only reason I would like to see this happen. Of course given the option to change the sound and anyone can come up with any sound for any kind of moment. It's corny, but it could be fun!
__________________
"You wanna have a good time? Get yourself a nice watch."
 
kingoddball's Avatar
Posts: 1,187 | Thanked: 816 times | Joined on Apr 2010 @ Australia
#2
You know...
.. You could just make your own simple one?
Use Queen beecon widget or a simple script and make an icon? Something easy like that?
Find a command line audio player and the rest is history!
__________________
The thanks button? Sure! You can press it! I would!
 
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#3
Ok, I couldn't sleep today and lack of skills in python programming didn't stop me from writing that :P It's really in very beta-stage (as I said in previous sentence, this is my first code written in Python), so it could not install (app manager shows 2.3 mb of space needed - wtf? Both files have less, than 2 kb :P) or kill all you widgets from desktop... But for me it worked And after reboot or removing widget from desktop and adding once again - you need to click on settings and show it music file it should play. I can assure you it plays wav files, haven't tried different, it's 4:20 AM in here... It plays basically everything, which command "play-sound" can play (it uses it). These are basically just two files:
/usr/lib/hildon-desktop/mmmaudiowidget.py
/usr/share/applications/hildon-home/mmmaudiowidget.desktop

Source of the first one (the important one) is as follows:
Code:
import gtk
import hildondesktop
import hildon
import os

class MmmAudioWidgetPlugin(hildondesktop.HomePluginItem):
    def __init__(self):
        hildondesktop.HomePluginItem.__init__(self)
        self.set_size_request(90, 90)
        button = gtk.Button("Play")
        button.connect("clicked", self.play_clicked)
        button.show_all()
        self.add(button)
	self.set_settings(True)
	self.connect("show-settings", self.show_dialog)
        self.sound_file = "/home/user/MyDocs/sound.wav"
    def show_dialog(self, plugin):
        chooser = hildon.FileChooserDialog(plugin, gtk.FILE_CHOOSER_ACTION_OPEN)
        response = chooser.run()
        if response == gtk.RESPONSE_OK:
            self.sound_file = chooser.get_filename()
        chooser.destroy()
    def play_clicked(self, button):
        os.system("echo \"" + self.sound_file + "\"")
        os.system("play-sound \"" + self.sound_file + "\"");

hd_plugin_type = MmmAudioWidgetPlugin

# The code below is just for testing purposes.
# It allows to run the widget as a standalone process.
if __name__ == "__main__":
    import gobject
    gobject.type_register(hd_plugin_type)
    obj = gobject.new(hd_plugin_type, plugin_id="plugin_id")
    obj.show_all()
    gtk.main()
Just download deb and open via appmanager. If it fails to install, try install recaller (I copied required dependencies from it) and try again. Tell me if it works for you It is called in widget menu "mmmAudioWidget" and after selecting should put ugly gray "Play" button on your active homescreen.

Last edited by misiak; 2011-04-23 at 12:15. Reason: Link removed, see post below
 
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#4
I made some changes (can add more buttons and configure their size - yay!) and created garage account, now I'm waiting for acceptance of extras-devel access, so soon you should be able to install it via app manager. I will inform you in this thread as soon as it happens
 
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#5
See thread http://talk.maemo.org/showthread.php?p=994750 for widget I will inform everyone there as soon as widget will be available in extras-devel.
 
Reply


 
Forum Jump


All times are GMT. The time now is 12:36.