Hey,
Dan42 wrote:Download completion should be easy to detect; you should only raise the "complete" flag after the whole file has been sent (after the fread loop or the readfile).
This exactly how the system works. A flag is set at the end of the script saying that the download is completed. This flag should only be set if the script has handed out the entire file.
I did test the script by downloading a vid the normal way and then downloading another using the Mozilla download manager, pausing the download for 30 mins, and then resuming. Both downloads were successful.
The issue you have encountered must be something specific to DAP or something that Mozilla manager corrects for. Does DAP have a FAQ for setting up a server script to work with DAP?
Having the restart happen immediatly after a cancel is exactly the thing I am trying to avoid. register_shutdown_function will run every time the script ends and thus will only run on completion, which does not help solve the problem. The problem is detecting the time between the last attempted download and the current one.
Dan42 wrote:Since I want to use DAP, I hit cancel and I drag the link into the DAP window.
Did you drag the link to the page that you are viewing that starts the download or the link to the video itself? The message "You have already downloaded this video" appears in the page script but not in the script for the video download itself. (my guess is that you tried it on the wrong link)
The only possible printed errors for the file download script are:
* ERROR: File does not exist.
* ERROR: Video is not available for download.
* ERROR: You are attempting to download this video too soon after your last download attempt.
* ERROR: Link information currupted.
* ERROR: You do not have permissions to download local videos.
Phade.