Shoutcast Radio to Xml

title says it all

Postby Jay on Fri Nov 11, 2005 12:50 pm

I use the default skin supplied with the download.
I have not yet worked with categories. Another thing to learn :D
Thank you.
Jay
 
Posts: 950
Joined: Thu Oct 13, 2005 6:28 pm
Location: Kiawah Island, SC US

Re: Shoutcast Radio to Xml

Postby dalanik on Fri Dec 30, 2005 8:23 am

I modified your vbs a bit to allow display of category like genre->radio

http://www.pragueonline.cz/lanik/down/Shoutcast_to_Xml.vbs

D.
dalanik
 
Posts: 886
Joined: Mon Apr 19, 2004 12:35 pm
Location: Prague, Czech Republic

Postby dgemily on Fri Dec 30, 2005 9:42 am

Oh thanks, I was using a second database "genre" to filter the original one ;)
Member of XLobby FR Team
~~~~~~~~~~~~~~~~
Releases from the French team
dgemily
 
Posts: 795
Joined: Thu May 13, 2004 6:24 am
Location: Paris, France

Re: Shoutcast Radio to Xml

Postby Marbles_00 on Wed May 30, 2007 5:53 am

Dgemily,

I'm not sure that you are still using this .vbs to convert shoutcast .pls entries to an xlobby database, but since xshoutcast does not work anymore, I decided to play around with this .vbs again. Seems I'm geting an error on this line:

Code: Select all
   Tkn2 = Mid(Tkn,Pos_Left+1,Pos_Right-Pos_Left-2)


Most notebly the "Mid" call.

The specific error message is as follows:

Code: Select all
Windows Script Host
Script:  C:\shoutcast\Shoutcast_to_Xml.vbs
Line:  241
Char:  2
Error:  Invalid procedure call or argument: 'Mid'
Code:  800A0005
Source:  Microsoft VBScript runtime error


Any help at getting this working would be much appreciated.

Thanks in advance.


*EDIT 30/5/07*
Whoop....hold on! I just tried it on a different computer (running Win2k like the machine I was running at home) and the .vbs file worked. So it must be something to do with my setup and not the .vbs file itself. Sorry to have bothered you.
Image
Mayhem Creations
where my:
    -Music Distribution
    -HTPC
    -MediaPVR
    -UnRAID box
    -OTA
are all discussed.

Xlobby Free Zone
Marbles_00
 
Posts: 1882
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Shoutcast Radio to Xml

Postby dgemily on Wed May 30, 2007 5:50 pm

Marbles_00 wrote:

*EDIT 30/5/07*
Whoop....hold on! I just tried it on a different computer (running Win2k like the machine I was running at home) and the .vbs file worked. So it must be something to do with my setup and not the .vbs file itself. Sorry to have bothered you.


oh, I'm happy, one thing less on my "list to do"
Member of XLobby FR Team
~~~~~~~~~~~~~~~~
Releases from the French team
dgemily
 
Posts: 795
Joined: Thu May 13, 2004 6:24 am
Location: Paris, France

Re: Shoutcast Radio to Xml

Postby P3rv3rt B3ar on Wed May 30, 2007 5:54 pm

Marbles_00 wrote: but since xshoutcast does not work anymore


I want that plugin back... surely theres somebody with coding skills and shoutcast familiarity outthere... he/she could also include shoutcast telly :P
Image
P3rv3rt B3ar
 
Posts: 1367
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Re: Shoutcast Radio to Xml

Postby Marbles_00 on Wed May 30, 2007 7:36 pm

surely theres somebody with coding skills and shoutcast familiarity outthere... he/she could also include shoutcast telly


I don't know coding at all, but I just downloade this...Reflector, and loaded the XShoutcast.dll into it. I'm able to view the code, but, I don't know for the life of me, what would require changing...and then to recompile a big :?:

But for an actual coder, this may be a starting point...maybe :?:


