Click here to Skip to main content
15,908,015 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to write a CSV file in VB 6.0? Pin
virendra_00727-May-07 19:39
virendra_00727-May-07 19:39 
QuestionCrystal Report Pin
klaydze27-May-07 18:28
klaydze27-May-07 18:28 
AnswerRe: Crystal Report Pin
NDD5727-May-07 22:40
NDD5727-May-07 22:40 
GeneralRe: Crystal Report Pin
klaydze27-May-07 23:05
klaydze27-May-07 23:05 
QuestionMerge Cell Pin
aphei27-May-07 17:31
aphei27-May-07 17:31 
QuestionThreading for image processing Pin
NGENEAR1127-May-07 17:03
NGENEAR1127-May-07 17:03 
AnswerRe: Threading for image processing Pin
Christian Graus27-May-07 17:32
protectorChristian Graus27-May-07 17:32 
QuestionReading (headerfiles?) from a websites within VB.NET Pin
Schadenfroh27-May-07 13:48
Schadenfroh27-May-07 13:48 
Greetings,

I have been working on this problem for about a day now and it is driving me mad (I hope that what I am typing will make sense, as I have not slept much in the last few days). Basically I am creating a graphical bolt on application for a console application written in the old C. Its purpose will be to start / stop / monitor about 20 hidden console windows from a clean GUI (the console application being StreamRipper from sourceforge).

The problem is that I cannot monitor the applications running for the output refreshes itself in a single line continuously due to a kb download counter updating itself, so anytime I try to redirect console output, I lock up (or infinite loop rather) for these programs do not stop until terminated by the user. I am not going to input anything to these console, once I start them with certain arguments, they run until I use their process object to .kill() them.

The "single line refresh problem" I believe to be this line of code in streamripper.c
<br />
case RM_STATUS_RIPPING:<br />
        if (m_curinfo.track_count < m_opt.dropcount) {<br />
        strcpy(status_str, "skipping...   ");<br />
        } else {<br />
        strcpy(status_str, "ripping...    ");<br />
        }<br />
        format_byte_size(filesize_str, m_curinfo.filesize);<br />
        fprintf(stderr, "[%14s] %.50s [%7s]\r",<br />
            status_str,<br />
            m_curinfo.filename,<br />
            filesize_str);<br />
        break;


Bah, why could he not just use /n instead of \r, anyways, recompiling this is out of the question, for I need it as a pure bolt on without modifying streamripper.


I then tried to monitor the folders being created by streamripper, which worked, but I also play to have a changing layout for the directories (IE station name may not always be in the root), so this approach (while it worked great under certain conditions), proved to be futile when putting together the longterm goal.

Anyways, my next course of action seeing how redirecting the console output of this application is impossible would be to get the information I need directly from the server that I am streaming from (this is a streamripper bolt on I am writing, btw).

Example would be http://64.62.194.11:8095/

What I need to do
I would like to grab only the Stream Title from that page, I tried to use curl for this, but curl tries to grab the streaming .mp3 as well (and its self timeout can only be set to 1 second (integer), so the textfile that would normally be created by grabbing the headers is now full of random garbage).

So what I am thinking is:
1. VB.NET gets the header files and I pull in the station name
2. process object gets assigned a name that I pulled from the header file in a listbox
3. Process starts and is controlled in various ways from the listbox

Now another trick would be getting the song that is currently ripping, but I will save that turmoil until after I figure this out.

I then tried this:
http://msdn2.microsoft.com/en-us/library/system.net.webheadercollection.add(VS.71).aspx

