stplayer is a PHP script to permit the easy selection and playing of MP3 files on a Linux web server. Unlike most other MP3 players, stplayer does not require X-windows or X-clients, just a browser. But, since the command-line MP3 player itself, mpg321, resides on the server, the user needs to be within earshot of the server!
This software also has a number of other improvements over similar projects:
The user interface is oriented towards the playing of soundtrack or classical albums. For these types of music "track shuffling" or displaying all of the "tracks" for a composer make no sense! Typical soundtrack albums have tracks with names like "elevator chase #1" or "volcano explodes". The movements of a classical album are similarly meaningless when taken out of context ("allegro", "andante").
Second, clicking "RANDOM" will display twenty album titles, selected at random. Finally,
clicking "STOP" will use the Unix "ps" and "kill" commands to halt all running mpg321
processes on the server.
Selecting an album will display additional controls. Clicking "ALL" will cause all the displayed tracks to be marked for playing, "NONE" will deselect all tracks. Clicking "PLAY" will cause mpg321 to be invoked with the checked tracks as it's arguments.
Gotchas
I use the "natcasesort" function in PHP, which appears to be something pretty new. Older PHP versions may not have it. You could substitute another sort function without too much loss of functionality.
mpg321 seems to leave a file behind in /tmp. If you run it from the command line as one user, PHP may not be able to write to that file as whatever user Apache runs as. Be sure to delete the file by hand after running mpg321 manually.
Work Arounds
Any other command-line MP3 player can probably be substituted for mpg321. The Perl program (2 lines) and the MP3::Info module are used solely to provide track duration information. These references could just be deleted from the PHP script if need be.
Where to get it
You can download the source for this application from the Sourceforge File List Page for this project.
See also, the Project Page.
If you don't have mpg321 installed already, you can get it here: http://sourceforge.net/projects/mpg321.
Likwise the Perl MP3::Info module may be found here: http://search.cpan.org/author/CNANDOR/MP3-Info-1.02/Info.pm