FileDownloader icon indicating copy to clipboard operation
FileDownloader copied to clipboard

Resume download from new URL

Open shinejosephDev opened this issue 9 years ago • 8 comments

Hi, Is there anyway to resume download from new urls if i paused the download. My download url is dynamically generated and each for one time use only, if I paused a download at a certain point and resumed then a new url is generated for the same file. Basically the file is same but want to use different urls if I paused one. Any help??

shinejosephDev avatar Dec 22 '16 05:12 shinejosephDev

FileDownloader didn't support your case yet because FileDownloader generates the task identify through the md5 from the path and the Url, Sorry about that.

But I will support that as soon as possible, you can follow this issue: #224

Jacksgong avatar Dec 22 '16 08:12 Jacksgong

Thanks for your replay. What if I removed url from the following function in the lib

   public static int generateId(final String url, final String path, final boolean pathAsDirectory) {
        if (pathAsDirectory) {
            return md5(formatString("%sp%s@dir", url, path)).hashCode();
        } else {
            return md5(formatString("%sp%s", url, path)).hashCode();
        }
    }

and replaced with filename or something. Will it work then??

shinejosephDev avatar Dec 22 '16 08:12 shinejosephDev

Yes, If you don't care about the compatible for some old data(what doesn't complete download yet(maybe status is paused)) have been stored in the database before the code has been deployed, this is the simplest way to match you want.

Jacksgong avatar Dec 22 '16 09:12 Jacksgong

Okay. I'll try it.

shinejosephDev avatar Dec 22 '16 09:12 shinejosephDev

ok

Jacksgong avatar Dec 22 '16 09:12 Jacksgong

There is another thing, I think you know, In this way, because of the URL no longer the mater. so whatever Url you used to download, once the path and pathAsDirectory you provided is the same, they will be treated as the same tasks.

Jacksgong avatar Dec 22 '16 09:12 Jacksgong

What if I put some unique ids there like filename or something.

shinejosephDev avatar Dec 22 '16 09:12 shinejosephDev

Yes, I think that would be better.

Jacksgong avatar Dec 22 '16 09:12 Jacksgong