a blocking download
josh at dvcreators.net
Tue Jun 15 13:14:40 EDT 2010
What you need to do, if I understand correctly, instead of a repeat loop, is start one file downloading with a message sent once the file is complete, then the program stops execution.
Once the file is downloaded, the message is sent, triggering the handler that finds the next file to be downloaded, and so on.
For example, from your code, call "getNextFileDownloading" to get the first file downloading, then:
# get next remote and local paths and files to download
downloadNextFile pRemotefile, pLocalFile
on downloadNextFile pRemotefile, pLocalFile
libURLDownloadToFile pRemotefile, pLocalFile, "getNextFileDownloading"
On Jun 14, 2010, at 12:47 PM, Andrew Kluthe wrote:
> I made myself an update stack that checks a local text file with version
> information for my program components and compares it to the text file
> pulled from my update server. The entries that don't match get downloaded
> with libURLDownloadToFile.
> I have am trying to have it go through one at a time and report on the
> download status of each compnent with one progress bar and a long window.
> The problem I have is that when it loops through the list of files to
> download, it triggers all the download handlers at once. So even if it
> doesn't download all the files in sequence, the log reports that all the
> downloads start before the first one finishes.
> Is there a way to make my loop wait till the current component download
> handler is totally done? Is this where I need to use a "blocking" version
> of a download file? Below is a mix of revlike psuedocode for clarity's sake.
> on goList
> get localList
> get webList
> put getDifferences(weblist, locallist) into downloadList
> repeat for each line i in downloadList
> downloadComponent( line i)
> end repeat
> end goList
> on downloadComponent pStackName
> put "Downloading " & pStackName after fld "log"
> put empty into gDownloadedFile
> put pStackName into gDownloadedFile
> put "C:/FarmOffice/LeaseManager/" into sBasePath
> put "http://somethingHere.com/Update" into sWebPath
> libURLSetStatusCallback "showProgress", the long name of me
> hide scrollbar "download"
> libURLDownloadToFile sWebPath & pStackName, sBasePath &
> end downloadComponent
> Basically, I don't want the next downloadComponent hanlder to go until the
> previous one has finished.
> note: the callback handlers and the handler for the progress bar are
> intentionally left out as they would function just fine if I could make the
> loop wait on downloadComponent.
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/a-blocking-download-tp2254935p2254935.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode