To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Code Critique

Code Critique Having someone critique your code is always a great way to hone the skills. Stop in and post your code to see what your peers may have done differently.

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-16-2003, 10:17 PM   #1
coditoergosum
PHP Addict
 
coditoergosum's Avatar
 
Join Date: Nov 2002
Location: Salt Lake City, Utah
Posts: 352
Control Winamp from a browser

So, one of my latest projects is to create a system that will integrate with Winamp and allow you to start/stop/load files/list your playlist/etc./etc...

Well the first part (and good majority) of it is done... and needs testing. I'm curious to see if it will actually work on a different system/platform.

You can see it running on my server/pc here: http://gagon.net/phpamp/ . Let me know if you want the source and I'll package it all up in a zip file.

Basically what it does is initiate a curl connection to a Winamp plugin to do various things. The Winamp plugin that has to be installed to make it work is basically a little web server that runs in Winamp. In theory it should work across platforms/networks, i.e. you could have a Unix server in london running the webserver controlling a Windows box in Tokyo with Winamp installed. But the webserver and Winamp are both on the same machine in my setup.

By itself it's a pretty trivial, novelty toy... I mean, it's kind of cool to control Winamp through a browser... but long term it's part of a larger project I have brewing, which you may hear about on CNN in the future... or not... haha.

Anyone want to test it for me?
__________________
<? include("beer.php"); echo("Mmm"); ?>
http://gagon.net
coditoergosum is offline   Reply With Quote
Old 12-16-2003, 10:23 PM   #2
coditoergosum
PHP Addict
 
coditoergosum's Avatar
 
Join Date: Nov 2002
Location: Salt Lake City, Utah
Posts: 352
Oh yeah, forgot one of the most important parts... here is the plugin winamp needs to make it all work: http://winamp.com/plugins/details.php?id=27865
__________________
<? include("beer.php"); echo("Mmm"); ?>
http://gagon.net
coditoergosum is offline   Reply With Quote
Old 12-21-2003, 08:01 AM   #3
intenz
Xtreme Member
 
intenz's Avatar
 
Join Date: Aug 2001
Location: Reykjavik, Iceland
Posts: 506
Nice, I would like to see the source of that.
__________________
Curiosity killed the cat.
intenz is offline   Reply With Quote
Old 12-22-2003, 03:00 PM   #4
Pearl0511
Junior Member
 
Join Date: Dec 2003
Posts: 1
hmm. have you looked at this before.
Quote:
http://www.nullsoft.com/free/wwwinamp/
You might be trying to reinvent the wheel
Pearl0511 is offline   Reply With Quote
Old 12-22-2003, 03:13 PM   #5
LordShryku
kung foo code monkey
 
LordShryku's Avatar
 
Join Date: Aug 2002
Location: Occupational Hypnotherapy
Posts: 7,473
Hrmmm...the whole "reinventing the wheel" saying never sat right with me. The way I see it, if the wheel had never been reinvented, we would all still be riding in carriages, instead of SUV's with 26 inch wheels on gold spoke rims.

Anyway, I guess what I'm saying that in order to improve things, it doesn't hurt to have someone else try it also. Could you imagine if no other browsers were made except for IE because no one wanted to "reinvent the wheel"?
LordShryku is offline   Reply With Quote
Old 12-22-2003, 03:32 PM   #6
Moonglobe
Better fan than rebelo!
 
Moonglobe's Avatar
 
Join Date: Apr 2003
Location: brain://localhost:left-side
Posts: 2,381
Quote:
Originally posted by LordShryku
Hrmmm...the whole "reinventing the wheel" saying never sat right with me. The way I see it, if the wheel had never been reinvented, we would all still be riding in carriages, instead of SUV's with 26 inch wheels on gold spoke rims.

Anyway, I guess what I'm saying that in order to improve things, it doesn't hurt to have someone else try it also. Could you imagine if no other browsers were made except for IE because no one wanted to "reinvent the wheel"?
It's a different matter entirely when the wheel is triangular in the first place
__________________
there's no place i can be, since i found serenity.
Moonglobe is offline   Reply With Quote
Old 12-22-2003, 08:28 PM   #7
Weedpacket
Custom User Title™
 