but, I cannot seem to get it to work either (something that has to do with printHeaders, but I maybe missing a library for that (like having to put system.net.* on several of those other statements).

I also tried this (but these methods do not seem to want to work right with the shoutcast server no matter what I try):
http://developer.yahoo.com/dotnet/howto-rest_vb.html

Anyways, I am all out of ideas, I have probably worked on this for about 10 hours over the past day (I get obsessed with problems I cannot solve).

As part of my desperation, I started to translate the code here into VB in order to get the station information:
http://www.codeproject.com/cs/media/SHOUTcastRipper.asp
Module Module1<br />
<br />
    Sub Main()<br />
        Dim server As String = "http://64.62.194.11:8095"<br />
        Dim serverPath As String = "/"<br />
<br />
        Dim destPath As String = "C:\\" ' destination path for saved songs<br />
<br />
        Dim request As Net.HttpWebRequest = Nothing ' web request<br />
        Dim response As Net.HttpWebResponse = Nothing ' web response<br />
<br />
        Dim metaInt As Integer = 0 ' blocksize of mp3 data<br />
        Dim count As Integer = 0 'byte counter<br />
        Dim metadataLength As Integer = 0 ' length of metadata header<br />
<br />
        'metadata header that contains the actual songtitle<br />
        Dim metadataHeader As String = ""<br />
        'last metadata header, to compare with <br />
        'new header and find next song<br />
        Dim oldMetadataHeader As String = Nothing<br />
<br />
        ' receive buffer<br />
        Dim buffer(512) As Byte<br />
        For counter As Integer = 0 To 512<br />
            buffer(counter) = New Byte<br />
        Next<br />
<br />
        'input stream on the webrequest<br />
        Dim socketStream As System.IO.Stream = Nothing<br />
<br />
        'output stream on the destination file<br />
        Dim byteOut As System.IO.Stream = Nothing<br />
<br />
<br />
        ' create request<br />
        request = System.Net.HttpWebRequest.Create(server)<br />
<br />
        'clear old request header and build <br />
        'own header to activate Icy-metadata<br />
        request.Headers.Clear()<br />
        request.Headers.Add("GET", serverPath + " HTTP/1.0")<br />
        'needed to receive metadata informations<br />
        request.Headers.Add("Icy-MetaData", "1")<br />
        request.UserAgent = "WinampMPEG/5.09"<br />
<br />
        'execute request<br />
        Try<br />
            response = request.GetResponse()<br />
<br />
        Catch ex As Exception<br />
            Console.WriteLine(ex.Message)<br />
            Console.ReadLine()<br />
            Return<br />
        End Try<br />
<br />
<br />
        metaInt = Convert.ToInt32(response.GetResponseHeader("icy-metaint"))<br />
<br />
       <br />
    End Sub<br />
<br />
End Module


But, I believe this to be a dead end (so I have not translated the next section as the server returns an invalid protocol error), I also do not know C#, so this translation was all guess work from my knowledge of C++ and VB (which most of my VB knowledge comes from VB6)

Any help would be appreciated, I am using VB.NET 2005
QuestionDetecting changes in other application window Pin
mcfonseca27-May-07 5:22
mcfonseca27-May-07 5:22 
AnswerRe: Detecting changes in other application window Pin
Dave Herren27-May-07 5:45
Dave Herren27-May-07 5:45 
QuestionRAR it ? Pin
Navneet Hegde27-May-07 0:51
Navneet Hegde27-May-07 0:51 
AnswerRe: RAR it ? Pin
Christian Graus27-May-07 0:57
protectorChristian Graus27-May-07 0:57 
QuestionHelp with Design of VB app Pin
matt_hirst27-May-07 0:09
matt_hirst27-May-07 0:09 
AnswerRe: Help with Design of VB app Pin
Christian Graus27-May-07 0:12
protectorChristian Graus27-May-07 0:12 
GeneralRe: Help with Design of VB app Pin
matt_hirst27-May-07 0:17
matt_hirst27-May-07 0:17 
GeneralRe: Help with Design of VB app Pin
Christian Graus27-May-07 0:23
protectorChristian Graus27-May-07 0:23 
GeneralRe: Help with Design of VB app Pin
matt_hirst27-May-07 0:31
matt_hirst27-May-07 0:31 
GeneralRe: Help with Design of VB app Pin
Christian Graus27-May-07 1:01
protectorChristian Graus27-May-07 1:01 
Questionsome one help me to delete temporary internet files Pin
Prince Tanveer Farman27-May-07 0:01
Prince Tanveer Farman27-May-07 0:01 
AnswerRe: some one help me to delete temporary internet files Pin
Garth J Lancaster27-May-07 0:09
professionalGarth J Lancaster27-May-07 0:09 
AnswerRe: some one help me to delete temporary internet files Pin
Christian Graus27-May-07 0:10
protectorChristian Graus27-May-07 0:10 
AnswerRe: some one help me to delete temporary internet files Pin
Dave Kreskowiak27-May-07 7:24
mveDave Kreskowiak27-May-07 7:24 
Questiondelete group of files from my computer programatically with vb.net Pin
Prince Tanveer Farman26-May-07 21:56
Prince Tanveer Farman26-May-07 21:56 
Answerplease help me to do this Pin
Prince Tanveer Farman26-May-07 22:04
Prince Tanveer Farman26-May-07 22:04 
GeneralRe: please help me to do this Pin
Garth J Lancaster26-May-07 22:29
professionalGarth J Lancaster26-May-07 22:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.