diff options
author | ryuslash | 2010-02-12 00:04:34 +0100 |
---|---|---|
committer | ryuslash | 2010-02-12 00:04:34 +0100 |
commit | 5516dbbcae07b9623565c9dc8f06267b3357366e (patch) | |
tree | 199d2f5721c90ae9fc11cb6d9696440cc91e3ccd /download.py | |
parent | c85a69a893f554f5ab9ffb348e05d9e966d44db9 (diff) | |
download | 4grab-5516dbbcae07b9623565c9dc8f06267b3357366e.tar.gz 4grab-5516dbbcae07b9623565c9dc8f06267b3357366e.zip |
Stopped saying Failed and Skipped things
Now it summarizes at the end
Diffstat (limited to 'download.py')
-rw-r--r-- | download.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/download.py b/download.py index 63040c9..b9f9f72 100644 --- a/download.py +++ b/download.py @@ -93,6 +93,9 @@ def get_image_links(baseurl, t = []): return mysubparser.get_hyperlinks() def get_images(t = []): + skipped = 0 + failed = 0 + downloaded = 0 total = len(t) progress = progressbar.Progress(total) i = 1 @@ -107,12 +110,16 @@ def get_images(t = []): break except IOError: tries -= 1 - print "\rDownloading of", link, "failed,", tries, "left" + if tries == 0: + failed += 1 + else: + downloaded += 1 else: - print "\rNot downloading", link, "already downloaded" + skipped += 1 i += 1 progress.complete() + return (skipped, failed, downloaded, total) if __name__ == "__main__": # Get a file-like object for the 4chan.org w/imgboard |