Better image filename for CyanideAndHappiness

This commit is contained in:
Bastian Kleineidam 2013-01-23 19:33:10 +01:00
parent 7701b2531a
commit d54d787af1
2 changed files with 12 additions and 2 deletions

View file

@ -4,6 +4,9 @@ Features:
- comics: Added AmazingSuperPowers strip. - comics: Added AmazingSuperPowers strip.
- comics: Added PandyLand strip. - comics: Added PandyLand strip.
Changes:
- comics: CyanideAndHappiness image filename now has the strip number prefixed.
Fixes: Fixes:
- scripts: Ensure the generated comic names do not exceed 100 characters so they do - scripts: Ensure the generated comic names do not exceed 100 characters so they do
not cause problems with path length restrictions. not cause problems with path length restrictions.

View file

@ -179,12 +179,19 @@ class CatAndGirl(_BasicScraper):
class CyanideAndHappiness(_BasicScraper): class CyanideAndHappiness(_BasicScraper):
latestUrl = 'http://www.explosm.net/comics/' _latestUrl = 'http://www.explosm.net/comics/'
stripUrl = latestUrl + '%s/' 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/[^"]+)')) imageSearch = compile(tagre("img", "src", r'(http://(?:www\.)?explosm\.net/db/files/Comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(/comics/\d+/)', before="prev")) prevSearch = compile(tagre("a", "href", r'(/comics/\d+/)', before="prev"))
help = 'Index format: n (unpadded)' 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): class CrimsonDark(_BasicScraper):
latestUrl = 'http://www.davidcsimon.com/crimsondark/' latestUrl = 'http://www.davidcsimon.com/crimsondark/'