how to get information of a running prog in python
Dan Upton
upton at virginia.edu
Mon May 12 23:19:55 EDT 2008
On Mon, May 12, 2008 at 11:02 PM, Jimmy <mcknight0219 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
>
In the documentation for each application? Somebody a little more
familiar with the specific apps you're interested in might be able to
help you more, especially in the case of open-source programs that
usually have developer communities. Also, you can find some
information (although I don't know that it'll be enough to help you)
in files in /proc/$pid on Linux -- type 'man proc' in your shell to
see what you can get out of it and if anything looks helpful for you.
More information about the Python-list
mailing list