"Now Playing" signature image ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FatherChaos
Forum Newbie
Posts: 3
Joined: Sun Jan 15, 2006 3:06 pm

"Now Playing" signature image ?

Post by FatherChaos »

First of all, hello everyone, I am new to these forums and to PHP 8).

Would it be possible to use an image, to check when there's a new track playing on Windows Media Player, and to put its name on the image, which would be used as a signature ?

Thanks !
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Yikes :).... If you can find out what track is playing by issuing commands on the command line then yes, by using the system() command. Otherwise I doubt you can do it with windows media player since it's all GUI based unfortunately. My experience with Windows Media Player is close to nothing so I can't really help you with the commands you'd need to run.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

There are plugins for Winamp that do so, but I am not aware of one that does the same for Media Player.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I know msn messenger can read what song is playing on windows media player, not sure how though .. :?
FatherChaos
Forum Newbie
Posts: 3
Joined: Sun Jan 15, 2006 3:06 pm

Post by FatherChaos »

Jcart wrote:I know msn messenger can read what song is playing on windows media player, not sure how though .. :?
Yes, this is on what I am basing my idea. If MSN can see exactly when Windows Media Player changes track and displays it, maybe PHP could do it too.
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

I thought PHP couldn't access the client computer?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I would imagine you could find out what message to send it via the Media Player SDK's

http://msdn.microsoft.com/windowsmedia/ ... fault.aspx
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Check out: http://amip.tools-for.net/index.php?content=about
What is AMIP?

AMIP is an ultimate now playing (np) plug-in. The title stands for (Advanced mIRC Integration Plug-in).
It supports the following players: Winamp 2/5, Winamp 3, Apollo, QCD, Foobar2000 (fb2k) and iTunes.

AMIP integrates with IRC (mIRC, PIRCH, Klient, Bersirc) clients, IM and Blog clients. It can also post currently hearing song information to your site via FTP or HTTP GET and POST. AMIP can be used to generate Dynamic Image Signatures, such signatures can be used in forums, blogs or on your web site. One of the other most cool AMIP features is the Playlist Search (Ctrl+J).
Web integration

There are commands to parse file templates and to execute external processes. This allows to easily publish now playing information on the Web. The good starting point is the Web Integration help section and AMIPDS package available from downloads page. AMIPDS allows to create dynamic image signatures:

Image

You can configure callbacks which will be invoked when player starts/quits and when playback is started/paused/stopped. By placing your code into the appropriate callback you can update song information on the Web upon event and perform other actions.
That's a neat little solution that doesn't require PHP. But if you read the page, it supports exporting data to a text file. So if you wanted to make this a PHP experiment, you could use the text file data.

So if you have a web server running on the same computer as Winamp or Windows Media Player, you could use the file_get_contents() PHP function to grab the information and then use another filesystem function to upload or transfer the data to an online server.

Then from there you can do the image processing with the PHP gd library and do the song display. And maybe even add a timer feature so if an update has not occured within x minutes, it'll show 'No Songs Playing' or 'Media Player Disabled'.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

I wrote something that does this (sort of). http://www.ooer.com/index.php?section=php&id=11 .. That works via a WinAmp plugin.

I also wrote something that does the same thing but it gets the last track played via an RSS feed from http://www.last.fm/ and a Foobar2000 plugin. .. http://www.last.fm/user/onion2k/ for my 'last played' stuff, and http://www.last.fm/onyoursite/datafeeds.php for the data feed stuff. There's some cool stuff like weekly charts of your most played artists, your 'music neighbours', etc.
FatherChaos
Forum Newbie
Posts: 3
Joined: Sun Jan 15, 2006 3:06 pm

Post by FatherChaos »

Sami wrote:So if you have a web server running on the same computer as Winamp or Windows Media Player, you could use the file_get_contents() PHP function to grab the information and then use another filesystem function to upload or transfer the data to an online server.

Then from there you can do the image processing with the PHP gd library and do the song display. And maybe even add a timer feature so if an update has not occured within x minutes, it'll show 'No Songs Playing' or 'Media Player Disabled'.
That sounds interesting... However, as said above, I am totally new to PHP. Would it be something hard to do ? Where should I start learning if I want to make a program like above?
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

I don't know of a simple tutorial, so taking it one step at a time and learning from trial and error is the best way.

Take note of the steps I mentioned and then look at the links I posted. The manual is a great resource and it has everything you need to get started with this sort of thing.

By the way, I just noticed I didn't link directly to the file uploading manual page. Here it is: http://php.net/features.file-upload
Post Reply