Weedpacket's Avatar
 
Join Date: Aug 2002
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,126
Quote:
Originally posted by LordShryku
Hrmmm...the whole "reinventing the wheel" saying never sat right with me. The way I see it, if the wheel had never been reinvented, we would all still be riding in carriages...
You mean on logs

Quote:
if no other browsers were made except for IE because no one wanted to "reinvent the wheel"?
"I don't know what Microsoft are with IE - it's just reinventing the wheel".


The question about wheel development is: do you (a) spend the time developing a new implementation, or (b) use a perfectly acceptable already-existing implementation? It's a matter of how much time you've got to play with (are you writing a web application or an XML parser to handle template processing?), how much skill you possess and how much experience in the problem domain you have.

It kinda breaks down like this: if coditoergosum wanted a PHP-driven winamp-over-http controller as a component of some other task, then the option is there to just see if anyone else has already written such a thing, and whether what they've written is adequate.

If, on the other hand, the PHP-driven winamp-over-http controller was the actual goal of the exercise (instead of something that had to be got out of the way before going on to the more interesting bits of the current project), then coditoergosum would I guess much rather write a new app.
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.

Last edited by Weedpacket; 12-22-2003 at 08:34 PM.
Weedpacket is offline   Reply With Quote
Old 12-22-2003, 08:32 PM   #8
LordShryku
kung foo code monkey
 
LordShryku's Avatar
 
Join Date: Aug 2002
Location: Occupational Hypnotherapy
Posts: 7,473
Well, when it comes to simply playing around to see what you can come up with (which I suspect was the case for this), does reinventing the wheel even matter? I understand that if you're pressed for time, using something that already does everything you need is probably the better bet, but without that time press, who really cares?
LordShryku is offline   Reply With Quote
Old 12-23-2003, 01:11 AM   #9
coditoergosum
PHP Addict
 
coditoergosum's Avatar
 
Join Date: Nov 2002
Location: Salt Lake City, Utah
Posts: 352
Haha. Quite the discussion over whether or not it's worth the time. I've actually asked myself the same thing... and obviously decided it was. I have seen various other programs that allow you to control winamp from a browser, but none of them really worked the way I wanted. Plus, I want to have total power/flexibility over it. In the future it could hook up with a mysql db with songs/playlists/song history/whatever... and maybe even write some code that analyzes the data to figure out what songs you like the most, what songs you typically listen to during different parts of the day, what songs you listen to when you're in different moods, or whatever... based on the track history, then play the songs when it thinks you want to hear them. Sort of a web application that tries to guess what you want to listen to. Haha. What I've coded so far is just the framework I guess you could say. I could go on and on about the possibilities, but I don't feel like typing that much.

The program that Pearl0511 mentioned seems to be very similar to the webserver plugin my script requires. In fact, I might try it out and switch everything over to using it if it performs better. Thing is though, that's just the engine in winamp... or the API if you will. In the grand scheme of things I want to do much more than what these winamp plugins provide... or could ever provide (at least in winamp2/3/5... some future media player might do everything I'm trying to do).

Anyway, I zipped up the files so you can test it yourselves: http://gagon.net/phpamp/zipped/phpamp.zip

The only config that needs to be done is the url. The two xsl files that are included just need to go in the \path\to\winamp\plugins\html dir. The code is kind of sloppy right now, and comments are pretty scarce (plan on cleaning up the code and commenting it next, before adding anything new). Let me know if you have any questions, or even better, suggestions.
__________________
<? include("beer.php"); echo("Mmm"); ?>
http://gagon.net

Last edited by coditoergosum; 12-23-2003 at 01:13 AM.
coditoergosum is offline   Reply With Quote
Old 12-23-2003, 10:37 AM   #10
goldbug
50,000 Watts of Goodwill
 
goldbug's Avatar
 
Join Date: May 2003
Location: Rummaging through your garbage.
Posts: 1,326
Definitely not written in php... but it reminds me a lot of Zink
__________________
Many eyes make few mistakes

goldendance
goldbug is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 03:39 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.