• Welcome to Valhalla Legends Archive.
 

winamp play wildcard

Started by Tass, November 26, 2005, 08:34 PM

Previous topic - Next topic

Tass

Like stealthbot has the /play * command, how did he do that?

LivedKrad

I'm pretty sure he used some sort of API to remotely control or manipulate a Winamp instance (maybe in the older versions?). I'm not sure about the new Stealthbot, does it still open up Winamp to play the songs or do the songs play on their own? If the latter, then an API would still be used to play the external file. I believe to manipulate Winamp there is some sort of developer SDK though.

rabbit

I'm not sure how it's done in StealthBot, but I tell Winamp to open the "jump to file" window, and then I grab the handle of the listbox, the textbox, and the enter button.  I tell the textbox to contain the text I want (IE: the song's name), and check to make sure there is something in the listbox, and if so, I "use" the enter button.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

l2k-Shadow

You can also open up the playlist file inside the winamp folder, parse it, and figure out which position in the playlist is the song you want it to play. Then you just set the winamp playlist to that position and play. The tricky part about doing this though is that the playlist saves in the file after you exit winamp out... So if you make a new playlist while winamp is running and then try to use this method it will not work and you will probably need to use some memory reading API to get the song names, however, once you exit winamp the method should work.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Tass

Rabbit, know where I can get a good api. I can't find any with this..

shadypalm88

Quote from: l2k-Shadow on November 27, 2005, 02:17 AM
You can also open up the playlist file inside the winamp folder, parse it, and figure out which position in the playlist is the song you want it to play. Then you just set the winamp playlist to that position and play.
Yep, that's how I do it, anyway.  Just a reminder, when you read it in VB, make sure you use Line Input #n, SomeStringVar instead of Input #n, SomeStringVar.

Quote from: Tass on November 27, 2005, 10:34 AM
Rabbit, know where I can get a good api. I can't find any with this..
Go to the NSDN website and download the SDK.  The definitions for the Windows messages that you can send to Winamp to get information or to make it do things are in winamp/wa_ipc.h inside that archive.  Declare the SendMessage function in VB, define some constants if you want and go.

In order to send the messages to Winamp you first need to acquire its window handle (HWND).  If you only want to support Winamp 2.x, you can just use FindWindow to search for "Winamp 1.x" (literally an 'x' character there).  If you want Winamp 5 support, you'll need to use EnumWindows and scan for it, because the window title in 5 is either "Winamp 5.##" when there's nothing playing or loaded, or "#. Artist - Title - Winamp" when there is.

rabbit

Quote from: l2k-Shadow on November 27, 2005, 02:17 AM
You can also open up the playlist file inside the winamp folder, parse it, and figure out which position in the playlist is the song you want it to play. Then you just set the winamp playlist to that position and play. The tricky part about doing this though is that the playlist saves in the file after you exit winamp out... So if you make a new playlist while winamp is running and then try to use this method it will not work and you will probably need to use some memory reading API to get the song names, however, once you exit winamp the method should work.
I did that with RaBBiTBot (the source is around), and it really....really didn't work/was fugly.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

LivedKrad

Quote from: shadypalm88 on November 27, 2005, 11:10 AM
Quote from: l2k-Shadow on November 27, 2005, 02:17 AM
You can also open up the playlist file inside the winamp folder, parse it, and figure out which position in the playlist is the song you want it to play. Then you just set the winamp playlist to that position and play.
Yep, that's how I do it, anyway.  Just a reminder, when you read it in VB, make sure you use Line Input #n, SomeStringVar instead of Input #n, SomeStringVar.

Quote from: Tass on November 27, 2005, 10:34 AM
Rabbit, know where I can get a good api. I can't find any with this..
Go to the NSDN website and download the SDK.  The definitions for the Windows messages that you can send to Winamp to get information or to make it do things are in winamp/wa_ipc.h inside that archive.  Declare the SendMessage function in VB, define some constants if you want and go.

In order to send the messages to Winamp you first need to acquire its window handle (HWND).  If you only want to support Winamp 2.x, you can just use FindWindow to search for "Winamp 1.x" (literally an 'x' character there).  If you want Winamp 5 support, you'll need to use EnumWindows and scan for it, because the window title in 5 is either "Winamp 5.##" when there's nothing playing or loaded, or "#. Artist - Title - Winamp" when there is.

I so already suggested the SDK. Is it common procedure to post massive information (which is very helpful as always, Eric) and the corresponding links now? I'm behind the times.

Topaz

Does the SDK include information on how to load a playlist?

Joe[x86]

I doubt it, but seeing as how the Winamp Library is a M3U (it is, right?), I'm sure that format is highly documented, and you should be able to figure it out extremely easy.

I looked into the StealthBot source code (the released version, I have no way of viewing the current SB code, don't ask me for it =p), and the play function only sent the command to winamp to begin the playing of the last MP3 to be selected. Playing specific tracks (even by number) wasn't implemented until later.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

rabbit

Winamp can handle M3U and PLS, and another (I think).
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

l2k-Shadow

Quote from: rabbit on November 27, 2005, 12:42 PM
Quote from: l2k-Shadow on November 27, 2005, 02:17 AM
You can also open up the playlist file inside the winamp folder, parse it, and figure out which position in the playlist is the song you want it to play. Then you just set the winamp playlist to that position and play. The tricky part about doing this though is that the playlist saves in the file after you exit winamp out... So if you make a new playlist while winamp is running and then try to use this method it will not work and you will probably need to use some memory reading API to get the song names, however, once you exit winamp the method should work.
I did that with RaBBiTBot (the source is around), and it really....really didn't work/was fugly.

Then your parsing was incorrect. Mine works flawlessly with the exception, like i already said, of not being able to parse the current playlist if you make it while winamp is running.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

rabbit

Well, you failed.  There is an API to save the playlist to a specific file (defaults to X:\installpath\Winamp.pls, but can be changed with another API), so that you can parse it.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

l2k-Shadow

I'm sure there is, I didn't really spend too much time with this...
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

PaiD

Also on the SDK there are a few api calls that are only accessible to plugins. They include some APIs like getting the title and the path of the playing file. To get access to these APIs you need to get into the memory of Winamp (Worth it :p)