How to make a bot to run SHOUTcast with a quick and simple bit of irc bot source code for relaying information from your SHOUTcast into IRC channels. This bot is setup to only relay the current song, however could be easily extended to do more.
It is achieved through the use of a standard irc engine that powers all my basic command oriented bots, this engine is not suitable for spam. Commands are then passed back to a command parser handler.
The basic SHOUTcast information page is then scraped for the necessary information and passed back to the channel. The current song was sufficient for my needs.
However you can definitely see where there is more information that users may want to see in channel, or even where you could trigger an event to only start spamming a channel once your active listeners dropped below a certain point.
Because the SHOUTcast page is not scraper friendly, we have to do a couple things to make sure we are able to parse the data. There are 2 main hangups.
1. The page detects your user agent and relays different data depending on the browser. To overcome this I am simulating an IE7 browser.
2. The headers returned are not safe for the .net framework and WILL cause a crash. With a WebApplication this is easily overcome with a simple edit to the web.config. However with a regular application it is a lil more tricky. Fortunately I found some code where another dev had gone back and reverse engineered the actions taken by the framework upon reading such an entry in a web.config file and replicated them for a regular application.