*EDIT*
Using the Reflector program, I've been able to find the code to refresh the database. I can understand what is done to get to the different genre on the shoutcast website, but from there, I don't know what is done. Here is the snippit of code:
Code: Select all
public void RefreshDatabase()
{
    XmlTextReader reader = new XmlTextReader(this.myPath + @"\plugins\XShoutcast.xml");
    string[] textArray = new string[30];
    int index = 0;
    int num2 = 0;
    int num3 = 40;
    string filename = "";
    int num4 = 0;
    this.XProcessStatus = "Reading config...";
    int num5 = 0;
    while (reader.Read())
    {
        if (reader.NodeType == XmlNodeType.Element)
        {
            if (reader.Name == "Genre")
            {
                reader.Read();
                textArray[index] = reader.Value.ToString();
                index++;
            }
            if (reader.Name == "MinBitrate")
            {
                reader.Read();
                if (reader.Value == "all")
                {
                    num2 = 0;
                }
                else
                {
                    num2 = Convert.ToInt16(reader.Value);
                }
            }
            if (reader.Name == "MaxStationsPerGenre")
            {
                reader.Read();
                num3 = Convert.ToInt16(reader.Value);
            }
            if (reader.Name == "Database")
            {
                reader.Read();
                filename = reader.Value;
            }
            if (reader.Name == "DatabaseFormat")
            {
                reader.Read();
                if (reader.Value == "OneLevel")
                {
                    num4 = 0;
                }
                if (reader.Value == "TwoLevels")
                {
                    num4 = 1;
                }
            }
        }
    }
    reader.Close();
    try
    {
        int num6 = 0;
        string requestUriString = "";
        int num7 = 0;
        XmlDocument document = new XmlDocument();
        document.CreateNode(XmlNodeType.XmlDeclaration, "", "");
        XmlNode newChild = document.CreateNode(XmlNodeType.XmlDeclaration, "", "");
        document.AppendChild(newChild);
        XmlElement element = document.CreateElement("", "database", "");
        XmlElement element5 = document.CreateElement("", "sortorder", "");
        XmlText text3 = document.CreateTextNode("display");
        element5.AppendChild(text3);
        element.AppendChild(element5);
        for (num6 = 0; num6 < index; num6++)
        {
            this.XProcessStatus = "Processing Genre: " + textArray[num6] + " ...";
            XmlElement elementById = document.GetElementById("sortorder");
            XmlElement element4 = document.GetElementById("sortorder");
            num7 = 0;
            if (num4 == 1)
            {
                XmlElement element2 = document.CreateElement("", "display", "");
                text3 = document.CreateTextNode(textArray[num6]);
                element2.AppendChild(text3);
                elementById = document.CreateElement("", "item", "");
                elementById.AppendChild(element2);
                element4 = document.CreateElement("", "subitems", "");
            }
            for (int i = 0; i < (num3 / 20); i++)
            {
                if (i == 0)
                {
                    requestUriString = "http://www.shoutcast.com/directory/index.phtml?sgenre=" + textArray[num6];
                }
                else
                {
                    string text4 = Convert.ToString((int) (i * 20)) + "&sgenre=" + textArray[num6];
                    requestUriString = "http://www.shoutcast.com/directory/index.phtml?startat=" + text4;
                }
                HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUriString);
                request.Timeout = 0x1388;
                request.UserAgent = "Code Sample Web Client";
                HttpWebResponse response = (HttpWebResponse) request.GetResponse();
                Encoding encoding = Encoding.GetEncoding(0x4e4);
                StreamReader reader2 = new StreamReader(response.GetResponseStream(), encoding);
                int num9 = 0;
                int num10 = -500;
                int num11 = 7;
                int num12 = 0;
                string text = "";
                string text6 = "";
                string text7 = "";
                bool flag = false;
                while (!reader2.EndOfStream)
                {
                    num9++;
                    string text8 = reader2.ReadLine();
                    flag = false;
                    if (text8.LastIndexOf("file=filename") > 0)
                    {
                        string text9 = text8.Substring(text8.IndexOf("<a href=") + 9, (text8.IndexOf("filename.pls") - text8.IndexOf("<a href=")) + 3);
                        text = "http://www.shoutcast.com" + text9;
                        num10 = num9;
                    }
                    if (text8.LastIndexOf("_scurl") > 0)
                    {
                        text6 = text8.Substring(text8.IndexOf("[") + 1, (text8.IndexOf("]") - text8.IndexOf("[")) - 1);
                        string text10 = text8.Remove(text8.LastIndexOf("</a>"));
                        text7 = text10.Substring(text10.LastIndexOf(">") + 1);
                    }
                    if (num9 == (num10 + 3))
                    {
                        if (text8.LastIndexOf("Now Playing:") > 0)
                        {
                            num11 = 7;
                        }
                        else
                        {
                            num11 = 6;
                        }
                    }
                    if (num9 == (num10 + num11))
                    {
                        string text11 = text8.Remove(text8.LastIndexOf("</font>"));
                        num12 = Convert.ToInt16(text11.Substring(text11.LastIndexOf(">") + 1));
                        flag = true;
                        num10 = 0;
                    }
                    if (flag && (num12 >= num2))
                    {
                        XmlElement element6;
                        XmlElement element7;
                        XmlElement element8;
                        num7++;
                        num5++;
                        this.XProcessStatus = "Processing Genre: " + textArray[num6] + " (found:" + Convert.ToString(num7) + ")";
                        switch (num4)
                        {
                            case 0:
                                element6 = document.CreateElement("", "item", "");
                                element7 = document.CreateElement("", "parameter", "");
                                text3 = document.CreateTextNode(text);
                                element7.AppendChild(text3);
                                element6.AppendChild(element7);
                                element7 = document.CreateElement("", "display", "");
                                text3 = document.CreateTextNode(text7);
                                element7.AppendChild(text3);
                                element6.AppendChild(element7);
                                element7 = document.CreateElement("", "type", "");
                                text3 = document.CreateTextNode("track");
                                element7.AppendChild(text3);
                                element6.AppendChild(element7);
                                element7 = document.CreateElement("", "information", "");
                                element8 = document.CreateElement("", "trackgenre", "");
                                text3 = document.CreateTextNode(textArray[num6]);
                                element8.AppendChild(text3);
                                element7.AppendChild(element8);
                                element8 = document.CreateElement("", "trackbitrate", "");
                                text3 = document.CreateTextNode(Convert.ToString(num12));
                                element8.AppendChild(text3);
                                element7.AppendChild(element8);
                                element8 = document.CreateElement("", "trackname", "");
                                text3 = document.CreateTextNode(text6);
                                element8.AppendChild(text3);
                                element7.AppendChild(element8);
                                element8 = document.CreateElement("", "trackposition", "");
                                text3 = document.CreateTextNode(Convert.ToString(num7));
                                element8.AppendChild(text3);
                                element7.AppendChild(element8);
                                element6.AppendChild(element7);
                                element.AppendChild(element6);
                                break;

                            case 1:
                                element6 = document.CreateElement("", "item", "");
                                element7 = document.CreateElement("", "parameter", "");
                                text3 = document.CreateTextNode(text);
                                element7.AppendChild(text3);
                                element6.AppendChild(element7);
                                element7 = document.CreateElement("", "display", "");
                                text3 = document.CreateTextNode(text7);
                                element7.AppendChild(text3);
                                element6.AppendChild(element7);
                                element7 = document.CreateElement("", "type", "");
                                text3 = document.CreateTextNode("track");
                                element7.AppendChild(text3);
                                element6.AppendChild(element7);
                                element7 = document.CreateElement("", "information", "");
                                element8 = document.CreateElement("", "trackgenre", "");
                                text3 = document.CreateTextNode(textArray[num6]);
                                element8.AppendChild(text3);
                                element7.AppendChild(element8);
                                element8 = document.CreateElement("", "trackbitrate", "");
                                text3 = document.CreateTextNode(Convert.ToString(num12));
                                element8.AppendChild(text3);
                                element7.AppendChild(element8);
                                element8 = document.CreateElement("", "trackname", "");
                                text3 = document.CreateTextNode(text6);
                                element8.AppendChild(text3);
                                element7.AppendChild(element8);
                                element8 = document.CreateElement("", "trackposition", "");
                                text3 = document.CreateTextNode(Convert.ToString(num7));
                                element8.AppendChild(text3);
                                element7.AppendChild(element8);
                                element6.AppendChild(element7);
                                element4.AppendChild(element6);
                                break;
                        }
                    }
                }
                response.Close();
                reader2.Close();
            }
            if ((num4 == 1) && (num7 != 0))
            {
                elementById.AppendChild(element4);
                element.AppendChild(elementById);
            }
        }
        document.AppendChild(element);
        this.XProcessStatus = "Found " + Convert.ToString(num5) + " Stations !";
        document.Save(filename);
    }
    catch
    {
    }
}



