Possibly OT: Controlling winamp with Python

  • Thread starter Brent W. Hughes
  • Start date
B

Brent W. Hughes

I'm running Windows XP and I'm using winamp to listen to internet radio
stations. Occasionally, an annoying commercial will come on. I would like
to write a Python program that, when run, will, in essence, push on winamp's
mute button. Then, after say 20 seconds, it will push the mute button again
to restore the sound. Is such a thing possible?

Brent
 
K

Kartic

Brent,

Question : how will your python script distinguish between a commercial
and a song?

I can understand if you are writing a streaming client in Python; in
that case you can analyze the audio stream and decide if it is a
commercial or a song/music.

Did you check to see if there is already a Winamp plugin that would
achieve this for you?

Thanks,
-Kartic
 
B

Brent W. Hughes

The Python program won't decide whether a commercial is playing, I will. At
that point, I will run my program which will press mute, wait 20 seconds,
and then press mute again.

Actually, I could leave the program running but minimized to the task bar.
When I hear the advertisement, I just click on the program in the task bar.
It knows what to do from there.

Brent
 
B

Bill Mill

Brent,

You could write the Python program as a proxy of the internet stream.
Basically, you would point your proxy at the web stream and receive
the data it sends. At the same time, you would be listening for
connections on some socket on the local machine. You would then point
winamp towards the local socket instead of the internet station.

If you put a "mute" button on your program, pressing it could trigger
your program to begin sending empty data to winamp, and resume sending
it at some arbitrary point.

Peace
Bil Mill
bill.mill at gmail.com
 
J

Josef Meile

Hi Brent,
The Python program won't decide whether a commercial is playing, I will. At
that point, I will run my program which will press mute, wait 20 seconds,
and then press mute again.

Actually, I could leave the program running but minimized to the task bar.
When I hear the advertisement, I just click on the program in the task bar.
It knows what to do from there.
You don't need python for this. You can use auto-it to achieve the same
thing. You can download it at:
http://www.hiddensoft.com/AutoIt/

It is easy to program and it works nicely. There is also some similar
thing for python. Perhaps a litle bit more complicated (I haven't
tested it):

WATSUP - Windows Application Test System Using Python
http://www.tizmoi.net/watsup/intro.html

Regards,
Josef
 
D

Dave Brueck

Brent said:
I'm running Windows XP and I'm using winamp to listen to internet radio
stations. Occasionally, an annoying commercial will come on. I would like
to write a Python program that, when run, will, in essence, push on winamp's
mute button. Then, after say 20 seconds, it will push the mute button again
to restore the sound. Is such a thing possible?

Yes - IIRC WinAmp supports some "global" Windows messages that any app can send
to make WinAmp do different things. Don't know if there's a "mute" command, but
at the very leasy you could control the volume. You'd have to read their SDK and
then use something like ctypes to fire the Windows message - very doable.

If that doesn't do what you want, then you could go the more hacky route and
grab the WinAmp window and fire a button click in the precise location.
Something like AutoIt (which is controllable via Python) could work as well.

Another route would be to just mute all audio in the system for 20 seconds -
that might be the easiest approach of all. Again, ctypes is your friend - figure
out what APIs you'd need to call and people here can help you come up with the
Python code to call those APIs.

-Dave
 
C

Christos TZOTZIOY Georgiou

I'm running Windows XP and I'm using winamp to listen to internet radio
stations. Occasionally, an annoying commercial will come on. I would like
to write a Python program that, when run, will, in essence, push on winamp's
mute button. Then, after say 20 seconds, it will push the mute button again
to restore the sound. Is such a thing possible?

Search the winamp plugin pages for WinAmpCom, which allows you to control winamp
through COM (if you can't find it, let me know by email, I'll send it to you).
Much less hassle than my initial attempts to control it with SendMessage and
PostMessage etc.
 
J

JanC

Bill Mill schreef:
You could write the Python program as a proxy of the internet stream.
Basically, you would point your proxy at the web stream and receive
the data it sends. At the same time, you would be listening for
connections on some socket on the local machine. You would then point
winamp towards the local socket instead of the internet station.

Winamp buffers incoming streams, so that won't be very functional... ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top