From e762f269b79b7d4dd771895a7894500d7a420339 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Mon, 8 Apr 2013 20:19:10 +0200 Subject: [PATCH] First part of voting stuff. --- dosage | 5 ++++- dosagelib/scraper.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dosage b/dosage index eb3e5e784..6f3a1f59e 100755 --- a/dosage +++ b/dosage @@ -75,6 +75,7 @@ def setupOptions(): parser.add_argument('-l', '--list', action='store_true', help='list available comic modules') parser.add_argument('--singlelist', action='store_true', help='list available comic modules in a single list') parser.add_argument('--version', action='store_true', help='display the version number') + parser.add_argument('--vote', action='store_true', help='vote for the selected comics') parser.add_argument('-m', '--modulehelp', action='store_true', help='display help for comic modules') parser.add_argument('-t', '--timestamps', action='store_true', help='print timestamps for all output at any info level') parser.add_argument('-o', '--output', action='append', dest='handler', choices=events.getHandlerNames(), help='sets output handlers for downloaded comics') @@ -174,13 +175,15 @@ def displayComicHelp(scraperobj): def getComics(options): """Retrieve comics.""" - errors = 0 if options.handler: for name in set(options.handler): events.addHandler(name, options.basepath, options.baseurl) events.getHandler().start() + errors = 0 try: for scraperobj in getScrapers(options.comic, options.basepath, options.adult, options.multimatch): + if options.vote: + scraper.vote() errors += getStrips(scraperobj, options) except ValueError as msg: out.exception(msg) diff --git a/dosagelib/scraper.py b/dosagelib/scraper.py index 71878b2d6..69a198a82 100644 --- a/dosagelib/scraper.py +++ b/dosagelib/scraper.py @@ -224,6 +224,10 @@ class _BasicScraper(object): """Get starter URL from where to scrape comic strips.""" return self.starter() + def vote(self): + """Cast a public vote for this comic.""" + pass # XXX + def find_scraperclasses(comic, multiple_allowed=False): """Get a list comic scraper classes. Can return more than one entries if