From 13282ce8cdbbb5e8d37897a5527bbd2a4571ffb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Rubinstein?= Date: Mon, 4 Jun 2012 23:45:50 +0200 Subject: [PATCH] Add Mangago backend (CapGallery) --- modules/mangago/__init__.py | 24 ++++++++++++++++++++++++ modules/mangago/backend.py | 36 ++++++++++++++++++++++++++++++++++++ modules/mangago/test.py | 26 ++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 modules/mangago/__init__.py create mode 100644 modules/mangago/backend.py create mode 100644 modules/mangago/test.py diff --git a/modules/mangago/__init__.py b/modules/mangago/__init__.py new file mode 100644 index 00000000..c3dff900 --- /dev/null +++ b/modules/mangago/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright(C) 2012 Noé Rubinstein +# +# This file is part of weboob. +# +# weboob is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# weboob is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with weboob. If not, see . + + +from .backend import MangagoBackend + +__all__ = ['MangagoBackend'] + diff --git a/modules/mangago/backend.py b/modules/mangago/backend.py new file mode 100644 index 00000000..fb11ad5d --- /dev/null +++ b/modules/mangago/backend.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright(C) 2012 Noé Rubinstein +# +# This file is part of weboob. +# +# weboob is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# weboob is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with weboob. If not, see . + + +from weboob.tools.capabilities.gallery.genericcomicreader import GenericComicReaderBackend, DisplayPage + +__all__ = ['MangagoBackend'] + +class MangagoBackend(GenericComicReaderBackend): + NAME = 'mangago' + DESCRIPTION = 'Mangago manga reading site' + DOMAIN = 'www.mangago.com' + BROWSER_PARAMS = dict( + img_src_xpath="//div[@id='pic_container']//img/@src", + page_list_xpath="(//div[contains(@class,'page_select')]//select)[1]//@value") + ID_REGEXP = r'(?:[^/]+/)+.+' + URL_REGEXP = r'.+mangago.com/r/l_manga/(%s).+' % ID_REGEXP + ID_TO_URL = 'http://www.mangago.com/r/l_manga/%s' + PAGES = { URL_REGEXP: DisplayPage } + diff --git a/modules/mangago/test.py b/modules/mangago/test.py new file mode 100644 index 00000000..0751f643 --- /dev/null +++ b/modules/mangago/test.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# Copyright(C) 2012 Noé Rubinstein +# +# This file is part of weboob. +# +# weboob is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# weboob is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with weboob. If not, see . + +from weboob.tools.capabilities.gallery.genericcomicreader import GenericComicReaderTest + +class MangagoTest(GenericComicReaderTest): + BACKEND = 'mangago' + def test_download(self): + return self._test_download('manga/love_scar/mh/manga/love_scar/c001/') +