Skip to main content
Topic: Foobar2k and Python (Read 5845 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Foobar2k and Python

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?
:: Antipodean ::

Foobar2k and Python

Reply #1
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.

Foobar2k and Python

Reply #2
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.
:: Antipodean ::

Foobar2k and Python

Reply #3
Quote
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.

Foobar2k and Python

Reply #4
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

 
SimplePortal 1.0.0 RC1 © 2008-2019