Re: [Rhythmbox-devel] retreive rythmbox status via shell script.....


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 "./", 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

$ 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


def _song_cb(listener, event, ev):
	global rhythmbox
	properties = rhythmbox.getPlayerProperties()
	info = properties.getValue("song").value()
	if info is not None:
		print "now playing " + info.path

rhythmbox = bonobo.activation.activate(
if rhythmbox is not None:
	properties = rhythmbox.getPlayerProperties()
	bonobo.event_source_client_add_listener(properties, _song_cb,
	_song_cb(None, None, None)
	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..

rhythmbox-devel mailing list
rhythmbox-devel gnome org

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