MusicTicker Plug-In v0.271b By Atul Varma, 1999 varmaa@kenyon.edu --------------------------- MusicTicker is a general-purpose plugin for Nullsoft WinAmp which enables you to output the name of the currently playing song and recently played songs to an HTML file ready for publication on the World Wide Web. This is very useful for SHOUTcast servers. In addition, MusicTicker can monitor WinAmp's playlist so that tracks are played in a structure similar to that of a radio station's playlist--i.e., one in which different songs by the same artist should not be played consecutively, the same song should not be played twice in the same hour, and so on. With MusicTicker, if someone is listening to a SHOUTcast server and hears a song they've never heard before and would like to know more about, they can just go to the server's webpage and access the file that this plug-in creates and find out exactly what song is playing, or what that great song that played ten minutes ago was called. In this way, it helps the listener learn about great new music, and it promotes the artist as well. In my opinion, that's what radio's about, whether it's on the net or the air: learning about great new music that you've never heard before. I hope MusicTicker will help SHOUTcast servers do this. SYSTEM REQUIREMENTS ------------------- The MusicTicker Plug-In requires WinAmp 2.05 or higher. If you can get WinAmp working, then this plug-in should work as well. WHERE TO GET IT --------------- The latest version of MusicTicker can be found at: http://www2.kenyon.edu/People/varmaa/mticker MusicTicker can also be downloaded from Winamp's website (www.winamp.com) in the "General Plug-Ins" section, though it might not have the latest version. INSTALLATION ------------ To install MusicTicker, just copy the gen_mticker.dll and mt_subs.inf files to your winamp\plugins folder. Then copy the mticker_pow.gif file to the directory in which you want to put the output HTML file (the file that shows the currently playing track and recently played tracks). CONFIGURATION ------------- Start WinAmp (or restart it if it's currently running), and go to the Preferences dialog box (type Ctrl-P at the main WinAmp window). Go to the "Misc Plug-Ins" tab, and then under the "General Purpose" section select "MusicTicker Plug-In" in the drop-down menu. Then click the "Configure" button next to it. The options in the configuration dialog box are described below. Enable MusicTicker Activates or deactivates the plug-in. SHOUTcast HTML Output: ---------------------- Output Filename This is the file which the MusicTicker plug-in outputs its HTML to. You can output the file to any location on your computer or a network drive. HTML Post-Process Command This is the command that MusicTicker will run immediately after it outputs to the HTML file. You can set this to launch an FTP program that uploads the HTML file to a server (such as Geocities or XOOM.COM), or several other things. For more information about uploading the HTML file to a server via FTP, see the "Posting MusicTicker's HTML output" section of this document. If you don't understand what this means, think of it this way: every time MusicTicker writes the name of the currently playing song/recently played songs to HTML, it goes to the Windows Start Menu, selects "Run...", and puts in whatever is in this field and selects "OK". If this field is blank, then it doesn't run anything at all. If you select "Browse..." you can pick the executable or batch file using the standard Windows open file dialog box. If the file you select has a space in its name or its path (e.g., C:\Program Files\someprogram.exe), YOU MUST put quotes around its name before you specify parameters for it! Proper syntax would be: "C:\Program Files\someprogram.exe" parameter1 parameter2 ... Also, there are some symbols you can use to pass information about the currently playing/recently played songs to the command line. %f -- inserts the name of the HTML output filename you selected. So if you selected "C:\Status.html" in the output filename field of the configuration dialog, "c:\ws_ftp.exe %f" would translate to "c:\wsftp C:\Status.html". %0 -- inserts the name of the currently playing song. %1, %2 ... %n -- inserts the name of the song played %n songs ago (e.g., %15 would be the title of the song played 15 songs ago). %% -- inserts a %. Export only track listing to HTML If you're just using MusicTicker for "normal" purposes and don't know what ASP is, don't mess around with this option. Checking this box makes it so that when MusicTicker exports to HTML, it will not include any information such as the , , or tags. It will only write the table of the song playing and songs recently played to the file. This is useful for ASP and other dynamic HTML scripts which want to paste MusicTicker's output into an already existing HTML file. It can also be used in conjunction with a DOS batch file (executed by the HTML Post-Process Command) to make customized status pages. For example, the HTML Post-Process Command could be set to "C:\command.com /c copy begin.htm + musicticker_status.htm + end.htm > newstatus.htm". Title History list length This is the number of recently played tracks the HTML file will display. I.E., if this is set to 5, then the HTML file will list the last 5 tracks played (not including the currently playing track). Playlist Monitoring Options: ---------------------------- MusicTicker has the ability to "monitor" what is being played in WinAmp and change what is being played if certain conditions are met. I implemented this feature because I'm somewhat dissatisfied with WinAmp's random/shuffle playmode. I think it's because Nullsoft makes WinAmp record the songs that have already been played as their indexes in the playlist rather than as their actual names--this means that if you have a playlist and insert a song in the beginning of it, all the songs that WinAmp thinks that it's already played will not necessarily have already been played, and this means that songs you haven't heard yet will never play, and songs that have already played will repeat themselves! Well, at least that's how I *think* the shuffle mode works, but I could be totally wrong, because I haven't messed around with the shuffle playmode much. In any case, I implemented these features. They probably should not be used for very small playlists, however, as they are meant for a "radio station" sort of usage in which there is a library of at least several dozen songs, several of which are by the same artists. These songs should be played in such a way that songs by the same artist should not be played consecutively, and a song should not be played twice in the same hour, and so on. If you don't want these kinds of features, then you should probably disable all the settings in this section. It should be noted that there are currently a few "pseudo-bugs" in this section. For one thing, it's impossible for MusicTicker to monitor and change the currently playing track without having the currently playing track play for at least a few milliseconds. That is, if something is about to play and MusicTicker tells WinAmp to skip the track, the track will actually play for a few milliseconds before it is skipped. For songs that have a second or so of silence before they start playing, this is not a problem, but for others, their first few milliseconds of audio will be heard. This is an annoying bug that can only be fixed by using a different method for "monitoring" the playlist, which I'm still trying to figure out. If you do use any of these options, they are meant to be used with the "shuffle" and "repeat" modes enabled on WinAmp. Same Artist Check limit Whenever a new track is about to play, MusicTicker will search through the recently played tracks to see if the track that is about to play is by an artist that has recently been played. This value is the depth to which MusicTicker will search the recently played tracks list. For instance, if a song by an artist named "The Softies" was played 3 songs ago and another song by The Softies was about to play, MusicTicker would check back through the recently played tracks to see if a song by The Softies was recently played. So if the value of "Same Artist Check limit" was 5, then MusicTicker would search back through the last 5 tracks to see if a song by The Softies has already played, and if so, then it will skip the current track. Setting this value to 0 will disable it. MusicTicker currently checks the title of the MP3, which can be in a number of formats depending on how you configure your version of WinAmp. By default, WinAmp will check to see if the MP3 has an ID3 tag. If it does, it will format the title in the way defined in the Nitrane MPEG Audio Decoder preferences; by default, this is "Artist name - Title name". If WinAmp finds the ID3 tag, it will send the formatted title, but if it doesn't find an ID3 tag, it just sends the name of the file sans its extension. MusicTicker assumes that the title of the song is going to be in the default "Artist name - Title name" format. All of my MP3's have this file name format by default (e.g., "Cake-The Distance.mp3"), so whether the MP3 has an ID3 tag or not, the title gets sent to MusicTicker in the "Artist name - Title name" format, and this is how MusicTicker expects the song title to be formatted. Same Title Check limit: This is similar to "Same Artist Check limit", except that it checks to see if the entire song title matches, instead of the first three letters. You should probably set the two above values to fairly conservative settings, because if they are high (in comparison to the size of the playlist), then MusicTicker will make WinAmp skip through a LOT of tracks to find one that is acceptable, and this will cause a lot of delay. I have a playlist of about 100 songs and I set the "Same Artist Check limit" to 10 and the "Same Title Check limit" to 50 and it seems to work pretty well. DO NOT set any of the above values to numbers that are greater than or equal to the number of tracks in your playlist! If you want to see what this does, try it out. :) Other Plugin.ini variables -------------------------- There are also a few more config options in the plugin.ini file located in your winamp\plugins directory which aren't accessible through MusicTicker's configuration dialog box. Note that before you go about changing these options, make sure that MusicTicker's configuration dialog box is closed. After making changes to this file, open the configuration dialog; as soon as you do this, the configuration will be re-loaded from disk and the changes you made to the plugin.ini will take effect. EnableHTMLOutput - set this to 0 if you don't want MusicTicker to output to HTML at all. Note that the HTMLPostProcessCmd is not executed if this is set to 0. HTMLTitle - this is what goes in between the tags of the HTML output page that MusicTicker creates (i.e., it's what the title bar of your browser will say when you go to the status page). HTMLBodyProperties - this is what goes inside the <BODY> tag of the HTML output file. Change this if you want to change the color of the text, background image/color, etc. of the entire page. HTMLFont -- this is the font that the entire page uses. HTMLHeader - this is what is at the beginning of the HTML output page, before MusicTicker writes the table about the currently playing/recently played songs. HTMLListColor1 - this is the color of the table cells that say "Currently playing track:" and "Last xx tracks played:". Note that you can also set this to be '#000000 BACKGROUND="my_picture.gif"' to an image as the background of the table cells instead of a color. HTMLListColor2 - same as HTMLListColor1, except this one is this color of the table cells that are the names of the tracks. HTMLServerOfflineMsg -- this is the text that is displayed in the place of the "Currently playing track" table whenever you disable MusicTicker or quit WinAmp. HTMLFooterImage -- this is the filename (including path) of the "Powered by MusicTicker" image. If you want to use a different image or the image is in a different location, just set this to the appropriate value. Note that this image will ALWAYS be linked to the MusicTicker homepage. HTMLRefreshTimeout -- this is the value of the META REFRESH tag in MusicTicker's status HTML file. Set this variable to the interval (in seconds) that you want the user's web browser to re-load the status HTML file (so that the currently playing song and song history are updated on their screen). EnablePlaylistMonitoring - set this to 0 if you don't want MusicTicker to do any playlist monitoring at all. Note that this has the exact same effect as setting the Same Artist Check limit and Same Title Check limit to 0. TitleCheckCount -- if you are getting garbage track names (i.e., the HTML status file lists the currently playing or recently played tracks as combinations of weird characters), then increase this variable's value. Otherwise, leave it alone. POSTING MUSICTICKER'S HTML OUTPUT --------------------------------- There are basically two ways you can post MusicTicker's HTML output: via a local web server on your computer or a LAN computer, or via an FTP upload to a remote web server, such as XOOM.COM, Geocities, etc. Local Web Server ---------------- If you already have a web server and a domain name set up, you're ready to go; just set the path of the output filename to be the file on your server that users will view. If you don't already have a web server up, here are two helpful resources you might want to know about. If you don't have a web server application, get OmniHTTPd. It's free for non-commerical use, it's small (the install file is less than one megabyte), and it's simple yet flexible. You can get it at: http://www.omnicron.ab.ca/httpd/ If you have a dynamic IP and would like to get a host name at which anyone can contact your server at any time, try ez-ip. Ez-ip is a free dynamic hosting service that gives your computer a hostname of "<something>.dyn.ez-ip.net". That way, they can just go to http://<something>.dyn.ez-ip.net to access your web server and see what you're playing. You can sign up for a dynamic hostname for FREE at http://www.ez-ip.net Uploading to a Remote FTP Server -------------------------------- If you need to send MusicTicker's HTML output to an ftp server, you need to use a program that supports command-line file transfers. Via Windows FTP: You can actually just use the FTP program that came with Windows! Here's an excerpt from an email a user sent me: I've had great success using the FTP command from Windows in concert with my shoutcast server. What I did was I made a text file with the command necessary to connect to the ftp server in it, and then made the call to ftp from MusicTicker through a batch file (so I could set things like screen settings and run minimized, etc). So here's the basic premise: Contents of login.txt: user (username) <- sends username pass (Password) <- Sends password cd dirname (if needed) <- changed to a specific dir put C:\Pathofsavedfiles\songlist.htm <- sends the html file up bye <- closes the session Contents of sendpage.bat: ftp -n -s:c:\pathofsavedfiles\login.txt ftp.servername.com I call the batch file instead of the actual comand so I can set PIF settings. Many thanks for this method go out to Kevin Wardrop! Via WS_FTP: WS_FTP is a great client that is free for non-commerical use. If you don't already have it, you can get it at: http://www.ipswitch.com/Downloads/ws_ftp_LE.html Once you have WS_FTP (or another compatible ftp client), you need to tell MusicTicker how to interface with it. After MusicTicker creates its HTML output, it looks to the HTML Post Process Command field. If this variable is set to a non-blank value, it will use it as the input for a command-line execution. This is the equivalent to what you would type in after selecting the "Run..." comand from the Windows Start Menu. For WS_FTP, this line should be something similar to: HTMLPostProcessCmd="C:\Program Files\WS_FTP\WS_FTP95.EXE" local:C:\status.htm MYREMOTEFTPPROFILE:\status.htm Of course, this should all be on ONE LINE in the plugin.ini file (it was made two lines in the example above for strictly layout purposes). Change the path to WS_FTP95.EXE if you didn't install it in the C:\Program Files\WS_FTP directory, and change the C:\status.htm to whatever file you set the output filename to in MusicTicker's configuration dialog box. MYREMOTEFTPPROFILE is the profile that you set up in WS_FTP for accessing your FTP site. If you need more help on what any of these things mean, or what all of WS_FTP's command-line options are, just launch WS_FTP and click on "help" and search for the keyword "command line". After you have this configured, MusicTicker will then launch WS_FTP (or whatever program you put in the HTMLPostProcessCmd field) every time it makes a new HTML file, and upload it to your web server. I've tried this with XOOM.COM, and it actually worked quite well--the HTML file MusicTicker creates is only 2-3 KB, so the upload is very fast. THE MUSICTICKER SUBSTITUTIONS FILE ---------------------------------- The MusicTicker Substitutions File provides a great way for your listeners to learn more about the music you're playing, and a whole lot more. It's a bit lengthy to explain, so I just wrote separate instructions for it. If you've got MusicTicker up and running and you want to try something interesting, read the file mt_subs.txt to learn more about this great feature. LICENSE ------- This plug-in is, and always will be, totally and completely free. Once I get the code cleaned up a bit, I will probably release the source code and put this under the GNU Public License if people actually use it. Speaking of which, *please* email me if you use MusicTicker. There are a lot of features I'd like to add, but I'm not going to waste my time with it if nobody uses this thing besides me. Oh, and the whole "if this program screws up your computer, it's not my fault" thing applies here too. Although I don't see any way it could damage your computer in any way, it's not my fault if it does. CONTACT INFO ------------ If you have questions or comments, please feel free to email me at varmaa@kenyon.edu. FUTURE ENHANCEMENTS ------------------- Well, like I said, there are a lot of features I'd like to add, but if nobody uses this plug-in besides me, I'm not going to bother adding them. In particular, I think the following would be cool additions: - ODBC/SQL support, so that dynamic HTML pages like Active Server Pages (ASP) can access them and make customized pages. In this way, the MusicTicker plug-in would basically serve as an ODBC/SQL interface to WinAmp, which would be really cool. OTHER RESOURCES --------------- Get Linux, it rules. Of course, Nullsoft will have to port WinAmp to Linux, but they'll have to do that once everyone switches OS's. :) You can find out more about it at: http://www.linux.org SPECIAL THANKS -------------- - To Nullsoft, for making the best MP3 player on the planet. - To Cassie, Toadie, Hamster, and k-rad, for beta testing this silly thing. VERSION HISTORY --------------- 0.271b -- Added HTMLFooterImage variable to plugin.ini. Removed EnableGarbageTitleChecking variable from plugin.ini. Removed sc-logo.jpg from the distribution and its inclusion in the default HTMLHeader variable, since nobody was using it. Added mticker_pow1.gif ("Powered by MusicTicker") to distribution, replaced HTML footer with image. Implemented %a token in Substitutions File parser. Cleaned up .mp3-extension stripping bug. Cleaned up more of the source code for GPL release. 0.27b -- Added HTMLRefreshTimeout variable to plugin.ini. Fixed missing </TABLE> tag in export playlist to HTML feature. Got rid of the silly "Open as read-only" checkbox in the open/save file dialogs. Implemented artist/title substitution feature. Implemented stripping of erroneous .mp3 extensions in track names. Cleaned up source code for release under the GPL. 0.262b -- Added TitleCheckCount variable to plugin.ini. Implemented title check counting (to prevent garbage track names). 0.261b -- Added EnableGarbageTitleChecking variable to plugin.ini. Implemented checking of "garbage" track names. Cleaned up memory allocation code. 0.26b -- Added HTMLTitle, HTMLHeader, Enable, EnableHTMLListOnly, HTMLBodyProperties, HTMLListColor1 & 2, HTMLFont, and HTMLServerOfflineMsg variables to plugin.ini. Added enable/disable checkbox in config dialog. Added "HTML Post-Process Command" field in config dialog. Added "Export only track listing to HTML" checkbox in config dialog. Fixed posting of server offline message bug. Changed artist matching algorithm to check entire artist name instead of only the first 3 letters. "Apply" button in configuration dialog now works properly. Error message displays when plug-in can't write to file. Several other bugfixes. 0.25b -- Cleaned up some of the thread code and removed a few potential bugs. Implemented HTMLPostProcessCmd configuration element. 0.24b -- Minor fixes to the HTML output, as well as to some of the docs. MusicTicker also now checks to make sure the user is running WinAmp v2.05 or higher at startup. 0.23b -- Initial public release.