From 3d96adc3ff9e484346c5cf22f2812d4607518e9f Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Thu, 11 Oct 2012 18:08:18 +0200 Subject: [PATCH] Remove progress stuff. --- dosage | 11 ++++------- dosagelib/__init__.py | 20 -------------------- dosagelib/comic.py | 14 ++------------ 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/dosage b/dosage index 7d9dd0ec3..5c1c1d96f 100755 --- a/dosage +++ b/dosage @@ -23,7 +23,7 @@ import optparse from dosagelib import events, scraper from dosagelib.output import out -from dosagelib.util import is_tty, get_columns, internal_error +from dosagelib.util import get_columns, internal_error from dosagelib.configuration import App, Freeware, Copyright def setupOptions(): @@ -43,7 +43,6 @@ def setupOptions(): parser.add_option('-m', '--modulehelp', action='store_true', dest='modhelp', help='display help for comic modules') parser.add_option('-t', '--timestamps', action='store_true', dest='timestamps', default=False, help='print timestamps for all output at any info level') parser.add_option('-o', '--output', action='store', dest='output', choices=events.getHandlers(), help='output formatting for downloaded comics') - parser.add_option('-p', '--progress', action='store_true', dest='progress', default=False, help='display progress bar while downloading comics') return parser @@ -62,12 +61,12 @@ def setOutputInfo(options): out.timestamps = options.timestamps -def saveComicStrip(strip, basepath, progress): +def saveComicStrip(strip, basepath): """Save a comic strip which can consist of multiple images.""" errors = 0 for image in strip.getImages(): try: - image.save(basepath, progress) + image.save(basepath) except IOError, msg: out.write('Error saving %s: %s' % (image.filename, msg)) errors += 1 @@ -95,7 +94,7 @@ def getComics(options, comics): out.write('Retrieving the current strip...') strips = [scraperobj.getCurrentStrip()] for strip in strips: - errors += saveComicStrip(strip, options.basepath, options.progress) + errors += saveComicStrip(strip, options.basepath) events.handler.end() return errors @@ -173,8 +172,6 @@ def main(): try: parser = setupOptions() options, args = parser.parse_args() - if not is_tty(sys.stdout) and options.progress: - options.progress = False res = run(options, args) except KeyboardInterrupt: print "Aborted." diff --git a/dosagelib/__init__.py b/dosagelib/__init__.py index 9cbcd256e..b38fa4a3c 100644 --- a/dosagelib/__init__.py +++ b/dosagelib/__init__.py @@ -14,27 +14,7 @@ is just a thin wrapper that invokes L{dosage.mainline}. Comic modules for each webcomic are located in L{dosage.modules}; most of these make use of the helper base classes and mixins in L{dosage.modules.helpers}, thus making their individual implementations trivial. - -@group Core modules: comic, events, output, progress, rss, util, - version -@group Interface modules: mainline -@group Comic modules: modules - -@sort: modules.helpers - -@author: U{Dosage development team } -@requires: Python 2.3+ -@see: U{The dosage webpage } -@see: U{The dosage Trac site } - -@newfield contributor: Contributor, Contributors (Alphabetical Order) -@contributor: U{Jonathan Jacobs } -@contributor: U{Tristan Seligmann } - -@var __license__: The license governing the use and distribution of - dosage. """ -__docformat__ = 'epytext en' import sys if not (hasattr(sys, 'version_info') or sys.version_info < (2, 5, 0, 'final', 0)): diff --git a/dosagelib/comic.py b/dosagelib/comic.py index 2b4a03b00..c2a050b93 100644 --- a/dosagelib/comic.py +++ b/dosagelib/comic.py @@ -8,7 +8,6 @@ import time from .output import out from .util import urlopen, saneDataSize, normaliseURL -from .progress import progressBar, OperationComplete from .events import handler class FetchComicError(IOError): @@ -77,7 +76,7 @@ class ComicImage(object): mtime = time.mktime(tt) os.utime(filename, (mtime, mtime)) - def save(self, basepath, showProgress=False): + def save(self, basepath): """Save comic URL to filename on disk.""" self.connect() filename = "%s%s" % (self.filename, self.ext) @@ -97,16 +96,7 @@ class ComicImage(object): out.write('Writing comic to file %s...' % (fn,), 3) with open(fn, 'wb') as comicOut: startTime = time.time() - if showProgress: - def pollData(): - data = self.urlobj.read(8192) - if not data: - raise OperationComplete - comicOut.write(data) - return len(data), self.contentLength - progressBar(pollData) - else: - comicOut.write(self.urlobj.read()) + comicOut.write(self.urlobj.read()) endTime = time.time() self.touch(fn) except: