Migrate Creators to single-class module.

This commit is contained in:
Tobias Gruetzmacher 2016-05-22 23:56:59 +02:00
parent f5dff27b0a
commit 2c8e57bdea
2 changed files with 84 additions and 152 deletions

View file

@ -9,158 +9,90 @@ from ..scraper import _ParserScraper
from ..helpers import indirectStarter from ..helpers import indirectStarter
class _Creators(_ParserScraper): class Creators(_ParserScraper):
imageSearch = '//a[contains(@class,"fancybox")]/img' imageSearch = '//a[contains(@class,"fancybox")]/img'
prevSearch = '//a[@id="nav_prev"]' prevSearch = '//a[@id="nav_prev"]'
latestSearch = '//div[contains(@class,"caption")]/a' latestSearch = '//div[contains(@class,"caption")]/a'
starter = indirectStarter starter = indirectStarter
def __init__(self, name): def __init__(self, name, path, lang=None):
super(_Creators, self).__init__('Creators/' + name) super(Creators, self).__init__('Creators/' + name)
self.url = 'https://www.creators.com/features/' + path
if lang:
self.lang = lang
@property @classmethod
def url(self): def getmodules(cls):
return 'https://www.creators.com/features/' + self.path return (
# Some comics are not listed on the "all" page (too old?)
cls('CafeconLeche', 'cafe-con-leche'),
class _CreatorsEs(_Creators): cls('DonaldDuck', 'donald-duck'),
lang = 'es' cls('Flare', 'flare'),
cls('FlightDeck', 'flight-deck'),
cls('GirlsAndSports', 'girls-and-sports'),
# Some comics are not listed on the "all" page (too old?) cls('HomeOffice', 'stay-at-home-dad'),
class CafeconLeche(_Creators): cls('HopeAndDeath', 'hope-and-death'),
path = 'cafe-con-leche' cls('MickeyMouse', 'mickey-mouse'),
cls('NaturalSelection', 'natural-selection'),
cls('OffCenter', 'off-center'),
class DonaldDuck(_Creators): cls('Recess', 'recess'),
path = 'donald-duck' cls('Rugrats', 'rugrats'),
cls('TheQuigmans', 'the-quigmans'),
cls('WinnieThePooh', 'winnie-the-pooh'),
class Flare(_Creators): # do not edit anything below since these entries are generated from
path = 'flare' # scripts/creators.py
# START AUTOUPDATE
# Agnes has a duplicate in GoComics/Agnes
class FlightDeck(_Creators): # AndyCapp has a duplicate in GoComics/AndyCapp
path = 'flight-deck' cls('AndyMarlette', 'andy-marlette'),
cls('Archie', 'archie'),
cls('ArchieSpanish', 'archie-spanish', 'es'),
class GirlsAndSports(_Creators): # AskShagg has a duplicate in GoComics/AskShagg
path = 'girls-and-sports' # BallardStreet has a duplicate in GoComics/BallardStreet
# BC has a duplicate in GoComics/BC
# BobGorrell has a duplicate in GoComics/BobGorrell
class HomeOffice(_Creators): # ChipBok has a duplicate in GoComics/ChipBok
path = 'stay-at-home-dad' # ChrisBritt has a duplicate in GoComics/ChrisBritt
# ChuckleBros has a duplicate in GoComics/ChuckleBros
# DaddysHome has a duplicate in GoComics/DaddysHome
class HopeAndDeath(_Creators): # DiamondLil has a duplicate in GoComics/DiamondLil
path = 'hope-and-death' # DogEatDoug has a duplicate in GoComics/DogEatDoug
# DogsOfCKennel has a duplicate in GoComics/DogsOfCKennel
# FloAndFriends has a duplicate in GoComics/FloAndFriends
class MickeyMouse(_Creators): # ForHeavensSake has a duplicate in GoComics/ForHeavensSake
path = 'mickey-mouse' # FreeRange has a duplicate in GoComics/FreeRange
# GaryMarkstein has a duplicate in GoComics/GaryMarkstein
# GaryVarvel has a duplicate in GoComics/GaryVarvel
class NaturalSelection(_Creators): # Heathcliff has a duplicate in GoComics/Heathcliff
path = 'natural-selection' cls('HeathcliffSpanish', 'heathcliff-spanish', 'es'),
# HerbAndJamaal has a duplicate in GoComics/HerbAndJamaal
# JohnDeering has a duplicate in GoComics/JohnDeering
class OffCenter(_Creators): # KenCatalino has a duplicate in GoComics/KenCatalino
path = 'off-center' # LibertyMeadows has a duplicate in GoComics/LibertyMeadows
cls('LongStoryShort', 'long-story-short'),
# MarshallRamsey has a duplicate in GoComics/MarshallRamsey
class Recess(_Creators): # MichaelRamirez has a duplicate in GoComics/MichaelRamirez
path = 'recess' # MikeLuckovich has a duplicate in GoComics/MikeLuckovich
# Momma has a duplicate in GoComics/Momma
cls('Mossprints', 'mossprints'),
class Rugrats(_Creators): # NestHeads has a duplicate in GoComics/NestHeads
path = 'rugrats' # OneBigHappy has a duplicate in GoComics/OneBigHappy
# PaulSzep has a duplicate in GoComics/PaulSzep
# Rubes has a duplicate in GoComics/Rubes
class TheQuigmans(_Creators): # ScaryGary has a duplicate in GoComics/ScaryGary
path = 'the-quigmans' # SpeedBump has a duplicate in GoComics/SpeedBump
# SteveBenson has a duplicate in GoComics/SteveBenson
# SteveBreen has a duplicate in GoComics/SteveBreen
class WinnieThePooh(_Creators): # SteveKelley has a duplicate in GoComics/SteveKelley
path = 'winnie-the-pooh' # StrangeBrew has a duplicate in GoComics/StrangeBrew
# TheBarn has a duplicate in GoComics/TheBarn
# TheMeaningOfLila has a duplicate in GoComics/TheMeaningOfLila
# do not edit anything below since these entries are generated from # TheOtherCoast has a duplicate in GoComics/TheOtherCoast
# scripts/update_plugins.sh cls('TomStiglich', 'tom-stiglich'),
# START AUTOUPDATE # WeePals has a duplicate in GoComics/WeePals
# Agnes has a duplicate in gocomics # WizardOfId has a duplicate in GoComics/WizardOfId
# AndyCapp has a duplicate in gocomics cls('WizardOfIdSpanish', 'wizard-of-id-spanish', 'es'),
class AndyMarlette(_Creators): # WorkingItOut has a duplicate in GoComics/WorkingItOut
path = 'andy-marlette' # ZackHill has a duplicate in GoComics/ZackHill
# END AUTOUPDATE
)
class Archie(_Creators):
path = 'archie'
class ArchieSpanish(_CreatorsEs):
path = 'archie-spanish'
# AskShagg has a duplicate in gocomics
# BC has a duplicate in gocomics
# BallardStreet has a duplicate in gocomics
# BobGorrell has a duplicate in gocomics
# ChipBok has a duplicate in gocomics
# ChrisBritt has a duplicate in gocomics
# ChuckleBros has a duplicate in gocomics
# DaddysHome has a duplicate in gocomics
# DiamondLil has a duplicate in gocomics
# DogEatDoug has a duplicate in gocomics
# DogsOfCKennel has a duplicate in gocomics
# FloAndFriends has a duplicate in gocomics
# ForHeavensSake has a duplicate in gocomics
# FreeRange has a duplicate in gocomics
# GaryMarkstein has a duplicate in gocomics
# GaryVarvel has a duplicate in gocomics
# Heathcliff has a duplicate in gocomics
class HeathcliffSpanish(_CreatorsEs):
path = 'heathcliff-spanish'
# HerbAndJamaal has a duplicate in gocomics
# JohnDeering has a duplicate in gocomics
# KenCatalino has a duplicate in gocomics
# LibertyMeadows has a duplicate in gocomics
class LongStoryShort(_Creators):
path = 'long-story-short'
# MarshallRamsey has a duplicate in gocomics
# MichaelRamirez has a duplicate in gocomics
# MikeLuckovich has a duplicate in gocomics
# Momma has a duplicate in gocomics
class Mossprints(_Creators):
path = 'mossprints'
# NestHeads has a duplicate in gocomics
# OneBigHappy has a duplicate in gocomics
# PaulSzep has a duplicate in gocomics
# Rubes has a duplicate in gocomics
# ScaryGary has a duplicate in gocomics
# SpeedBump has a duplicate in gocomics
# SteveBenson has a duplicate in gocomics
# SteveBreen has a duplicate in gocomics
# SteveKelley has a duplicate in gocomics
# StrangeBrew has a duplicate in gocomics
# TheBarn has a duplicate in gocomics
# TheMeaningOfLila has a duplicate in gocomics
# TheOtherCoast has a duplicate in gocomics
class TomStiglich(_Creators):
path = 'tom-stiglich'
# WeePals has a duplicate in gocomics
# WizardOfId has a duplicate in gocomics
class WizardOfIdSpanish(_CreatorsEs):
path = 'wizard-of-id-spanish'
# WorkingItOut has a duplicate in gocomics
# ZackHill has a duplicate in gocomics
# END AUTOUPDATE

View file

@ -36,9 +36,9 @@ class CreatorsUpdater(ComicListUpdater):
self.handle_url('https://www.creators.com/categories/comics/all') self.handle_url('https://www.creators.com/categories/comics/all')
self.handle_url('https://www.creators.com/categories/cartoons/all') self.handle_url('https://www.creators.com/categories/cartoons/all')
def get_entry(self, name, data): def get_entry(self, name, path):
lang = 'Es' if name.lower().endswith('spanish') else '' langopt = ", 'es'" if name.lower().endswith('spanish') else ''
return u"class %s(_Creators%s):\n path = %r" % (name, lang, data) return u"cls('%s', '%s'%s)," % (name, path, langopt)
if __name__ == '__main__': if __name__ == '__main__':
CreatorsUpdater(__file__).run() CreatorsUpdater(__file__).run()