novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

Removal of downloads in v2 #438

Closed maboueita closed 6 years ago

maboueita commented 6 years ago

looking into v2's api I couldn't find a certain answer to this yet, is there a way to delete downloads using a different mechanism that's not using the batch id?

(Our use-case would include needing to delete files that were only a subset of a single batch, so we'd want to later delete the files using their unique identifiers and not the whole batch or other files in it).

zegnus commented 6 years ago

Hi @maboueita currently this is not supported by the library. Currently, the idea of a batch is a unit of files that only makes sense when all of them exists at the same time. For example a video + contract + trailer. If you delete the contract file then that batch should be invalid.

Maybe you are treating a batch as a bundle? You could create a batch per file for now. Would that solve your issue?

Also if you could provide a bit more context how you are using the library and what's the concept of a batch that you are using, and how you are using it, we'll be able to come up with some solutions.

Thank you and thanks for you feedback.

maboueita commented 6 years ago

Hi @zegnus, a batch per file might work, however, considering our use-case would be mainly downloading "a playlist" consisting of potentially 100s of songs, I was thinking:

a) would be there a footprint penalty if we create such a high number of batches almost simultaneously or within very little time difference?

b) we would want to visually treat the playlist as one element (i.e: show a single notification and track the progress based on which songs are at which state) - would this be feasible to achieve if we go for the batch per track approach?

Thanks very much for the prompt answer.

zegnus commented 6 years ago

hi @maboueita a) No problem with performance if you create those batches, you can do a test and get back to us if you find any performance issue b) Sure no problem with that, how you handle UI is not coupled with the info provided by the download manager. You just need to query all the download batches, or listen to it with a callback and then treat a batch as if it were a file and you're good to go. The batch will provide you bytes downloaded and status. You will only need to query the file inside when you actually want to play the asset; the rest can be handled at batch level

As a suggestion, make a demo app where you can spike what you want to achieve and assess its performance and how are you going to handle the UI. I think that you will be ok.

Give us some feedback, happy to help ;)

maboueita commented 6 years ago

Thanks @zegnus! Will proceed then with the batch per track approach and get back to you if I feel I have any feedback that might be useful.