From d54d787af1dee95cdc0d0592a65b05bef4d3b594 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Wed, 23 Jan 2013 19:33:10 +0100 Subject: [PATCH] Better image filename for CyanideAndHappiness --- doc/changelog.txt | 3 +++ dosagelib/plugins/c.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 96d612c42..5c0aca19b 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -4,6 +4,9 @@ Features: - comics: Added AmazingSuperPowers strip. - comics: Added PandyLand strip. +Changes: +- comics: CyanideAndHappiness image filename now has the strip number prefixed. + Fixes: - scripts: Ensure the generated comic names do not exceed 100 characters so they do not cause problems with path length restrictions. diff --git a/dosagelib/plugins/c.py b/dosagelib/plugins/c.py index e6c2e9369..0cfacdafa 100644 --- a/dosagelib/plugins/c.py +++ b/dosagelib/plugins/c.py @@ -179,12 +179,19 @@ class CatAndGirl(_BasicScraper): class CyanideAndHappiness(_BasicScraper): - latestUrl = 'http://www.explosm.net/comics/' - stripUrl = latestUrl + '%s/' + _latestUrl = 'http://www.explosm.net/comics/' + starter = bounceStarter(_latestUrl, compile(tagre("a", "href", r"(/comics/\d+/)", before="next"))) + stripUrl = _latestUrl + '%s/' imageSearch = compile(tagre("img", "src", r'(http://(?:www\.)?explosm\.net/db/files/Comics/[^"]+)')) prevSearch = compile(tagre("a", "href", r'(/comics/\d+/)', before="prev")) help = 'Index format: n (unpadded)' + @classmethod + def namer(cls, imageUrl, pageUrl): + imgname = imageUrl.split('/')[-1] + imgnum = pageUrl.split('/')[-2] + return '%s_%s' % (imgnum, imgname) + class CrimsonDark(_BasicScraper): latestUrl = 'http://www.davidcsimon.com/crimsondark/'