Shoucast statistics module

Events happening in the community are now at Drupal community events on www.drupal.org.
yohnson's picture

2/7/2010 -Has all the features requested by the replies to this posting
8/15/2010 -Dependency on cURL has been removed - uses drupal theme() function to build block

I have made a Shoutcast module that works with the current version 1.9.8

It's a quick build that will make a block containing statistics and other such data from the XML feed. Caching mechanism is half built so there are come things I need to do, completing this module and submiting it to the modules CSV

Attached is the goods, fairly easy to install and configure. Comments welcome and input to other features.

The attached file is a ZIP archive. simply disregard the .txt extension as I used it to get around the upload file type restrictions.

AttachmentSize
shoutcast_cURL-dependency.zip_.txt3.99 KB
shoutcast_current.zip_.txt3.33 KB

Comments

Looks good, server variable not used

thumb's picture

This would simplify what I'm working on a great deal, especially the caching interval. I loaded it up to test but it no go. Looks like you have a bunch of hard-coded localhost references in there instead of loading up the Shoutcast server set on the admin page.

I also wonder about using curl rather than something like fsockopen(). I suppose curl will be available with most installs, dunno...

Nothing should be hard

yohnson's picture

Nothing should be hard coded... it's all settings through Drupal

example.com/admin/settings/shoutcast

As for fscockopen, I did not want to make headers n' stuff for the login to acquire XML stats. I did try simple fopen although the Shoutcast server validates login much differently than the past. curl was the easiest method to implement with less coding.

Sorry, I see now that those

thumb's picture

Sorry, I see now that those localhost IPs are default values for the module. My problem was that I had added http:// with my url. You may want to note that for the field.

UPDATE: The module's enabled, settings set properly, and no errors in the watchdog. Looks like a timeout issue connecting to my shoutcast server, I'll need to check with my hosting provider to see if they're blocking referrers outside their network.

While I'm thinking about it, disregard my curl remark, I just realized that fsockopen() doesn't support authentication.

New module or fork?

drewish's picture

Is this a new module or did you hack on the existing shoutcast module? I think the fetching and parsing would be a great plugin for the type of module that thumb is talking about over on #47840.

Not a Branch - Brand new

yohnson's picture

Not a branch, I was going to add it to the Drupal modules CSV replacing the old Shoutcast module which is no longer maintained. In all honesty I wanted to make it as a sub-module to station just like station_playlist_extender (http://drupal.org/node/590244) The flexibility of a standalone module would be best for the entire Drupal community since Shoutcast streams much more than music, but then again..I'm torn

The base module used to develop this was Weather Underground module. Hehe,. I used its skeleton, simple XML parsing implementation that I plan to extend further (caching and full testing is next step) for new WUNH website http://beta.wunh.org/

I have to admit I didn't know how exactly how to hook it in to the station module or if it was even possible. I do belive in best practices this module and the recently announced "now playing module" should become as one Forming!!! Sub module to extend Station <-- Allowing users that have such configurations can easily extend Station.

Shoutcast and nowplaying thoughts

thumb's picture

Yes, the nowplaying module is being developed as a station sub-module. I think it makes sense to develop Shoutcast as a standalone module and the nowplaying module can be made to depend on it.

I'm not able to get the Shoutcast module to authenticate to my admin.cgi. I suggest adding error notification if the URL isn't accessible after initial module configuration. Perhaps a shorter curl timeout should be set, because pages with the Shoutcast block take quite awhile to load for me since my hosting provider seems to be blocking the attempts. Curl should bail on the attempt sooner and log the failed attempt.

I'm not sure I'll be able to get my host to change their access policies and wonder if you'd be willing to add a fallback method to retrieve song history from played.html? Most Shoutcast servers don't seem to require authentication to access played.html.

I will integrate watchdog

yohnson's picture

I will integrate watchdog logging & also more informative config option messages to the module as requested.
I will also include the timeout parameter as requested

Allow setting of different cURL user agent

thumb's picture

My Shoutcast provider is only allowing user agent strings that match known browsers. The string 'Mozilla/5.001 (drupal Shoutcast Stats Module)' isn't working but something like 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13' does.

Very Interesting, this wacky

yohnson's picture

Very Interesting, this wacky policy being known, I will also allow the user to change the user agent string. I'm just about done and have eror logging finalized. Just gotta make sure the cache is working correctly and I'll post a new ver- that also includes custom user-agent string.

Any updates?

thumb's picture

Hi yohnson. I'm just getting back to this and was wondering about the status of your Shoutcast module.

Edit: I should have searched first. I see you're working away http://drupal.org/project/shoutcast How's work coming on 6.x-1.x?

Stable D6 release has been

yohnson's picture

Stable D6 release has been tagged in CVS.

Updates to D6 Shoutcast

thumb's picture

For anyone interested. I've begun to update the SHOUTcast module for use with a station logging module I'll begin work on soon.

Post for yohnson over in the SHOUTcast issue queue: http://drupal.org/node/922308
Code: http://github.com/ckieffer/drupal-shoutcast

Radio

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: