how to get information of a running prog in python

George Sakkis george.sakkis at gmail.com
Mon May 12 23:29:46 EDT 2008


On May 12, 11:02 pm, Jimmy <mcknight0... at gmail.com> wrote:
> On May 13, 10:36 am, "Dan Upton" <up... at virginia.edu> wrote:
>
>
>
> > On Mon, May 12, 2008 at 10:19 PM, Jimmy <mcknight0... at gmail.com> 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
> > >  --
> > >  http://mail.python.org/mailman/listinfo/python-list
>
> > In most cases, you'll probably need some sort of API, either in the
> > program itself or through some sort of plugin, that lets external
> > programs query it.  For instance, there are some plugins to WinAmp
> > that allow external programs (like Last.FM or Mog-O-Matic) to see what
> > track is currently playing.  You may also be able to do something like
> > get the window title (again, WinAmp's title bar usually includes the
> > artist and title) and parse it out.  I don't really know that there's
> > anything specific to Python for accessing these though, and it may
> > vary depending on media player.
>
> > Just my two cents...
>
> > -dan
>
> thanks!
>
> In linux, I am always obfuscated by sort of APIs. Like how to get
> title information of a running program?
> where am I supposed to find these APIs

I think you're a little confused about how computers work in general
and what a program can do, and you expect there is some general
superprogram able to decipher what an arbitrary other running program
does. The sentence "how to get title information of a running program"
doesn't even make sense for most programs since they don't play music
anyway.

Your best bet is if the *specific* program you're interested in (e.g.
audacious) exposes this information programmatically in some way. It's
up to the developers of this application if and how they choose to do
it. Even if they do it, there's no requirement that the same API will
work for any other program of the same category, unless there is some
popular industry standard that most applications implement.

In short, you'll get more helpful replies at the audacious newsgroup.

HTH,
George



More information about the Python-list mailing list