On May 13, 11:18 am, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Mon, 12 May 2008 19:19:05 -0700, Jimmy wrote: > > Well, i know it may be a little non-python thing, however, I can think > > of no place better to post this question :) > > > can anyone tell me, in python, how to obtain some information of a > > running program? > > paticularly, if i am playing some music in audacious or other media > > player, how can i get the the name and some other info of current > > playing song? It seems that audicious doesn't output on run-time > > In case of Audatious running on X11 all you need is Python X > libraryhttp://python-xlib.sourceforge.net/ > > And something like: > > from Xlib import display > > dpy = display.Display() > root = dpy.screen().root > > NET_WM_NAME = dpy.intern_atom('_NET_WM_NAME') > UTF8_STRING = dpy.intern_atom('UTF8_STRING') > > for win in root.query_tree().children: > try: > window_title = win.get_full_property(NET_WM_NAME, > UTF8_STRING).value > except AttributeError: > continue > if window_title.endswith('Audacious'): > song = window_title.split(' - ')[:-1] > if song: > print song > > -- Ivan
Thanks! I also found a thing called 'audacious announcer' which can output detail information of the playing track. actually I'm working on a small program to display lyrics while playing music in media player. -- http://mail.python.org/mailman/listinfo/python-list