Raduga (English)

User: Guest

Search

Please use the
Bug Report Form
if you think you found a software defect.

Use the Contact Form
to send a personal message to Wolfgang.

RSS Feed RSS Feed

Other boards:
Juke
QBrowser
Song Requester
SuperEdi

AddIns-FtpUpload

Posted on: Raduga (English)

From Message

John

2004-04-28 11:35:13

AddIns-FtpUpload

Hi wolfgang,

Is it possible to make the file FtpUpload.txt instead of FtpUpload.html?
Just like the CurrentSong.txt

Wolfgang Loch

2004-04-28 11:42:31

Re: AddIns-FtpUpload

You can change the format of the output file yourself by editing the add-in script FTPUpload.js. If you don't know how to do it, I could do it for you, but it will cost extra.

John

2004-04-28 11:55:25

Re: AddIns-FtpUpload

Strange i don't get the file in the directorie on the server. It goes to the server but not in dir=html.

You can make the FtpUpload the same as the CurrentSong.txt??
So a txt file goes to the server? And now, what will it coast?

Charlie Davy

2004-04-28 17:24:41

Re: AddIns-FtpUpload

Looking at the .js file itself, I think you just need to rename the local and remote filenames (right at the start of the file).

Also, you'll need to remove the HTML HEAD/BODY formatting, and just make it insert "currentsong" in the text file.

5mins studying the file, and a quick test proved it wasn't a major hurdle.

John

2004-04-28 18:10:54

Re: AddIns-FtpUpload

Thanks Charlie!
But how do i get it in a html directory?
I have try: var Directory = "html"
But it will not work i dont get it in a html directory.

Volker

2004-05-19 23:07:23

Re: AddIns-FtpUpload

var server = "ftp.myserver.net" // your FTP server name
var userName = "MyUserName@telefonica.net" // your FTP account
var password = "secret" // your FTP password

var localFile = "C:\\NowOnAir.txt" // a temporary local file name
var remoteFile = "html/NowOnAir.txt" // remote directory & file name on the web server
/*************************************************************************/


var ftp;
var currentSong = "";
var BLUE = 140*240*200;
var RED = 255;

// The Application::Startup event is fired on startup of Raduga
function Application::Startup()
{
Application.Console.Visible = true;
DebugOutput( "FtpUpload started" );
}

// The Application::Shutdown event is fired on shutdown of Raduga
function Application::Shutdown()
{
if( ftp != null )
ftp.Close();
}

// The Player::Start event is fired by Raduga whenever a new track starts
function Player::Start()
{
var playlist = Application.Playlist;
currentSong = playlist.DisplayNameOf( Player.FileName )

WriteFile();
UploadFile();
}

function WriteFile()
{
Application.Statusbar = "Writing file " + localFile;
DebugOutput( "Writing file " + localFile );

var ForWriting = 2;
var FormatAscii = 0;
var fso = new ActiveXObject( "Scripting.FileSystemObject" )
fso.CreateTextFile( localFile );
var file = fso.GetFile( localFile );
var ts = file.OpenAsTextStream( ForWriting, FormatAscii );

ts.WriteLine( currentSong );
ts.Close();

Application.Statusbar = "";
}

function UploadFile()
{
Application.Statusbar = "Uploading file " + localFile + " to " + remoteFile;

try
{
if( ftp == null )
{
ftp = new ActiveXObject( "Raduga.Ftp" );
ftp.Server = server;
ftp.UserName = userName;
ftp.Password = password;

DebugOutput( "Connecting to FTP server " + ftp.Server );
ftp.Open();
}

DebugOutput( "Uploading file " + localFile + " to " + remoteFile );
ftp.PutFile( localFile, remoteFile );
}
catch( error )
{
HandleError( error );
ftp = null;
}

Application.Statusbar = "";
}

function HandleError( error )
{
Application.StatusBar = "FtpUpload Error: " + error.description;
Application.Console.WriteLineColor( error.description, RED );
}

function DebugOutput( text )
{
Application.Console.WriteLineColor( text, BLUE );
}

Post a reply to this message: