Airtime vs Icecast vs now playing
I been try to get out ”now play” from both Airtime and Icecast, but im totaly lost in the jungle
So i made a little hack with RegEx and it look like its work really nice.
Please comment if you have some good things to ”add on” ( I will make a PHP version as well soon, please come back for that)
<%
// I made a little RegEx hack on a Icecast server ver. 2.3.3
// im not sure if its working on other but it should be easy to rewrite to your type
// This is for a IIS server but it would not be a problem to make same against a Apache (PHP)
// Tyrone Fröberg - tyrfro@gmail.com
Function GetText(URI)
Dim Request
Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")
Request.Open "GET", URI, False
Request.Send
GetText = Request.ResponseText
End Function
// REPLACE on found stuff
Function SONGNAME(s)
s = Replace(s,"Current Song:","") // replace from string
s = Replace(s,"</td>","") // replace from string
s = Replace(s,"<td>","") // replace from string
s = Replace(s,"\n","") // replace from string
s = Replace(s,"\r","") // replace from string
s = Replace(s," "," ") //if there is a misstake in rename file we clean it up a bit //
s = Replace(s, vbCrLf, "" ) // replace from string (just in case)
s = Replace(s,"<td class=""streamdata"">"," ") // replace from string
s = Replace(s, Chr(13), " ") // replace from string (just in case)
SONGNAME = s
End Function
targetString = GetText("http://myipnumber:8000/")
Dim re, targetString, colMatch, objMatch
Set re = New RegExp
With re
.Pattern = "<td>Current Song:</td>\n<td class=""streamdata"">.*</td>"
.Global = False
.IgnoreCase = True
End With
Set colMatch = re.Execute(targetString)
For each objMatch in colMatch
SongArtist = SONGNAME(objMatch.Value)
Next
%>
<!-- Now we can start to do the graphic stuff -->
<%=Trim(SongArtist)%>
Works fine with
Airtime + Icecast 2.3.3[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]ToDO:
PHP
<?php $content = file_get_contents('http://sverigesradio.se/sida/latlista.aspx?programid=164&date=2015-12-10'); if (preg_match("/track-title\">(.*)\<\/span>/", $content, $matches1)) { echo $matches1[1]."<br />"; } ?>
graphic design
WordPress Plugin
Look at ver. for icecast (same output?)
Around Iframe
Since html5 you have no border, so i came around it with:
<!--[if IE]>
<iframe src="source" frameborder="0">?</iframe>
<![endif]-->
<!--[if !IE]>-->
<iframe src="source" style="border:none">?</iframe>
<!-- <![endif]-->
(Thanks to Mr Lister:
http://stackoverflow.com/questions/3601273/html5-and-frameborder )