<div dir="ltr"><div style="text-align: left;">Hi there,<br><br>I'm trying to write a python program which will tell me what the Listen music player is currently playing. I've written this code:<br><br>import dbus<br>
<br>bus = dbus.SessionBus()<br>proxy_obj = bus.get_object( 'org.gnome.Listen', '/org/gnome/listen' )<br><br>print proxy_obj.current_playing()<br><br>It works well if Listen is already opened when the get_object method is called, but if Listen is not opened, the script will automatically open it.
<br>I don't want Listen to pop up. If it's not working, I'd rather quit than open it up. So, I figured that I should do something like this:<br><br>bus = dbus.SessionBus()<br>if listen_is_running():<br> proxy_obj =
bus.get_object( 'org.gnome.Listen', '/org/gnome/listen' )<br> print proxy_obj.current_playing()<br><br>Problem is, I don't know how to check if listen is running using DBus.<br>I've tried to use ps and grep, and it worked well when listen wasn't running - it just quited, but it doesn't work when listen is running - it just opens another instance of listen!
<br><br>So, what am I doing wrong?<br><br>Thanks!<br></div></div>