Hi All,
As part of a project related to our town webcams - RamseyCam - Webcam views of Ramsey, i have written a short routine to capture the images generated by the camera. The idea is to make some timelapse movies of the still images.
I have a very simple program that uses the FTP library to get an image and save it with an incremental filename, every 15 seconds. For the most part, this seems to work very well, but if the camera upload and my attempted downloads occur at the same time, the FTP Library pops up a dialog to tell me there was an error in the download. I don't seem to be able to trap this in any way. I would like to be able to leave the program unattended for anything up to 24 hours, but this is impossible as it stands, as it will just sit there and wait for a keypress.
There is just a timer, textbox and start and stop buttons on the form and an FTP object to do the work.
So, the question is, can I trap the error from the FTP Library and tell it to ignore it and retry. The file is only unavailable for a second or so, so a simple retry is normally sufficient.
Any help appreciated.
David
UPDATE:
The program has been running all day in the IDE. It has done more than 3200 downloads from each camera without the error. I guess the problem is only appearing when run compiled. Not a problem if that's the case, I will just always run from the IDE.
David
As part of a project related to our town webcams - RamseyCam - Webcam views of Ramsey, i have written a short routine to capture the images generated by the camera. The idea is to make some timelapse movies of the still images.
I have a very simple program that uses the FTP library to get an image and save it with an incremental filename, every 15 seconds. For the most part, this seems to work very well, but if the camera upload and my attempted downloads occur at the same time, the FTP Library pops up a dialog to tell me there was an error in the download. I don't seem to be able to trap this in any way. I would like to be able to leave the program unattended for anything up to 24 hours, but this is impossible as it stands, as it will just sit there and wait for a keypress.
B4X:
Sub Globals
'Declare the global variables here.
Dim locate As String
Dim counter As Number
End Sub
Sub App_Start
FtpMain.New1
locate=AppPath & "\captures\cam "
counter=0
Timer15.Enabled=False
FrmMain.Show
End Sub
Sub ButStart_Click
FtpMain.Open("vip11.freeola.net","***","***")
FtpMain.SetCurrentDirectory("htdocs")
FtpMain.SetCurrentDirectory("cameras")
Timer15.Enabled=True
End Sub
Sub Timer15_Tick
ErrorLabel(errHandler)
counter = counter + 1
retry:
FtpMain.GetFile("camera_05.jpg",locate & "one\cam_01_" & Format(counter,"D6") & ".jpg")
FtpMain.GetFile("camera_06.jpg",locate & "two\cam_02_" & Format(counter,"D6") & ".jpg")
TxtCounter.Text=Format(counter,"D6")
Return
errHandler:
Goto retry
End Sub
Sub ButStop_Click
Timer15.Enabled=False
FtpMain.Close
End Sub
There is just a timer, textbox and start and stop buttons on the form and an FTP object to do the work.
So, the question is, can I trap the error from the FTP Library and tell it to ignore it and retry. The file is only unavailable for a second or so, so a simple retry is normally sufficient.
Any help appreciated.
David
UPDATE:
The program has been running all day in the IDE. It has done more than 3200 downloads from each camera without the error. I guess the problem is only appearing when run compiled. Not a problem if that's the case, I will just always run from the IDE.
David
Last edited: