Re: [Rhythmbox-devel] Python Plugin-LED Cube Visualizations



Thanks a lot for the tip! I have been looking for a while without
finding much about this.

So now I have 
import rhythmdb, rb
import gobject, gtk
import serial
import gst

class SamplePython(rb.Plugin):

        def __init__(self):
                rb.Plugin.__init__(self)
                        
        def activate(self, shell):
                print "activating sample python plugin"
                level = gst.element_factory_make ("level")
                spectrum = gst.element_factory_make ("spectrum")
                b = gst.Bin()
                b.add (level, spectrum)
                shell.get_player().props.player.add_tee_element(b)
                self.ser = serial.Serial('/dev/ttyS0', 115200, timeout=1)
                self.ser.write("hello")
                
        def deactivate(self, shell):
                print "deactivating sample python plugin"
                shell.get_player().props.player.remove_tee_element(b)
                self.ser.close()

I got most of that from
http://live.gnome.org/RhythmboxPlugins/WritingGuide#head-7cd42591b00fdab44374fd57538003a192960070

There is a problem though. When I try to run it I get 

shell.get_player().props.player.add_tee_element(b)
AttributeError: '__main__.RBPlayerGst' object has no attribute
'add_tee_element'

Is the guide wrong? How do I add the elements?

Also what's a GStreamer sink plugin? 

Thanks a lot,
Justin Rajewski

Jonathan Matthew-4 wrote:
> 
> On Sat, Apr 18, 2009 at 03:06:25PM -0700, EmbeddedMicro wrote:
>> 
>> I build and sell RGB LED cubes. The newest version has a serial interface
>> that I would like to utilise using Rhythmbox. I know C, but I am using
>> Python (for the first time) as it is easier.
>> 
>> So far I have the plugin set up so it sends "Hello" over the serial port
>> when it is started and that works fine. What I need to do now is make it
>> get
>> information on the sound being played, ie intensity, frequency, etc. Does
>> anyone know how to do that with Python?
> 
> Rhythmbox plugins have the ability to insert elements into the GStreamer
> playback pipeline.  You can probably get enough information using the
> standard GStreamer 'level' and 'spectrum' elements.  Your plugin would
> then handle messages emitted by these elements and use the information
> from those to update the device.  I don't think we have any examples of
> plugins that do this currently.
> 
> Alternatively, I think you could write a GStreamer sink plugin that took
> care of the whole process, which would make it easier to use this in
> other applications.
> 
> 
> _______________________________________________
> rhythmbox-devel mailing list
> rhythmbox-devel gnome org
> http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
> 
> 

-- 
View this message in context: http://www.nabble.com/Python-Plugin-LED-Cube-Visualizations-tp23117783p23129259.html
Sent from the Gnome - Rhythmbox - Dev mailing list archive at Nabble.com.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]