I have now tried with dbus. I found some nice tutorials [1] [2] so I got some 
code looking like:
session_bus = dbus.SessionBus()proxy_obj = 
session_bus.get_object('org.gnome.Rhythmbox', 
'/org/gnome/Rhythmbox/Player')player = dbus.Interface(proxy_obj, 
'org.gnome.Rhythmbox.Player')
# get playing songprint player.getPlayingUri()# skip to nextplayer.next()
Much easier than I thought. However, one of the tutorials [2] described how I 
should the dbus-next utility to get information about all the different method 
are available via dbus. Using the following message I know what kind of objects 
I can get from rhythmbox:
dbus-send --print-reply --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox 
org.freedesktop.DBus.Introspectable.Introspect
Which gives:[...]<node>  <node name="DAAP"/>  <node name="Player"/>  <node 
name="PlaylistManager"/>  <node name="Shell"/></node>[...]
I can do the same with them:
dbus-send --print-reply --dest=org.gnome.Rhythmbox /org/gnome/Rhythmbox/Player 
org.freedesktop.DBus.Introspectable.Introspect
[...]<method name="getPlayingUri">      <arg name="uri" type="s" 
direction="out"/>    </method>    <method name="getPlaying">      <arg 
name="playing" type="b" direction="out"/>    </method>    <method 
name="next">    </method>    <method name="previous">    </method>[...]
Now I'm wondering, is there any documentation on these methods I get from the 
command, for instance getPlayingUri? Or is the xml file the only documentation? 
And with that said, can I "only" use the method defined in the introspect 
files? So if I need more functionality, I have to use threads (or some other 
kind of communication so I get access to the shell)?
Thanks for your help!
Oh, and by the way, with threads, I used the gdk lock functions to avoid 
crashing rhythmbox:
# get lockgtk.gdk.threads_enter()# do stuff with 
gtkself.shell.props.shell_player.play()# release lockgtk.gdk.threads_leave()
Kind regards,Samuel
[1] http://unmaintainable.wordpress.com/2006/12/10/controlling-rhythmbox-using-dbus/[2] http://fredreh.wordpress.com/2008/02/13/put-rhythmbox-om-the-d-bus/
--- Den mån 2010-03-22 skrev Michael Gratton <[email protected]>:

Från: Michael Gratton <[email protected]>
Ämne: Re: [Rhythmbox-devel] Rhythmbox crashes when using threads and network 
sockets
Till: [email protected]
Datum: måndag 22 mars 2010 00.12

On 22/03/10 07:23, Samuel Skånberg wrote:
> 
> If I run my cli app that connects to the plugin and issue "play" and
> then "pause" a couple of times, rhythmbox crashes and segfaults.
> 
> Any ideas why or what I could do instead?

Programming with whreads are generally error prone and is best avoided. Is 
there any reason why you cannot use the DBus interface to talk to RB? You 
wouldn't need the plugin at all then.

//Mike

-- ⎊ michael gratton, itinerant geek
⎈ <http://web.vee.net/>
_______________________________________________
rhythmbox-devel mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/rhythmbox-devel


__________________________________________________
Använder du Yahoo!?
Är du trött på spam?  Yahoo! E-post har det bästa spamskyddet som finns 
http://se.mail.yahoo.com 
_______________________________________________
rhythmbox-devel mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/rhythmbox-devel

Reply via email to