HTTPGet 2 In A Row

Is there a way to get 2 SHOUTcast servers updated ? I ask because putting 2 (or more) in a row doesn’t seem to work - Only the first one is actually updated. I assume that the “process” is still busy whilst the script is calling the 2nd server, so is there a way around this ?

I’m doing this via a script because there are 3 timing checks before an update is sent - ie: if it’s under 90s, send “More music soon…”, if it’s over 6mins, it sends something else… etc.

[code]// If track is less than 90 seconds, do this:
// ie: Jingles/Adverts etc
if (Item.GetDuration < 900000000) then begin;

sl := TStringList.Create;
sl.Add(‘More music soon…’);
sl.SaveToFile(‘S:\nowplaying\nowplaying.php’);
sl.SaveToFile(‘S:\RDS RT.txt’);
sl.Free;

SystemLog(HTTPGet(‘http://server:8000/admin.cgi?pass=password&mode=updinfo&song=More music soon…’));
SystemLog(HTTPGet(‘http://server:8008/admin.cgi?pass=password&mode=updinfo&song=More music soon…’));

end;
begin

// If track is more than 6 minutes do this:
// ie: Pre Records etc
if (Item.GetDuration > 3600000000) then begin;

sl := TStringList.Create;
sl.Add(‘See our website for live now playing info…’);
sl.SaveToFile(‘S:\nowplaying\nowplaying.php’);
sl.SaveToFile(‘S:\RDS RT.txt’);
sl.Free;

SystemLog(HTTPGet(‘http://server:8000/admin.cgi?pass=password&mode=updinfo&song=See our website for live now playing info…’));
SystemLog(HTTPGet(‘http://server:8008/admin.cgi?pass=password&mode=updinfo&song=See our website for live now playing info…’));

end;
begin

// Finally, if the track is between 90s and 6mins, do this:
// ie: Songs
if (Item.GetDuration > 900000000) then begin;

sl := TStringList.Create;
sl.Add(Item.GetArtist + ’ - ’ + Item.GetTitle);
sl.SaveToFile(‘S:\nowplaying\nowplaying.php’);
sl.SaveToFile(‘S:\RDS RT.txt’);
sl.Free;

SystemLog(HTTPGet(‘http://server:8000/admin.cgi?pass=password&mode=updinfo&song=’ + Item.GetArtist + ’ - ’ + Item.GetTitle));
SystemLog(HTTPGet(‘http://server:8008/admin.cgi?pass=password&mode=updinfo&song=’ + Item.GetArtist + ’ - ’ + Item.GetTitle));[/code]

Thanks

Hm. The HTTPGet() function should be blocking and only return when the HTTP call is finished. I don’t see a reason why the second call should not work. Have you tried to change the order in oder to confirm this?

Yeah, I’ve tried putting all sorts in-between the 2 sever commands - Obviously the script runs faster than it takes to call (and “do”) the HTTPGet :frowning: There is nothing wrong with my settings as when I comment out the 1st server, the 2nd server gets updated ???

Charlie: can you take the HTTPGets out of their SystemLog() shells temporarily? Something like:

var HTTPresult: string; ... HTTPresult := HTTPGet( <bla> ); SystemLog(HTTPresult); HTTPresult := HTTPGet( <different bla> ); SystemLog(HTTPresult);

I totally understand why you have done it the way you have, but it might be that there is some subtle difference with HTTPGet when it’s ‘wrapped’ by a SystemLog.

Admittedly a hunch on my part ;), but worth a try IMHO.

BFN
CAD