Sorry for the long post.
Image
Mayhem Creations
where my:
    -Music Distribution
    -HTPC
    -MediaPVR
    -UnRAID box
    -OTA
are all discussed.

Xlobby Free Zone
Marbles_00
 
Posts: 1882
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Shoutcast Radio to Xml

Postby Marbles_00 on Thu May 31, 2007 2:31 pm

dgemily...or anyone that may know,

What additional software is required (if any) to properly run .vbs type files? The shoutcast_to_xml.vbs file works on one computer but not on another. They both are running Win2k. Working computer is Service Pak3, non working SP4.

Working computer also has installed MSXML 4.0 Parser and SDK, .NET 1.1 and .NET 2.0, Microsoft Visual C++ Redistributable (has other stuff, but those, I think, are ones that influence/workwith .vbs files)

Non-working machine (I think) only has .NET 1.1 and .NET 2.0.

My big question is if I need MSXML Parser on the non-working computer, or should I be looking at something else needed to be installed in order to run .vbs files...or am I just blowing smoke outta my ears? I think I have run other .vbs files on the "non-working" computer before, but I don't recall a problems like what I mention above with the shoutcast_to_xml.vbs.

*EDIT*
Well, I think I was blowing smoke somewhat. The working computer also has cscript.exe and wscript.exe, and are used to "open" a VBScript file (according to the .vbs file properties). I have to find out if I'm missing those on the non-working computer.
Image
Mayhem Creations
where my:
    -Music Distribution
    -HTPC
    -MediaPVR
    -UnRAID box
    -OTA
are all discussed.

Xlobby Free Zone
Marbles_00
 
Posts: 1882
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Shoutcast Radio to Xml

Postby dgemily on Fri Jun 01, 2007 6:25 pm

sorry, I have no idea. usually you don't have to install something to run a .vbs

later
Member of XLobby FR Team
~~~~~~~~~~~~~~~~
Releases from the French team
dgemily
 
Posts: 795
Joined: Thu May 13, 2004 6:24 am
Location: Paris, France

Previous

Return to Tips and Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

cron