!function(t){"use strict";function s(t){this._attr={},this.playedInterval=t.playedInterval||t.interval||3e4,this.statsInterval=t.statsInterval||t.interval||5e3,this.host=t.host,this.port=parseInt(t.port,10)||8e3,this.stream=parseInt(t.stream,10)||1,this.stats_path=t.stats_path||"stats",this.played_path=t.played_path||"played",this._statsinterval=null,this._playedinterval=null,this._stats=t.stats||function(){},this._played=t.played||function(){}}s.prototype.get=function(t,s){return t?"undefined"!=typeof this._attr[t.toLowerCase()]?this._attr[t.toLowerCase()]:s:this._attr},s.prototype.stats=function(s){var a,e=this,r="http://"+this.host+":"+this.port+"/"+this.stats_path+"?sid="+this.stream+"&json=1";return s=s||function(){},a=t.ajax({url:r,dataType:"jsonp",timeout:"2000"}),a.success(function(t){return"object"!=typeof t||"undefined"==typeof t.streamstatus?void(e._status=0):(e._status=1===t.streamstatus?2:1,e._attr=t,e._attr.status=e.getStatusAsText(),s.call(e,e._attr),void e._stats(e._attr))}),a.error(function(){e._status=0,e._attr.status=e.getStatusAsText(),s.call(e,e._attr),e._stats(e._attr)}),this},s.prototype.played=function(s){var a=this,e="http://"+this.host+":"+this.port+"/"+this.played_path+"?sid="+this.stream+"&type=json";return t.ajax({url:e,dataType:"jsonp",timeout:2e3,success:function(t){!t instanceof Array||(s&&s.call(a,t),a._played(t))}}),this},s.prototype.startStats=function(){return this.stopStats(),this.stats(),this._statsinterval=setInterval(t.proxy(this.stats,this),this.statsInterval),this},s.prototype.stopStats=function(){return this._statsinterval&&clearInterval(this._statsinterval),this},s.prototype.startPlayed=function(){return this.stopPlayed(),this.played(),this._playedinterval=setInterval(t.proxy(this.played,this),this.playedInterval),this},s.prototype.stopPlayed=function(){return this._playedinterval&&clearInterval(this._playedinterval),this},s.prototype.getStatus=function(){return this._status},s.prototype.getStatusAsText=function(){return["Offline","Awaiting Connection","On Air"][this._status]},s.prototype.onAir=function(){return 2===this._status},t.SHOUTcast=function(t){return new s(t)}}(window.jQuery);