Help - Search - Members - Calendar
Full Version: Foobar2k and Python
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
Antipodean
Just wondering about the possibility of controlling/accessing foobar via a python script (or other languages apart from c/c++).
I wrote a script that was able to control Winamp v2 via it's API (http://www.winamp.com/nsdn/winamp2x/dev/sdk/api.jhtml) in python a while ago. Is it possible to do something similar with foobar? (ie use the Windows Message system)
I've only got a functional knowledge of c/c++ and I've had a look through the SDK but I'm having a little trouble figuring it all out. Is there any documentation that I should know about?
foosion
about controlling foobar with Windows messages: foo_remote thread

SDK documentation:
- the SDK itself and the open sourced components included in the SDK.
- this forum.
- the irc channel.

other languages:
I've made a plugin that allows Lua scripts to be run inside foobar with access to some of foobar's functions. You can download it here to get an impression of what it can do. However this plugin is not yet ready for public use.
Antipodean
Thanks for the help.. I think I'm on the right track now. I had a good look through the foo_remote and foo_tbar plugin source and it's starting to make some sense...

I think I've figured out how to find the foobar window handle:
hwnd = win32gui.FindWindow('frw_cls','@__frw__@')
Does that look right to anybody?

The syntax for the SendMessage function in python is as follows:
int = win32api.SendMessage(hwnd, message , wparam , lparam )

An example of what I used for my winamp script was:
win32api.SendMessage(hWinamp, WM_COMMAND, 40048, 0)
which is equivalent to hitting the next track button in winamp.

Can anyone tell me which id's perform tasks such as play, pause etc in foobar (or with foo_remote)? ie 40048 was the id for next track in winamp.

Sorry if I appear to be stupid, i'm still fairly new to windows programming. smile.gif
foosion
QUOTE(Antipodean @ Aug 9 2003, 06:17 PM)
Can anyone tell me which id's perform tasks such as play, pause etc in foobar (or with foo_remote)? ie 40048 was the id for next track in winamp.

There are no such message ids in the SDK, which means there are no message ids to control foobar directly*. So it would be better to use foo_remote, which allows interfacing to foobar with windows messages. You'd best talk to steel_space about this.

*: Yes, I know you can try to figure out message ids, but since they're not part of the official interface given by the SDK, using them is not very reliable. And posting a component wich uses them would be in violation of forum rule #11.
TZOTZIOY
QUOTE(Antipodean @ Aug 8 2003, 17:24) *

Just wondering about the possibility of controlling/accessing foobar via a python script (or other languages apart from c/c++).


foo_controlserver is what *I* intend to use. And yes, I had winamp controlled by python too smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.