From 1ea20e1743c6c6370361075f843b02590f233666 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Sun, 22 May 2016 23:40:58 +0200 Subject: [PATCH] Migrate WebcomicFactory to single-class module. --- dosagelib/plugins/webcomicfactory.py | 228 +++++++++------------------ scripts/webcomicfactory.py | 3 +- 2 files changed, 74 insertions(+), 157 deletions(-) diff --git a/dosagelib/plugins/webcomicfactory.py b/dosagelib/plugins/webcomicfactory.py index 2a34f1000..e85b2bfaa 100644 --- a/dosagelib/plugins/webcomicfactory.py +++ b/dosagelib/plugins/webcomicfactory.py @@ -9,162 +9,80 @@ from .common import _WordPressScraper, WP_LATEST_SEARCH from ..helpers import indirectStarter -class _WebcomicFactory(_WordPressScraper): +class WebcomicFactory(_WordPressScraper): starter = indirectStarter latestSearch = WP_LATEST_SEARCH + def __init__(self, name, url): + super(WebcomicFactory, self).__init__(name) + self.url = url + self.firstStripUrl = url -# do not edit anything below since these entries are generated from -# scripts/update_plugins.sh -# START AUTOUPDATE - - -class AsTheMayoTurns(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/as-the-mayo-turns/' - firstStripUrl = url - - -class ComicBookMafia(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/comic-book-mafia/' - firstStripUrl = url - - -class Dealers(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/dealers-1-1998-was-the-year/' - firstStripUrl = url - - -class DigitalHobo(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/digital-hobo-1-its-a-living-kinda/' - firstStripUrl = url - - -class ECoastVsWCoast(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/east-coast-vs-west-coast-greetings-from-the-coasts/' - firstStripUrl = url - - -class GunCulture(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/gun-culture/' - firstStripUrl = url - - -class IHateMyKids(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/i-hate-my-kids/' - firstStripUrl = url - - -class InARelationship(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/in-a-relationship-3/' - firstStripUrl = url - - -class IntergalacticMedicalDoctor(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/intergalactic-medical-doctor/' - firstStripUrl = url - - -class JSchoolgirlsInLove(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/japanese-schoolgirls-in-love-1/' - firstStripUrl = url - - -class KingdomOfTheDwarves(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/kingdom-of-the-dwarves/' - firstStripUrl = url - - -class LesterCrenshawIsDead(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/lester-crenshaw-is-dead/' - firstStripUrl = url - - -class Millennials(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/millennials/' - firstStripUrl = url - - -class MiserableComedians(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/miserable-comedians-1-funny-because-its-sad/' - firstStripUrl = url - - -class OldeTymeGamer(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/olde-tyme-gamer-playing-injured/' - firstStripUrl = url - - -class PinJunkies(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/pin-junkies/' - firstStripUrl = url - - -class PostApocalypticNick(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/post-apocalyptic-nick/' - firstStripUrl = url - - -class RealTalk(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/real-talk-people-who-cut-in-line/' - firstStripUrl = url - - -class SoManyNightmares(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/so-many-nightmares-freedom-nightmare/' - firstStripUrl = url - - -class SportsGuys(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/sports-guys/' - firstStripUrl = url - - -class TalesOfPizza(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/tales-of-pizza-bad-tipper/' - firstStripUrl = url - - -class TAndA(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/the-webcomic-factory-premiere-t-and-a/' - firstStripUrl = url - - -class TheAntiwarComic(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/the-antiwar-comic-the-party/' - firstStripUrl = url - - -class TheGentlemensClub(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/the-gentlemens-club/' - firstStripUrl = url - - -class TheHorrorOfColony6(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/the-horror-of-colony-6-page-1/' - firstStripUrl = url - - -class TheKingsOfViralVideo(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/the-kings-of-viral-video-premiere/' - firstStripUrl = url - - -class TheSharonAndTonyExperiment(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/the-sharon-and-tony-experiment/' - firstStripUrl = url - - -class TonyDestructo(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/tony-destructo/' - firstStripUrl = url - - -class WeirdBikerTales(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/weird-biker-tales-the-last-outlaw/' - firstStripUrl = url - - -class WillysSpaceDive(_WebcomicFactory): - url = 'http://www.thewebcomicfactory.com/comic/willys-space-dive/' - firstStripUrl = url -# END AUTOUPDATE + @classmethod + def getmodules(cls): + return ( + # do not edit anything below since these entries are generated from + # scripts/webcomicfactory.py + # START AUTOUPDATE + cls('AsTheMayoTurns', + 'http://www.thewebcomicfactory.com/comic/as-the-mayo-turns/'), + cls('ComicBookMafia', + 'http://www.thewebcomicfactory.com/comic/comic-book-mafia/'), + cls('Dealers', + 'http://www.thewebcomicfactory.com/comic/dealers-1-1998-was-the-year/'), + cls('DigitalHobo', + 'http://www.thewebcomicfactory.com/comic/digital-hobo-1-its-a-living-kinda/'), + cls('ECoastVsWCoast', + 'http://www.thewebcomicfactory.com/comic/east-coast-vs-west-coast-greetings-from-the-coasts/'), + cls('GunCulture', + 'http://www.thewebcomicfactory.com/comic/gun-culture/'), + cls('IHateMyKids', + 'http://www.thewebcomicfactory.com/comic/i-hate-my-kids/'), + cls('InARelationship', + 'http://www.thewebcomicfactory.com/comic/in-a-relationship-3/'), + cls('IntergalacticMedicalDoctor', + 'http://www.thewebcomicfactory.com/comic/intergalactic-medical-doctor/'), + cls('JSchoolgirlsInLove', + 'http://www.thewebcomicfactory.com/comic/japanese-schoolgirls-in-love-1/'), + cls('KingdomOfTheDwarves', + 'http://www.thewebcomicfactory.com/comic/kingdom-of-the-dwarves/'), + cls('LesterCrenshawIsDead', + 'http://www.thewebcomicfactory.com/comic/lester-crenshaw-is-dead/'), + cls('Millennials', + 'http://www.thewebcomicfactory.com/comic/millennials/'), + cls('MiserableComedians', + 'http://www.thewebcomicfactory.com/comic/miserable-comedians-1-funny-because-its-sad/'), + cls('OldeTymeGamer', + 'http://www.thewebcomicfactory.com/comic/olde-tyme-gamer-playing-injured/'), + cls('PinJunkies', + 'http://www.thewebcomicfactory.com/comic/pin-junkies/'), + cls('PostApocalypticNick', + 'http://www.thewebcomicfactory.com/comic/post-apocalyptic-nick/'), + cls('RealTalk', + 'http://www.thewebcomicfactory.com/comic/real-talk-people-who-cut-in-line/'), + cls('SoManyNightmares', + 'http://www.thewebcomicfactory.com/comic/so-many-nightmares-freedom-nightmare/'), + cls('SportsGuys', + 'http://www.thewebcomicfactory.com/comic/sports-guys/'), + cls('TalesOfPizza', + 'http://www.thewebcomicfactory.com/comic/tales-of-pizza-bad-tipper/'), + cls('TAndA', + 'http://www.thewebcomicfactory.com/comic/the-webcomic-factory-premiere-t-and-a/'), + cls('TheAntiwarComic', + 'http://www.thewebcomicfactory.com/comic/the-antiwar-comic-the-party/'), + cls('TheGentlemensClub', + 'http://www.thewebcomicfactory.com/comic/the-gentlemens-club/'), + cls('TheHorrorOfColony6', + 'http://www.thewebcomicfactory.com/comic/the-horror-of-colony-6-page-1/'), + cls('TheKingsOfViralVideo', + 'http://www.thewebcomicfactory.com/comic/the-kings-of-viral-video-premiere/'), + cls('TheSharonAndTonyExperiment', + 'http://www.thewebcomicfactory.com/comic/the-sharon-and-tony-experiment/'), + cls('TonyDestructo', + 'http://www.thewebcomicfactory.com/comic/tony-destructo/'), + cls('WeirdBikerTales', + 'http://www.thewebcomicfactory.com/comic/weird-biker-tales-the-last-outlaw/'), + cls('WillysSpaceDive', + 'http://www.thewebcomicfactory.com/comic/willys-space-dive/'), + # END AUTOUPDATE + ) diff --git a/scripts/webcomicfactory.py b/scripts/webcomicfactory.py index 2b9848d2d..c56355b8c 100755 --- a/scripts/webcomicfactory.py +++ b/scripts/webcomicfactory.py @@ -40,8 +40,7 @@ class WebComicFactoryUpdater(ComicListUpdater): self.add_comic(name, comicurl) def get_entry(self, name, url): - return (u"class %s(_WebcomicFactory):\n url = %r\n" % (name, url) + - u" firstStripUrl = url") + return (u"cls('%s',\n '%s')," % (name, url)) if __name__ == '__main__':