Logging a text file to an FTP server

I want to upload a .txt file with the Artist and Title of the song playing each time a new song is started to an FTP server. How can that be done?

Thanks

Mount the connection as a permanent drive in Explorer and log to it using the standard procedures.

Thanks Tondose,

I have already done that, but I wanted to know how this could be done from within the logging possibilities of mAirList.

HTTP Post?

Generally, I would avoid FTP whenever possible and rather use HTTP calls, if the destination supports it. For example, if it’s your own website and your own scripts on the receiving side.

If you are really limited to FTP, it will probably only be possible with a script that writes the text file and then calls a batch file which handles the upload.

// Called when on-air playback of an item (in any player) begins
procedure OnItemStart(Item: IPlaylistItem; Region: byte; OnAir: boolean; UniqueID: string);
var 
  sl: IStrings;
begin
  // We only report Music items
  if Item.GetItemType <> pitMusic then exit;

  // Write text file
  sl := Factory.CreateStrings;
  sl.Add(Item.GetArtist + ' - ' + Item.GetTitle);
  sl.SaveToFile('C:\nowplaying.txt');

  // Call upload batch file in a hidden console window
  ShellExecuteHidden('C:\upload.cmd', '');
end;

For the batch file, I have actually never done it in Windows, but it seems to be very easy. Found this here on Google:

Thank you very much, Torben.

Unfortunately, we are limited to FTP only for the DAB+ part. I will give it a try tomorrow and let you know how it works.

Have a nice day.

Frank

Your script for writing the Title and Artist to a .txt file works like a charm, Torben. Thank you.

We still have to find out how to get it to the destination FTP server. In this case, the file has to go through 2 firewalls over a VPN, so that’s not so easy to do. But we will find a way for sure.

Thanks again.