SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Sponsored Links

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

This is the README/INSTALL file for the Mp3 Database version 6.7

Files included:

        README
        UPGRADE
        cgi-bin/mod_queue.cgi
        cgi-bin/pause.cgi
        cgi-bin/play.cgi
        cgi-bin/pmpg123
        cgi-bin/run_queue.pl
        htdocs/Mp3.css
        htdocs/Mp3Display.php3
        htdocs/display.phtml
        htdocs/changecd.phtml
        htdocs/index.phtml
        htdocs/mounted.txt
        htdocs/queue.phtml
        htdocs/random.phtml
        htdocs/searchmp3.phtml
        htdocs/stop.phtml
        htdocs/volume.phtml
        htdocs/troubleshoot.phtml
        styles/*.Mp3.css

What you need:

        MySQL
        E Sound Daemon (esd) *
        mpg123
        ogg123
        Apache/PHP
        aumix
        perl

What http needs to be able to access:

        Write access to /tmp
        Read/Execute access from /bin
        Read access from .esd_auth in http's home directory *
        Write access to /dev/mixer 
        Write access to /dev/audio
        Write access to /dev/dsp

        * == See note below.

What you need or may want to edit:

        htdocs/Mp3Display.php3:
                Change the user, password, database, column, etc.
                It's fairly documented, should be pretty easy.
        cgi-bin/play.cgi:
                There is a location variable at the top that points 
                to the location of your songs.  This will need to be 
                changed depending on where your mp3s are stored. 
        cgi-bin/pmpg123:
                There is a HOME variable set to the home directory
                of the webserver.  Change this.
        htdocs/Mp3.css:
                If you want to change the default look and feel.
        htdocs/styles/:
                Contains a few color schemes if blue isn't your style. 
                Just copy these over the Mp3.css in htdocs.

What your MySQL database needs to look like:

        You can have multiple columns inside your tables.  You will need to 
        specify which column the display.phtml file will look in for the song 
        titles (See note in next paragraph).  You can have multiple tables 
        inside that database for organization purposes.  The index.phtml will 
        list every table in the database.

        The song title needs to be an exact copy of the filename, without the path.
        Eg: "Bubba - My Song.mp3" and not "/mnt/mp3/Bubba - My Song.mp3"

What could go wrong:

        If you don't allow apache to be able to access /tmp, this will mess with a lot
        of the scripts and php files.  I'd suggest getting getting read/write access to
        /tmp, but if that's not at all possible, 'grep' the cgi-bin and htdocs for all 
        the locations that will need changed.
        They should be: Mp3Display.php3, queue.phtml, pause.cgi, play.cgi, pmpg123, and
        run_queue.pl

        Also, we assume the webpages will be in the root of the webserver.  This could
        screw up a lot of the links if they are not.

        Lastly, the Random playing script assumes it can write to the /tmp/ directory.
        If this is not the cause, you can modify the script to point to a writable 
        directory.

*Why you need the E Sound Daemon (Or how to setup audio for different distros):

        RedHat requires the nonprivilaged user to access the audio devices with ESD.
        As noted above, I added 'http' to the 'wheel' group, chmoded mixer/dsp/audio to 
        770, and changed the group on those three devices to 'wheel'.  From there, I 
        spawned ESD manually (Or let http do it by attempting to play a song, which
        causes ESD to load, then hit the song again so it plays), and that got me 
        going.

        Also, /dev/mixer usually doesn't allow write access from the group http is in,
        so you might need to chmod it so http can change the mixer settings.  This
        also applies to /dev/audio and /dev/dsp. Depending on your audio libraries, YMMV.
        I chmod mixer/dsp/audio to 770, and chgrp to wheel on boot.

        For Debian, you can add http to the 'audio' group, and that takes care of 
        everything.  Debian also doesn't need/use ESD.

Filename problems:

        Certain characters will not get passed from the PHP code to Perl, or will not be
        handled by perl.  This is more than likely caused by my inexperience, and I am trying
        to fix these (few) cases.  Currently, I only know of the # character.  I'm sure there
        are more.  If you know of more (And perhaps a proper fix), please let me know.

OGG/Mp3 Selection:

        (New to version 5.6)
        The PERL scripts check the filename extension for 'mp3' and 'ogg'.  More correctly,
        the scripts check the last three letters of the filename.  If you have files
        that don't match either of these extensions, and was relying on the player
        to assume the file was a mp3, this can now cause you problems.
        (New to version 5.7)
        If the extension isn't .mp3 or .ogg, 'file' is run on the file to help determine
        if it's a Mp3 or an Ogg.  If file doesn't say it's either one, we error out.

Do I really need both mpg123 and ogg123?:

        No.  You can use either one.  If you only want ogg, forget mpg123.  If you only want
        mp3, forget ogg123.  But to play both formats, you obviously need both. =]

What other utilities do I need?:

bash, awk, grep, kill, file, ps, and that should be it.

Can I use ^ and $ to modify my search?:

        Yes, using ^ at the front of your string will only show matches starting with that 
        word.  Using $ at the end of your string will only show matches ending with that word.
        The $ is a little shoddy.  Basicly it'll append four 's to the end of the string, and 
        not attach a MySQL wildcard at the end.  The "___" is a MySQL single-character wild-
        card, and is used to take the place of ".mp3" or ".ogg".

License: http://www.crown.net/~axe/quedit/license

What's new in this version:

        6.8:
                Fixed missing extension stripping on non-mounted CD displays.
                Fixed age-old incorrect use of CSS's ID tag (Should of been using CLASS).
                Fixed incorrect color codes in some CSS files.
                Applied a font styling to the text. (Tahoma, 12px)
                Minor changes to Mp3Display.php. If you are upgrading from an older
                 version, you can probably continue to use your old file.

        6.7:
                Been awhile!
                Changed the play.cgi links to encode the URL during link construction.
                Random song selector.
                There are minor changes all over the board, so you'd be better off
                 overwriting all the files and just resetting up the few files you 
                 need to.

        6.6:
                Added a few color styles, and compressed the Mp3.css file.
                Switched from using cookie's to SESSION variables.
                 (So your server needs to support SESSIONing or else grave
                 things will happen. =] )
                Added a Referer check to Mp3Display.php3 (So you need to drop in
                 the new one if you are upgrading)
                Changed changecd.phtml to show which CD is mounted in the dropbox.
                Cleaned up code in multiple pages (Switched from fetchrow to fetch_array).
                Removed _GET variable from pause.cgi.
                Removed dangling variables from a few pages.
        
        6.5:
                Set cookies before outputting html in queue.phtml and changecd.phtml.
                Fix another bug with search field being empty.
                Fix another bug with search field ending in 'and' or 'or'.
                Added ability to use '$' in search field (See note above).
                Fix typos and clearified notes in README.
                Updated README to explain search features.
                Created an UPGRADE document.

        6.4:    
                Updated docs for Debian setup, and clearified my Redhat setup procedures.
                Added a link to the license in README.
                Fixed search bug when the search phrase contained a ', the search would error.
                Fixed search bug when the search statement started with 'and' or 'or'.
        
        6.3:
                Cleaned up a few preg_replace actions.
                Stripped .mp3 and .ogg from end of files in display.phtml, search.phtml, 
                 and play.cgi
                Fixed queue.phtml's 'Return to Previous' link.
                Fixed all known WARNINGS from PHP.
                Updated docs.

        6.2:
                New search front-end.
                Playing a song through the search will refresh back to your search.
                Removed 'Return to Previous' link in search. It never worked.
                Cleaned up some 'echo' tags.
                Added a $httproot, so as not to anger Mozilla.

        6.1:
                Added ability to pause the execution of the queue.
                Have the 'select' statement in display.phtml and searchmp3.phtml order 
                 alphabetically.
                Added a 'Return to Previous' link to queue.phtml.
                Fixed flawed logic in queue.phtml, also cleaned up code a bit.
                Moved a variable from play.cgi to pmpg123.
                Removed a lame variable from Mp3Display.php3
                Moved more table styles out of searchmp3.phtml into Mp3.css.
                Code cleanup (Changed from using " to ' where it made the code cleaner.)
                Fixed typo in docs.

        6.0:
                Fixed code indention in all files.
                Fixed a HTTP_REFERER problem that affected Mozilla 1.0 for Linux in the perl 
                 files.
                A couple other minor fixes.

        5.9:
                Added an option to specify where the Previous and Next CD links will be (Top, 
                 bottom, or both).
                More robust code in stop.phtml.
                Fixed variable in changecd.phtml and Mp3Display.php3.
                Fixed a false-report bug in queue.phtml.
                Updated docs.

        5.8:
                Added a 'Return to Previous' link in the changecd, search, and volume pages
                 that will allow you to either return to the CD you came from, or to the 
                 index.  The volume page makes use of a session cookie.  This becomes active
                 when you have the 'All CDs' mount option enabled.
                Fixed the second 'Return to mounted CD' link in the search page.
                Changed to the new(er) PHP4.2 style global/env variables.
                 If you find any bugs, please let me know.
                Updated docs.
        5.7:
                Changed play.cgi to better handle mp3/ogg selection.
                Fixed the 'Return to mounted CD' link in the search, volume and queue page
                 when all CDs are mounted.
                Fixed search results display to create links out of all results when all
                 CDs are mounted.

        5.6:
                Added OGG support:
                 Added mp3/ogg file extension checks to run_queue.pl and
                 play.cgi.  Also added to pmg123 shell script.
                Fixed queue.list location in queue.phtml.
                 Check Mp3Display.php3!
                Updated docs.

        5.5:    Removed 90% of tables in favor of CSS + DIV's.
                Fixed mounted.txt search location in changecd.phtml
                Added a 'All' option to mounting CDs.  In case you have all
                 your files on your HD (or similar), this will allow you 
                 to play from all CDs, instead of just the one.

        5.4:    Queue! (Please let me know if you experience any problems)
                Changed various links in the navigation frames.

        5.3:
                Fixed broken stylesheet link in troubleshoot.phtml.
                Added Prev/Next links in the display page to jump to the next CD.
                Removed HEIGHT tag out of style-sheet which caused some improper 
                 formatting in certain browsers.

        5.2:
                Fixed typo in README.
                Fixed missing HTML tags.
                Updated docs about ESD and sound setup.
                Created a troubleshoot.phtml page to get general diagnostics on the 
                 webserver. Eg: To make sure we can open the devices and find aumix.

        5.1:
                Fixed misbehaved 'Return to mounted CD' links on volume, changecd, and 
                 search pages.
                Fixed misbehaved autorefresh on Stop page.
                More robust character-removal code in play.cgi (And more simple).
                Gave the full footer to ChangeCD, Volume, and Search pages.

        5.0:
                Search page can now take two strings (Eg: piggy & bank) to narrow 
                 the search down. 
                Search page also has a 'And/Or' to help narrow the search.
                Added a counter to the search page to show # of results.
                Moved pmpg123 out of the /bin directory, and into the /cgi-bin
                 directory.  Please remember to remove the file out of /bin.

        4.9:
                Changed how the mounted CD is shown in display.phtml (Only slightly)
                The ChangeCD and Search pages are pretty.
                The Volume page is prettier.
                Other minor cleanups.

        4.8:
                Minimizing PHP-Parsable code. (More standard HTML)
                Moved decorations to a CSS template.
                 The color-scheme can theoretically be entirely altered by
                 modifing the Mp3.css file, and basicly nothing else.
                 Also added some basic pretty-ness.
                Fixed some bad color-types in volume.phtml
                Fixed a broken end-center tag in volume.phtml
                Fixed a missing end-bold tag in volume.phtml
                Fixed misplaced tags in searchmp3.phtml
                Added more removal-code to play.cgi
                Removed some dupe tags in play.cgi
                Added a little more error control to play.cgi

        4.7:
                Made the HTML more compliant (almost works perfect in Amaya 4.2.1).
                Removed an absolute link in index.phtml.
                Fixed the search, so it truely only pulls the DB column 
                 specified in Mp3Display.php3
                Fixed a forgotton /center tag in volume.phtml.
                Fixed a BR in changecd.phtml that IE masked.
                Fixed ChangeCD's Return to Mounted CD link - Also will only
                 display if there is a mounted CD.

        4.6:    
                Rewrote all scripts but play.cgi into PHP scripts.
                Attempting to minimize exploit possibilities, thanks to Lao.
                 Some characters can be passed to play.cgi which will cause 
                 mpg123 to segfault.  I recommend not allowing outside access,
                 which is pretty much a given.
                Centralized code for the connection into Mp3Display.php3
                Moved the Connect() in the search page.  Connecting when we don't
                 need to connect.  Now it connects only when it's going to display
                 results.
                After upgrading to RH7, I assumed the .esd_auth file was gone, but
                 it appears I was wrong.  Updated the doc for that error.
                The volume and search page can now return you to the display of 
                 the mounted CD.
                Add a 'Return' to the Change CD page incase you change your mind.
                Made changecd.phtml and volume.phtml recursive pages like the search
                 page.
                Of course, updated the docs as a whole.

        4.5:
                Now choose which column the songtiles will be in.
                Updated the docs a bit.
                De-centralized some code in Mp3Display.php3
                Removed the space-check when playing a file.
                Made the ChangeCD page an option list, instead of a entry.
                Removed searchmp3-result.phtml - Made searchmp3.phtml recursive.
                Can now play mp3s from a mounted CD from the search result's page.
                Can also access the CD's page from the search page, by clicking on 
                 the CD name.
                Index.phtml will 'mark' the mounted CD on the page, so you don't 
                 forget which CD is mounted... =]

        4.0:
                Added the ability to change the volume.
                Centralized more code into Mp3Display.php3
                Cleaned the search more, should be next to perfect now.. =]
                Made a next-to-global footer, killing off more redundant code. 
                Updated the README..cough...

        3.7:
                Added a 'currently playing' display at the end of the HTML, and some
                 code minimizing.  
                Removed some unused code in Mp3Display.php3

        3.6:
                Have perl replace characaters that could mess with the shell.  We
                 turn them into ?'s.
                Have pmpg123 echo the path and filename to the mpg123.lock file for
                 future additions of putting the song title being played on the 
                 html pages.

        3.5:
                Fixed search to only show CDs that matched the search query. 
                 It use to show all CDs, no matter what, but only the searched songs.

        3.0:
                Decided a little changelog would be good.
                First public release.


Sponsored Links

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.