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