With this componentn you can easily download files from anywhere, web or even local mashines.With come callbacks you can easily automate the process and build fully automatic update or download systems.
Use with parameters
To use this component with parameters, use the parameters in the Interact section fo the parameters. Put in the URL and the target folder (standart is download) and press the query download button. This will start the download. To add additional Downloads just change the target URL and the download will be added to the que.
API
The downloader offers a easy to use API to use in scripts. Just call the
op('fileDownloader').Query_Download( url, target_directory, filename = "name", meta = meta_data )
If you do not define filename, it will take the name of the file from the URL.
With the meta argument you can define custom data for later use in the callbacks. This does not influence the download at all. It can be anything from function, string or dictionaries and operators.
Callbacks
To define the callbacks press the "Create Callbacks" button in the Callbacks parameter page.
The Callbcaks are as follows
def OnDownloadStart(source, target, meta): #When you start a download. Source is the url, target is the target file thats going to be created. return def OnDownloadFinish(filepath, meta): #Called when a download completes. Gives you the meta data you passed and the path to the file. return def OnQueryFinish(): #Called when all files in the query are downloaded. return def OnFail(source_url, meta): #If an error occurs. For the moment this mainly happens when the download times out. return
The Downloader is part of the OLIB.