<div dir="ltr"><div style="text-align: left;">Hi there,<br><br>I&#39;m trying to write a python program which will tell me what the Listen music player is currently playing. I&#39;ve written this code:<br><br>import dbus<br>
<br>bus = dbus.SessionBus()<br>proxy_obj = bus.get_object( &#39;org.gnome.Listen&#39;, &#39;/org/gnome/listen&#39; )<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&#39;t want Listen to pop up. If it&#39;s not working, I&#39;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>&nbsp;&nbsp;&nbsp; proxy_obj = 
bus.get_object( &#39;org.gnome.Listen&#39;, &#39;/org/gnome/listen&#39; )<br>&nbsp;&nbsp;&nbsp; print proxy_obj.current_playing()<br><br>Problem is, I don&#39;t know how to check if listen is running using DBus.<br>I&#39;ve tried to use ps and grep, and it worked well when listen wasn&#39;t running - it just quited, but it doesn&#39;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>