I am writing a UPNP-Controller.
To supply the Artist and Title, it's necessary that I can get the metadata, probably supplied as XML somewhere in the Stream.
For that, I want to read the (endless) stream from InternetRadio and detect the XML. I am not sure what it contains exactly, but I struggle with receiving the Stream as TMemoryStream. The program gets stuck after the Get command.
procedure TformMain.GetUrlStream(url: string; var m: Tmemorystream);
var
IdHTTP1: TIdHTTP;
XMLStr: string;
IO : TIdSSLIOHandlerSocketOpenSSL;
begin
IdHTTP1 := TIdHTTP.Create;
try
IO := TIdSSLIOHandlerSocketOpenSSL.Create(IdHTTP1);
IO.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
IdHttp1.IOHandler := IO;
IdHttp1.ConnectTimeout := 5000;
IdHttp1.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36';
IdHttp1.Request.Connection := 'close'; // Close connection after each request
IdHTTP1.Get(url,m); // --> here the program stops
finally
IdHTTP1.Free;
end;
end;
I found a completly different way to get hold on the
Metadataof the radiostream with the help ofwget.exe. Here an exerpt of the code:The part of
Locate begin of titlecould even be skipped and the outputfile (reply.txt) directly searched forStreamTitle=. So no output of the Dos-Window (here Memodummy) has to be analyzed. But so the structure is more clear I think.So the short version would be: (untested)