Migrate SnafuComics to single-class module.

This commit is contained in:
Tobias Gruetzmacher 2016-06-05 22:11:22 +02:00
parent 125c96e9dc
commit 67d0d38100

View file

@ -9,124 +9,47 @@ from ..scraper import _ParserScraper
from ..helpers import indirectStarter from ..helpers import indirectStarter
class _Snafu(_ParserScraper): class Snafu(_ParserScraper):
# Next and Previous are swapped... # Next and Previous are swapped...
prevSearch = '//a[@class="next"]' prevSearch = '//a[@class="next"]'
imageSearch = '//div[@class="comicpage"]/img' imageSearch = '//div[@class="comicpage"]/img'
latestSearch = '//div[@id="feed"]/a' latestSearch = '//div[@id="feed"]/a'
starter = indirectStarter starter = indirectStarter
def __init__(self, name): def __init__(self, name, path):
super(_Snafu, self).__init__('SnafuComics/' + name) super(Snafu, self).__init__('SnafuComics/' + name)
self.url = 'http://snafu-comics.com/swmseries/' + path
def namer(self, image_url, page_url): def namer(self, image_url, page_url):
year, month, name = image_url.rsplit('/', 3)[1:] year, month, name = image_url.rsplit('/', 3)[1:]
return "%04s_%02s_%s" % (year, month, name) return "%04s_%02s_%s" % (year, month, name)
@property @classmethod
def url(self): def getmodules(cls):
return 'http://snafu-comics.com/swmseries/' + self.path return [
cls('Braindead', 'braindead'),
cls('Bunnywith', 'bunnywith'),
class Braindead(_Snafu): cls('DeliverUsEvil', 'deliverusevil'),
path = 'braindead' cls('EA', 'ea'),
cls('FT', 'ft'),
cls('GrimTalesFromDownBelow', 'grimtales'),
class Bunnywith(_Snafu): cls('KOF', 'kof'),
path = 'bunnywith' cls('MyPanda', 'mypanda'),
cls('NarutoHeroesPath', 'naruto'),
cls('NewSuperMarioAdventures', 'nsma'),
class DeliverUsEvil(_Snafu): cls('PowerPuffGirls', 'powerpuffgirls'),
path = 'deliverusevil' # cls('PSG2', 'psg2'), -- Strangely broken
cls('SatansExcrement', 'satansexcrement'),
cls('SF', 'sf'),
class DigitalPurgatory(_Snafu): cls('SkullBoy', 'skullboy'),
path = 'digital-purgatory' cls('Snafu', 'snafu'),
cls('Soul', 'soul'),
cls('Sugar', 'sugarbits'),
class EA(_Snafu): cls('SureToBeBanD', 'stbb'),
path = 'ea' cls('TheLeague', 'league'),
cls('Tin', 'tin'),
cls('Titan', 'titan'),
class FT(_Snafu): cls('TrunksAndSoto', 'trunks-and-soto'),
path = 'ft' cls('TW', 'tw'),
cls('Zim', 'zim'),
]
class GrimTalesFromDownBelow(_Snafu):
path = 'grimtales'
class KOF(_Snafu):
path = 'kof'
class MyPanda(_Snafu):
path = 'mypanda'
class NarutoHeroesPath(_Snafu):
path = 'naruto'
class NewSuperMarioAdventures(_Snafu):
path = 'nsma'
class PowerPuffGirls(_Snafu):
path = 'powerpuffgirls'
class PSG2(_Snafu):
path = 'psg2'
class SatansExcrement(_Snafu):
path = 'satansexcrement'
class SF(_Snafu):
path = 'sf'
class SkullBoy(_Snafu):
path = 'skullboy'
class Snafu(_Snafu):
path = 'snafu'
class Soul(_Snafu):
path = 'soul'
class Sugar(_Snafu):
path = 'sugarbits'
class SureToBeBanD(_Snafu):
path = 'stbb'
class TheLeague(_Snafu):
path = 'league'
class Tin(_Snafu):
path = 'tin'
class Titan(_Snafu):
path = 'titan'
class TrunksAndSoto(_Snafu):
path = 'trunks-and-soto'
class TW(_Snafu):
path = 'tw'
class Zim(_Snafu):
path = 'zim'