remove "http://%s%%s" % DOMAIN workaround and shorten

This commit is contained in:
Noé Rubinstein 2011-09-04 00:06:04 +02:00 committed by Romain Bignon
commit 2993efcf55
6 changed files with 10 additions and 11 deletions

View file

@ -27,8 +27,7 @@ class EatmangaBackend(GenericComicReaderBackend):
DOMAIN = 'www.eatmanga.com'
BROWSER_PARAMS = dict(
img_src_xpath="//img[@class='eatmanga_bigimage']/@src",
page_list_xpath="(//select[@id='pages'])[1]/option/@value",
page_to_location="http://%s%%s" % DOMAIN)
page_list_xpath="(//select[@id='pages'])[1]/option/@value")
ID_REGEXP = r'[^/]+/[^/]+'
URL_REGEXP = r'.+eatmanga.com/(?:index.php/)?Manga-Scan/(%s).+' % ID_REGEXP
ID_TO_URL = 'http://www.eatmanga.com/index.php/Manga-Scan/%s'

View file

@ -27,8 +27,7 @@ class MangahereBackend(GenericComicReaderBackend):
DOMAIN = 'www.mangahere.com'
BROWSER_PARAMS = dict(
img_src_xpath="//img[@id='image']/@src",
page_list_xpath="(//select[@onchange='change_page(this)'])[1]/option/@value",
page_to_location="%s")
page_list_xpath="(//select[@onchange='change_page(this)'])[1]/option/@value")
ID_REGEXP = r'[^/]+/[^/]+/[^/]+'
URL_REGEXP = r'.+mangahere.com/manga/(%s).+' % ID_REGEXP
ID_TO_URL = 'http://www.mangahere.com/manga/%s'

View file

@ -27,8 +27,7 @@ class MangareaderBackend(GenericComicReaderBackend):
DOMAIN = 'www.mangareader.net'
BROWSER_PARAMS = dict(
img_src_xpath="//img[@id='img']/@src",
page_list_xpath="//select[@id='pageMenu']/option/@value",
page_to_location="http://%s%%s" % DOMAIN)
page_list_xpath="//select[@id='pageMenu']/option/@value")
ID_REGEXP = r'[^/]+/[^/]+'
URL_REGEXP = r'.+mangareader.net/(%s).+' % ID_REGEXP
ID_TO_URL = 'http://www.mangareader.net/%s'

View file

@ -27,8 +27,7 @@ class MangatoshokanBackend(GenericComicReaderBackend):
DOMAIN = "www.mangatoshokan.com"
BROWSER_PARAMS = dict(
img_src_xpath="//img[@id='readerPage']/@src",
page_list_xpath="(//select[@class='headerSelect'])[1]/option/@value",
page_to_location='http://%s%%s' % DOMAIN)
page_list_xpath="(//select[@class='headerSelect'])[1]/option/@value")
ID_TO_URL = 'http://www.mangatoshokan.com/read/%s'
ID_REGEXP = r'[^/]+(?:/[^/]+)*'
URL_REGEXP = r'.+mangatoshokan.com/read/(%s)' % ID_REGEXP

View file

@ -26,8 +26,7 @@ class SimplyreaditBackend(GenericComicReaderBackend):
DESCRIPTION = 'Simplyreadit manga reading site'
BROWSER_PARAMS = dict(
img_src_xpath="//img[@class='open']/@src",
page_list_xpath="(//div[contains(@class,'dropdown_right')]/ul[@class='dropdown'])[1]/li/a/@href",
page_to_location="%s")
page_list_xpath="(//div[contains(@class,'dropdown_right')]/ul[@class='dropdown'])[1]/li/a/@href")
ID_TO_URL = 'http://www.simplyread.it/reader/read/%s'
ID_REGEXP = r'[^/]+(?:/[^/]+)*'
URL_REGEXP = r'.+simplyread.it/reader/read/(%s)/page/.+' % ID_REGEXP

View file

@ -49,7 +49,11 @@ class GenericComicReaderBrowser(BaseBrowser):
assert self.is_on_page(DisplayPage)
for p in self.page.page_list():
self.location(self.params['page_to_location'] % p)
if 'page_to_location' in self.params:
self.location(self.params['page_to_location'] % p)
else:
self.location(p)
assert self.is_on_page(DisplayPage)
yield self.page.get_page(gallery)