From d061852cc820d2efd61fd88c765d3018401d1ccb Mon Sep 17 00:00:00 2001 From: Techwolf Date: Fri, 25 Feb 2022 01:08:30 -0800 Subject: [PATCH] Unify RickGriffinStudios comics --- dosagelib/plugins/a.py | 21 --------- dosagelib/plugins/h.py | 6 --- dosagelib/plugins/old.py | 3 ++ dosagelib/plugins/rickgriffinstudios.py | 59 +++++++++++++++++++++++++ dosagelib/plugins/t.py | 20 --------- 5 files changed, 62 insertions(+), 47 deletions(-) create mode 100644 dosagelib/plugins/rickgriffinstudios.py diff --git a/dosagelib/plugins/a.py b/dosagelib/plugins/a.py index e082134d5..8734adb19 100644 --- a/dosagelib/plugins/a.py +++ b/dosagelib/plugins/a.py @@ -106,27 +106,6 @@ class AGirlAndHerFed(_ParserScraper): help = 'Index format: nnn' -class AHClub(_WPNaviIn): - baseUrl = 'http://rickgriffinstudios.com/' - url = baseUrl + 'ah-club/' - stripUrl = baseUrl + 'comic-post/%s/' - firstStripUrl = stripUrl % 'cover' - latestSearch = '//a[contains(@title, "Permanent Link")]' - starter = indirectStarter - nav = { - 'ah-club-2-cover': 'ah-club-1-page-24', - 'ah-club-3-cover': 'ah-club-2-page-28', - 'ah-club-4-cover': 'ah-club-3-page-22', - } - - def getPrevUrl(self, url, data): - # Links between chapters - url = url.rstrip('/').rsplit('/', 1)[-1] - if self.nav and url in self.nav: - return self.stripUrl % self.nav[url] - return super(AHClub, self).getPrevUrl(url, data) - - class AhoiPolloi(_ParserScraper): url = 'https://ahoipolloi.blogger.de/' stripUrl = url + '?day=%s' diff --git a/dosagelib/plugins/h.py b/dosagelib/plugins/h.py index ec44f606a..21b0fbcc3 100644 --- a/dosagelib/plugins/h.py +++ b/dosagelib/plugins/h.py @@ -116,12 +116,6 @@ class HijinksEnsuePhoto(_WPNaviIn): endOfLife = True -class Housepets(_WordPressScraper): - url = 'http://www.housepetscomic.com/' - stripUrl = url + 'comic/%s/' - firstStripUrl = '2008/06/02/when-boredom-strikes' - - class HowToBeAWerewolf(_ComicControlScraper): url = 'http://howtobeawerewolf.com/' stripUrl = url + 'comic/%s' diff --git a/dosagelib/plugins/old.py b/dosagelib/plugins/old.py index 9bf28c03e..91e958509 100644 --- a/dosagelib/plugins/old.py +++ b/dosagelib/plugins/old.py @@ -1611,6 +1611,7 @@ class Renamed(Scraper): cls('ZebraGirl', 'ComicFury/ZebraGirl'), # Renamed in 3.0 + cls('AHClub', 'RickGriffinStudios/AHClub'), cls('CrapIDrewOnMyLunchBreak', 'WebToons/CrapIDrewOnMyLunchBreak'), cls('DeerMe', 'ComicFury/DeerMe'), cls('GoComics/BloomCounty2017', 'GoComics/BloomCounty2019'), @@ -1627,4 +1628,6 @@ class Renamed(Scraper): cls('SmackJeeves/GrowingTroubles', 'ComicFury/GrowingTroubles'), cls('SmackJeeves/TheRealmOfKaerwyn', 'ComicFury/TheRealmOfKaerwyn'), cls('StudioKhimera/Draconia', 'Draconia'), + cls('TracesOfThePast', 'RickGriffinStudios/TracesOfThePast'), + cls('TracesOfThePast/NSFW', 'RickGriffinStudios/TracesOfThePastNSFW'), ) diff --git a/dosagelib/plugins/rickgriffinstudios.py b/dosagelib/plugins/rickgriffinstudios.py new file mode 100644 index 000000000..c57ae6dc9 --- /dev/null +++ b/dosagelib/plugins/rickgriffinstudios.py @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: MIT +# Copyright (C) 2019-2020 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Daniel Ring +from ..helpers import indirectStarter +from .common import _WordPressScraper, _WPNaviIn + + +class Housepets(_WordPressScraper): + url = 'http://www.housepetscomic.com/' + stripUrl = url + 'comic/%s/' + firstStripUrl = '2008/06/02/when-boredom-strikes' + + +class RickGriffinStudios(_WPNaviIn): + baseUrl = 'http://rickgriffinstudios.com/' + stripUrl = baseUrl + 'comic-post/%s/' + latestSearch = '//a[contains(@title, "Permanent Link")]' + starter = indirectStarter + nav = None + + def __init__(self, name, sub, first, last=None, adult=False, nav=None): + super().__init__('RickGriffinStudios/' + name) + self.url = self.baseUrl + sub + '/' + self.firstStripUrl = self.stripUrl % first + + if last: + self.url = self.stripUrl % last + self.starter = super(RickGriffinStudios, self).starter + self.endOfLife = True + + if adult: + self.latestSearch = '//a[contains(@title, "NSFW")]' + self.adult = True + + if nav: + self.nav = nav + + def getPrevUrl(self, url, data): + # Links between chapters + url = url.rstrip('/').rsplit('/', 1)[-1] + if self.nav and url in self.nav: + return self.stripUrl % self.nav[url] + return super(RickGriffinStudios, self).getPrevUrl(url, data) + + @classmethod + def getmodules(cls): + return ( + cls('AHClub', 'ah-club', 'cover', nav={ + 'ah-club-2-cover': 'ah-club-1-page-24', + 'ah-club-3-cover': 'ah-club-2-page-28', + 'ah-club-4-cover': 'ah-club-3-page-22', + 'ah-club-5-cover': 'ah-club-4-page-24' + }), + cls('HayvenCelestia', 'hayven-celestia', 'skinchange-p1'), + cls('TheStoryboard', 'the-storyboard', 'the-storyboard-001'), + cls('TracesOfThePast', 'in-the-new-age', 'totp-page-1'), + cls('TracesOfThePastNSFW', 'in-the-new-age', 'totp-page-1-nsfw', adult=True), + cls('ZootopiaNightTerrors', 'zootopia-night-terrors', 'zootopia-night-terrors-p1', 'zootopia-night-terrors-p7'), + ) diff --git a/dosagelib/plugins/t.py b/dosagelib/plugins/t.py index 82f72788e..7e8c1b369 100644 --- a/dosagelib/plugins/t.py +++ b/dosagelib/plugins/t.py @@ -290,26 +290,6 @@ class ToonHole(_WordPressScraper): return url in (self.url + "comic/if-game-of-thrones-was-animated/",) -class TracesOfThePast(_WPNaviIn): - baseUrl = 'http://rickgriffinstudios.com/' - url = baseUrl + 'in-the-new-age/' - stripUrl = baseUrl + 'comic-post/%s/' - firstStripUrl = stripUrl % 'totp-page-1' - latestSearch = '//a[contains(@title, "Permanent Link")]' - starter = indirectStarter - - -class TracesOfThePastNSFW(_WPNaviIn): - name = 'TracesOfThePast/NSFW' - baseUrl = 'http://rickgriffinstudios.com/' - url = baseUrl + 'in-the-new-age/' - stripUrl = baseUrl + 'comic-post/%s/' - firstStripUrl = stripUrl % 'totp-page-1-nsfw' - latestSearch = '//a[contains(@title, "NSFW")]' - starter = indirectStarter - adult = True - - class TrippingOverYou(_BasicScraper): url = 'http://www.trippingoveryou.com/' stripUrl = url + 'comic/%s'