|
|
|
|
俵ÀÌ / 2001-06-29 / ¿ÀÈÄ 9:30:19 / 203.255.3.190
Á¶È¸¼ö : 145
|
[Áú¹®] 俵´Ô ÀÌ°Í ºÁÁÖ¼¼¿ä.. ¤Ð.¤Ðx); |
>
> XMLÀΰ¡ ¸Õ°¡¸¦ ÇØ¾ßµÇ´Â°Í °°Àºµð...
> ÄÄÆÛ³ÍÆ®µµ ¼³Ä¡ÇÏ°í(Á¤È®ÇÑÁö´Â ¸ð¸£°ÚÁö¸¸)...
> ´Ù Çغôµ𠽺Ʈ¸²ÀÌ Á×¾ú´Ù°í ³ª¿À³»¿ä ¤Ð.¤Ð
>
> ´ä Á» ÁÖ¼¼¿ä.. ¤Ñ¤Ñ;;;
> http://on-air.co.kr/shoutcast/
>
>
>
> <%@LANGUAGE=JavaScript%>
> <%
> //
> // This is a sample .ASP page written in Server Side JavaScript that will
> // allow you to retrieve XML stats from ShoutCast server and use them to
> // dynamically display song titles and song history. There is much more info in
> // ShoutCast XML than song titles and song history. If you figure out this script,
> // you'll be easily able to obtain any information ShoutCast provides.
> //
> // You can access ShoutCast XML stats by hitting this url with your browser:
> // http://my.server.ip:port/admin.cgi?pass=mypass&mode=viewxml
> //
> // Author: Janis Braslins [psi@bassdrive.com] [psilocybe on EFNet]
> // Date: 10/05/2000
> //
> // Revisions:
> //
> // 01/07/2001 -- Bug fixes for ShoutCast version 1.8.0
> // All modifications are marked in red.
> // You can still use modified version with previous
> // versions of ShoutCast.
> //
> // 03/18/2001 -- Replaced the VBScript URLDecode function with a
> // simple JavaScript function which uses
> // decodeURIComponent method.
> //
> // USE THIS SCRIPT ANY WAY YOU WANT IT! COPY IT, CLAIM YOU WROTE IT, DO WHATEVER
> // YOU PLEASE.
> //
>
>
> function URLDecode(psURL) {
> var sURL = new String(psURL);
> var sResult = "";
> try {
> sResult = decodeURIComponent(sURL);
> } catch (e) {
> sResult = ".....";
> }
> return sResult;
> }
>
>
> // Configure your stuff here (i.g. Server IP, Port, Password etc.)
>
> var sServer = "61.72.94.26";
> var sPort = "8000";
> var sPass = "changeme";
> var sBackURL = "/";
> var sPageTitle = "BassDrive - Track History";
>
> // This text will be displayed if for some reason we could not obtain information
> // form ShoutCast server.
>
> var sDownStream = "The stream is down ;(";
>
> // No configuration stuff beyond this point.
>
> var sTitle = "";
> Response.Expires = -1;
>
> var bContinue = true;
>
> // Ok, we are absorbing all exceptions here, you dont want your page to blow up
> // just because the ShoutCast server is down, or something screwed up somewhere
> // in the fabric of space.
>
> try {
>
> // We use Microsoft XML DOM to parse through stats XML ShoutCast server gives us.
>
> var oXML = Server.CreateObject("Msxml2.DomDocument");
> oXML.async = false;
>
> // We need this date in URL to avoid stupid caching issues Microsoft XMLHTTP has.
>
> var oDate = new Date();
> var sDate = Server.URLEncode(oDate.toUTCString());
> var sURL = "http://" + sServer + ":" + sPort + "/admin.cgi?pass=" +
> Server.URLEncode(sPass) +
> "&mode=viewxml&date=" + sDate;
>
> // We use Microsoft XMLHTTP to retreive the XML with stats from ShoutCast server.
>
> var oTrans = Server.CreateObject("Msxml2.ServerXMLHTTP");
> oTrans.open("GET", sURL, false);
> oTrans.send(oXML);
>
> // Now, for some reason DTD of shoutcast XML screws up the Microsoft XML parser.
> // To avoid this, we just gonna strip all this header crap and leave only the
> // juicy stuff.
>
> var sXML = new String(oTrans.responseText);
> sXML = sXML.substr(sXML.indexOf("<SHOUTCASTSERVER>"));
> oXML.loadXML(sXML);
> var oDoc = oXML.documentElement;
>
> // Obtaining the title of the currently playing song.
>
> var sTitle = new String(oDoc.selectSingleNode("//SONGTITLE").text);
> sTitle = URLDecode(sTitle);
>
> // Here we strip all the annoying track numbers in front of song titles.
> // i.e. "01 - Andy C - Titan" or "01. Andy C - Titan" etc will be transformed
> // into "Andy C - Titan"
>
> sTitle = sTitle.replace(/^[0-9]+[\.]+\s/i, "");
> sTitle = sTitle.replace(/^[0-9]+[\s-]+\s/i, "");
>
> // Encoding the song name, so weird characters dont break HTML.
>
> var sTitle = Server.HTMLEncode(sTitle);
>
> } catch (e) {
> sTitle = Server.HTMLEncode(sDownStream);
> bContinue = false;
> }
> %>
>
> <HTML>
> <HEAD>
> <TITLE><%=sPageTitle%></TITLE>
> </HEAD>
>
> <STYLE>
> .CBody {
> font-family: Arial;
> font-size: 12px;
> color: #CCCCCC;
> }
> .CPanel {
> background: black url(bgwoofer.jpg);
> background-repeat: no-repeat;
> background-position: center;
> font-family: Arial;
> font-size: 12px;
> color: #CCCCCC;
> }
> </STYLE>
>
> <BODY BGCOLOR=black TEXT=#CCCCCC LINK=white VLINK=white ALINK=white CLASS=CBody>
> <CENTER>
> <TABLE WIDTH=600 BORDER=0 CELLSPACING=0 CELLPADDING=5>
> <TR VALIGN=TOP ALIGN=CENTER>
> <TD><IMG BORDER=0 SRC="images/bassdrive.gif"></CENTER><BR> <BR>
> <TABLE WIDTH=100% HEIGHT=450 CELLSPACING=0 CELLPADDING=5 BORDER=0 CLASS=CPanel>
> <TR ALIGN=LEFT VALIGN=TOP HEIGHT=14>
> <TD COLSPAN=2 BGCOLOR="#CCCCCC"><FONT COLOR="black"><B>Currently Playing:</B>
> <%=sTitle%> </FONT></TD>
> </TR>
> <TR HEIGHT=14>
> <TD> </TD>
> </TR>
> <TR ALIGN=LEFT VALIGN=TOP HEIGHT=14>
> <TD COLSPAN=2 BGCOLOR="#CCCCCC"><FONT COLOR="black"><B>History:</B></FONT></TD>
> </TR>
> <TR ALIGN=LEFT VALIGN=TOP>
> <TD><TABLE CELLPADDING=3 CELLSPACING=0 BORDER=0 WIDTH=100% CLASS=CBody>
> <%
>
> // Ok, lets check if we gont the info we needed from the ShoutCast server
>
> if (bContinue) {
>
> // We have the stuff, lets build the history ...
>
> try {
>
> // Getting the number of songs in History.
> // First song is the currently playing song, so we gonna start our
> // loop from the second song (index of 1)
>
> var oSongs = oDoc.selectNodes("//SONG");
> i = oSongs.length;
> if (i > 1) {
> for (n=1; n < oSongs.length; n++) {
> var oSong = oSongs.item(n);
> // Ok, lets get the song title ...
> var sTitle = new String(oSong.selectSingleNode("TITLE").text);
> sTitle = URLDecode(sTitle);
> // Lets clean up the title, as we do above.
> sTitle = sTitle.replace(/^[0-9]+[\.]+\s/i, "");
> sTitle = sTitle.replace(/^[0-9]+[\s-]+\s/i, "");
> // Encode it ...
> var sTitle = Server.HTMLEncode(sTitle);
> %> <TR>
> <TD><%=sTitle%> </TD>
> </TR>
> <%
> }
> }
> } catch (e) {
> // Do Nothing
> }
> }
> %> <TR>
> <TD> </TD>
> </TR>
> <TR>
> <TD><A HREF="<%=sBackURL%>" STYLE="text-decoration: none;">[ Back ]</TD>
> </TR>
> </TABLE></TD>
> </TR>
> </TABLE></TD>
> </TR>
> </TABLE>
> </CENTER>
> </BODY>
>
> </HTML>
>
-----------------------------------------------------------
¼Ò½ºÀÇ ³»¿ëÀ¸·Î º¼¶§ ¿ø¿¥ÇÁ¿¡¼ ¹æ¼ÛÇÒ¶§
ÇöÀç ¹æ¼ÛÁßÀÎ Á¦¸ñÀ» Ãâ·ÂÇÏ°íÀÚ ÇÏ´Â °Í °°³×¿ä....
¿ø¿¥ÇÁ¹æ¼ÛÇϽǶ§ º¸½Ã¸é adminÀ¸·Î ·Î±×ÀÎÇØ º¸¸é
¾Æ·¡ º¸½Ã¸é Get XML Stats¿¡ Yes¿¡ ¸µÅ©°¡ °É·Á Àִµ¥...
±×±æ ´·¯º¸¸é ¿©·¯ Á¤º¸°¡ ³ª¿À´Âµ¥...
±× ¹®¼°¡ XML ÇüÅ°Ŵø¿ä...(¾Æ½ÃÁÒ? ^^)
±×±â¼ SONGTITLE¶ó´Â ºÎºÐ¿¡ ÇöÀç ¹æ¼ÛÁßÀÎ ³ë·¡ Á¦¸ñÀÌ Àִµ¥...
±×°É °¡Á®¿Í¼ »Ñ·ÁÁÖ°í ½ÍÀº°Å°ÚÁÒ...(ÀÌ°Ç ´Ù ¾Æ½Ã´Â°Ç°¡?)
±Ùµ¥ ¾È µÈ´Ù¸é... Áö±Ý ¾È µÇ´Â ÀÌÀ¯(Áö±Ý ÇöÀç)´Â ¿ø¿¥ÇÁ ¹æ¼Û ¼¹ö°¡
µ¿ÀÛÇÏÁö ¾Ê´Â´Ù´Â°Ô ¹®Á¦±¸¿ä....
¹æ¼Û ¼¹ö°¡ µ¿ÀÛÇϴµ¥µµ ¾È µÈ´Ù¸é.... ÀÌ xml ¹®¼¸¦ ºÐ¼®ÇØÁÖ´Â
ÄÄÆ÷³ÍÆ®µéÀÌ ¹®Á¦ÀΰɷΠº¸¿©Áö´Âµ¥....
±×°Ç Á¦°¡ ±× ÄÄÆ÷³ÍÆ®µéÀ» ¾î¶»°Ô »ç¿ëÇÏ´ÂÁö Àß ¸ô¶ó¼... ^^;;;
¼Ò½º»ó¿¡´Â ¹®Á¦°¡ ¾ø´Â°Í °°±¸¿ä...
¹æ¼Û ¼¹ö¿Í ¼³Á¤... ±×¸®°í ÄÄÆ÷³ÍÆ®ÀÇ ¼³Á¤À» ´Ù½Ã ÇØ º¸½Ã±æ...
|
|
|
|