Re: [Rhythmbox-devel] retreive rythmbox status via shell script.....
- From: mat nicholson <sjoeboo sjoeboo com>
- To: rhythmbox-devel gnome org
- Subject: Re: [Rhythmbox-devel] retreive rythmbox status via shell script.....
- Date: Wed, 27 Apr 2005 10:04:07 -0400
Jon,
i got a hackish version of my script running for now, but would really
like to get into the bonobo client for my own personal benifit, however,
with the code you gave me, i am getting this: (i did not alter anythign
and was jsut runnign it as a test to see what i was dealing with...)
Traceback (most recent call last):
File "./rb-bonobo.py", line 7, in ?
import bonobo.ui
ImportError: could not import gtk._gtk
any particular python bindings i need? i have teh python2.4-gtk2 binding
installed and have been searching for related packages to no avail. any
help would be great. thanks for the reply and suggestions.
On 4/26/2005 6:12 PM, Jonathan Matthew wrote:
On Tue, Apr 26, 2005 at 04:07:33PM -0400, mat nicholson wrote:
so, this is where i stand now. i have breifly broswed things such as the
rhythmbox-gaim plugin etc to see how they get their data from rthymbox,
however i would liek to avoid writting a program/plugin, and keep this
script based. is tehre a way for me to contact rhythmbox from a diffrent
term/from cron? is there a way to trigger something (a command) when
rhythmbox changes songs?
A couple of ideas:
You could try DISPLAY=:0 rhythmbox --print-playing .. bit of a hack
though.
$ ls -al /proc/`pidof rhythmbox`/fd | egrep '\.(mp3|ogg)$' \
| cut -d' ' -f11-
.. even more of a hack, won't work for songs played off network shares,
and will probably screw up if you're importing songs when it runs. But
it looks clever.
It's actually pretty easy to write a bonobo client in python:
#!/usr/bin/env python
import CORBA
import bonobo.activation
import string
import bonobo
import bonobo.ui
import gobject
_ACTIVATION_FLAG_EXISTING_ONLY = 1<<2;
def _song_cb(listener, event, ev):
global rhythmbox
properties = rhythmbox.getPlayerProperties()
info = properties.getValue("song").value()
properties.unref()
if info is not None:
print "now playing " + info.path
rhythmbox = bonobo.activation.activate(
"repo_ids.has('IDL:GNOME/Rhythmbox:1.0')",
[], _ACTIVATION_FLAG_EXISTING_ONLY)
if rhythmbox is not None:
properties = rhythmbox.getPlayerProperties()
bonobo.event_source_client_add_listener(properties, _song_cb,
"Bonobo/Property:change:song")
properties.unref()
_song_cb(None, None, None)
bonobo.ui.main()
else:
print "Rhythmbox isn't running"
and you can make it do basically anything in the _song_cb function.
It fails pretty badly if you restart rhythmbox, though..
-jonathan.
_______________________________________________
rhythmbox-devel mailing list
rhythmbox-devel gnome org
http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]