Skip to content
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

Multiple fetch calls result in unnecessary downloads #5

Open
akshaybadola opened this issue Dec 16, 2020 · 0 comments
Open

Multiple fetch calls result in unnecessary downloads #5

akshaybadola opened this issue Dec 16, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@akshaybadola
Copy link
Owner

Sometimes a pdf file takes a long time to download and as a consequence a user can call it again. That results in redundancy as a PDF file is then downloaded again needlessly. There needs to be flag with a timeout which checks if the last call is finished and a way for the user to abort the download also.

  • We can do with a progress meter of download but I'm not sure if that's supported by url-retrieve.

  • So upon a quick search, there's a make-progress-reporter and progress-reporter update function which can be used

    (defun show-progress-demo ()
      (interactive)
      (let ((download-reporter
             (make-progress-reporter "Downloading python documentation..."
                                     0  100)))
        (url-retrieve "http://www.google.com"
                      (lambda (data bar)
                        ;; skip http header
                        (re-search-forward "\r?\n\r?\n")
                        (write-region (point) (point-max) "/tmp/google")
                        (progress-reporter-done bar))
                        `(,download-reporter))
        (dotimes (k 100)
          (sit-for 0.01)
          (progress-reporter-update download-reporter k))))
@akshaybadola akshaybadola added the bug Something isn't working label Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant