-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic downloads object #44
Comments
You can use the download.update() We could think about doing this implicitly/automatically, but I'm not sure how. With a Time-To-Live cache? How long? 1 second? Less? It could lead to inconsistent data: accessing bytes complete uses cache, then accessing "is complete" refetches data, meanwhile download finished, so status says finished but bytes say otherwise (just an example). |
Potentially you could implement the @property
def is_complete(self):
"""Return True if download is complete."""
self.update()
return self.status == "complete" Really to avoid "inconsistency" you would want to apply this to all the properties, then the properties would reflect the real time (or real time minus whatever latency) values, which I think would be more desirable than having static properties? Of course this would lead to an inconsistency between say one I suppose it comes down to what you want the use case to be, I personally think I can see more value in a "realtime" API (and therefore acting more like a python interface for the RPC API), rather than something that periodically stores and refreshes the data cached from the RPC responses. Does that make sense? |
I agree with you, it totally makes sense 🙂 However I don't think it would help the performance to always update the download, especially in the TUI (it would generate tons of HTTP requests), so here is what I propose: we could add a convenience property on the download object, called for example What do you think? |
I think that your suggestion is a good compromise between the two problems. |
Just released v0.8.0 with this feature 🙂 I went with |
Would it be feasible to make the
aria2p.downloads.Download
class dynamic?I.e. being able to return the current status of it's properties, not just the status when the object was first instantiated?
Below is an example of what I mean.
Using
aria2p
as a module, you can begin a bittorrent download viaThe
download
object returned here refers to the initial metadata download.The
download
object returns 0% progress in perpetuity, even after the meta download has finished and the main download has begun.To get the current download status you can:
However this is obviously less clean than just having to call the original
download
object.The text was updated successfully, but these errors were encountered: