code clean
code clean
This commit is contained in:
parent
5c2ab81e16
commit
1847ea5f34
14 changed files with 54 additions and 22 deletions
|
|
@ -30,7 +30,6 @@ class Weboorrents(ConsoleApplication):
|
||||||
APPNAME = 'weboorrents'
|
APPNAME = 'weboorrents'
|
||||||
VERSION = '0.1'
|
VERSION = '0.1'
|
||||||
COPYRIGHT = 'Copyright(C) 2010 Romain Bignon'
|
COPYRIGHT = 'Copyright(C) 2010 Romain Bignon'
|
||||||
CONFIG = {}
|
|
||||||
|
|
||||||
def main(self, argv):
|
def main(self, argv):
|
||||||
self.load_configured_backends(ICapTorrent)
|
self.load_configured_backends(ICapTorrent)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@ from weboob.capabilities.travel import ICapTravel, Station, Departure
|
||||||
|
|
||||||
from .browser import CanalTP
|
from .browser import CanalTP
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['CanalTPBackend']
|
||||||
|
|
||||||
|
|
||||||
class CanalTPBackend(BaseBackend, ICapTravel):
|
class CanalTPBackend(BaseBackend, ICapTravel):
|
||||||
NAME = 'canaltp'
|
NAME = 'canaltp'
|
||||||
MAINTAINER = 'Romain Bignon'
|
MAINTAINER = 'Romain Bignon'
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,17 @@
|
||||||
|
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.core.backend import BaseBackend
|
from weboob.tools.backend import BaseBackend
|
||||||
from weboob.tools.browser import BrowserUnavailable
|
from weboob.tools.browser import BrowserUnavailable
|
||||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||||
|
|
||||||
from .feeds import ArticlesList
|
from .feeds import ArticlesList
|
||||||
from .browser import DLFP
|
from .browser import DLFP
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['DLFPBackend']
|
||||||
|
|
||||||
|
|
||||||
class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
|
class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
|
||||||
NAME = 'dlfp'
|
NAME = 'dlfp'
|
||||||
MAINTAINER = 'Romain Bignon'
|
MAINTAINER = 'Romain Bignon'
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,20 @@
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
from logging import warning
|
from logging import warning
|
||||||
|
|
||||||
from weboob.core.backend import BaseBackend
|
|
||||||
from weboob.capabilities.messages import ICapMessages, Message
|
from weboob.capabilities.messages import ICapMessages, Message
|
||||||
|
from weboob.tools.backend import BaseBackend
|
||||||
|
|
||||||
from .browser import FourChan
|
from .browser import FourChan
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['FourChanBackend']
|
||||||
|
|
||||||
|
|
||||||
class FourChanBackend(BaseBackend, ICapMessages):
|
class FourChanBackend(BaseBackend, ICapMessages):
|
||||||
NAME = 'fourchan'
|
NAME = 'fourchan'
|
||||||
MAINTAINER = 'Romain Bignon'
|
MAINTAINER = 'Romain Bignon'
|
||||||
|
|
@ -32,7 +37,7 @@ class FourChanBackend(BaseBackend, ICapMessages):
|
||||||
LICENSE = 'GPLv3'
|
LICENSE = 'GPLv3'
|
||||||
DESCRIPTION = "4chan website"
|
DESCRIPTION = "4chan website"
|
||||||
|
|
||||||
CONFIG = {'boards': BaseBackend.ConfigField(description='Boards'),
|
CONFIG = {'boards': BaseBackend.ConfigField(description='Boards'),
|
||||||
}
|
}
|
||||||
STORAGE = {'boards': {}}
|
STORAGE = {'boards': {}}
|
||||||
BROWSER = FourChan
|
BROWSER = FourChan
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ class GazelleBackend(BaseBackend, ICapTorrent):
|
||||||
DESCRIPTION = 'gazelle bittorrent tracker'
|
DESCRIPTION = 'gazelle bittorrent tracker'
|
||||||
LICENSE = 'GPLv3'
|
LICENSE = 'GPLv3'
|
||||||
|
|
||||||
CONFIG = {'username': BaseBackend.ConfigField(description='Username on website'),
|
CONFIG = {'username': BaseBackend.ConfigField(description='Username on website'),
|
||||||
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True),
|
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True),
|
||||||
'protocol': BaseBackend.ConfigField(description='Protocol to use ("http" or "https")', regexp='^(http|https)$'),
|
'protocol': BaseBackend.ConfigField(description='Protocol to use ("http" or "https")', regexp='^(http|https)$'),
|
||||||
'domain': BaseBackend.ConfigField(description='Domain (example "ssl.what.cd")'),
|
'domain': BaseBackend.ConfigField(description='Domain (example "ssl.what.cd")'),
|
||||||
}
|
}
|
||||||
BROWSER = GazelleBrowser
|
BROWSER = GazelleBrowser
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ class InaBackend(BaseBackend, ICapVideo):
|
||||||
DESCRIPTION = 'INA french video archives'
|
DESCRIPTION = 'INA french video archives'
|
||||||
LICENSE = 'GPLv3'
|
LICENSE = 'GPLv3'
|
||||||
|
|
||||||
CONFIG = {}
|
|
||||||
BROWSER = InaBrowser
|
BROWSER = InaBrowser
|
||||||
|
|
||||||
def get_video(self, _id):
|
def get_video(self, _id):
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ from weboob.tools.browser import BasePage
|
||||||
from ..video import InaVideo
|
from ..video import InaVideo
|
||||||
|
|
||||||
|
|
||||||
__ALL__ = ['VideoPage']
|
__all__ = ['VideoPage']
|
||||||
|
|
||||||
|
|
||||||
class VideoPage(BasePage):
|
class VideoPage(BasePage):
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ class YoujizzBackend(BaseBackend, ICapVideo):
|
||||||
DESCRIPTION = 'Youjizz videos website'
|
DESCRIPTION = 'Youjizz videos website'
|
||||||
LICENSE = 'GPLv3'
|
LICENSE = 'GPLv3'
|
||||||
|
|
||||||
CONFIG = {}
|
|
||||||
BROWSER = YoujizzBrowser
|
BROWSER = YoujizzBrowser
|
||||||
|
|
||||||
def get_video(self, _id):
|
def get_video(self, _id):
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ class YoupornBackend(BaseBackend, ICapVideo):
|
||||||
DESCRIPTION = 'Youporn videos website'
|
DESCRIPTION = 'Youporn videos website'
|
||||||
LICENSE = 'GPLv3'
|
LICENSE = 'GPLv3'
|
||||||
|
|
||||||
CONFIG = {}
|
|
||||||
BROWSER = YoupornBrowser
|
BROWSER = YoupornBrowser
|
||||||
|
|
||||||
def get_video(self, _id):
|
def get_video(self, _id):
|
||||||
|
|
|
||||||
|
|
@ -33,5 +33,5 @@ class PornPage(BasePage):
|
||||||
self.browser.select_form(nr=0)
|
self.browser.select_form(nr=0)
|
||||||
self.browser.submit(name='user_choice')
|
self.browser.submit(name='user_choice')
|
||||||
return False
|
return False
|
||||||
except (ControlNotFoundError,FormNotFoundError):
|
except (ControlNotFoundError, FormNotFoundError):
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,10 @@ from xml.dom import minidom
|
||||||
from weboob.core.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.weather import ICapWeather, CityNotFound, Current, Forecast
|
from weboob.capabilities.weather import ICapWeather, CityNotFound, Current, Forecast
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['YWeatherBackend']
|
||||||
|
|
||||||
|
|
||||||
class YWeatherBackend(BaseBackend, ICapWeather):
|
class YWeatherBackend(BaseBackend, ICapWeather):
|
||||||
NAME = 'yweather'
|
NAME = 'yweather'
|
||||||
MAINTAINER = 'Romain Bignon'
|
MAINTAINER = 'Romain Bignon'
|
||||||
|
|
@ -59,4 +63,5 @@ class YWeatherBackend(BaseBackend, ICapWeather):
|
||||||
int(forecast.getAttribute('low')),
|
int(forecast.getAttribute('low')),
|
||||||
int(forecast.getAttribute('high')),
|
int(forecast.getAttribute('high')),
|
||||||
forecast.getAttribute('text'),
|
forecast.getAttribute('text'),
|
||||||
'C')
|
'C',
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,12 @@
|
||||||
from .cap import ICap
|
from .cap import ICap
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['ICapDating', 'Profile']
|
__all__ = ['ICapDating']
|
||||||
|
|
||||||
|
|
||||||
class OptimizationNotFound(Exception): pass
|
class OptimizationNotFound(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Optimization(object):
|
class Optimization(object):
|
||||||
def start(self):
|
def start(self):
|
||||||
|
|
@ -31,6 +33,7 @@ class Optimization(object):
|
||||||
def stop(self):
|
def stop(self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
class StatusField(object):
|
class StatusField(object):
|
||||||
FIELD_TEXT = 0x001 # the value is a long text
|
FIELD_TEXT = 0x001 # the value is a long text
|
||||||
FIELD_HTML = 0x002 # the value is HTML formated
|
FIELD_HTML = 0x002 # the value is HTML formated
|
||||||
|
|
@ -41,6 +44,7 @@ class StatusField(object):
|
||||||
self.value = value
|
self.value = value
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
|
|
||||||
|
|
||||||
class ICapDating(ICap):
|
class ICapDating(ICap):
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -50,27 +50,42 @@ __all__ = ['BrowserIncorrectPassword', 'BrowserBanned', 'BrowserUnavailable', 'B
|
||||||
class BrowserIncorrectPassword(Exception):
|
class BrowserIncorrectPassword(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BrowserBanned(BrowserIncorrectPassword):
|
class BrowserBanned(BrowserIncorrectPassword):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BrowserUnavailable(Exception):
|
class BrowserUnavailable(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BrowserRetry(Exception):
|
class BrowserRetry(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ExpectedElementNotFound(Exception):
|
class ExpectedElementNotFound(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NoHistory(object):
|
class NoHistory(object):
|
||||||
"""
|
"""
|
||||||
We don't want to fill memory with history
|
We don't want to fill memory with history
|
||||||
"""
|
"""
|
||||||
def __init__(self): pass
|
def __init__(self):
|
||||||
def add(self, request, response): pass
|
pass
|
||||||
def back(self, n, _response): pass
|
|
||||||
def clear(self): pass
|
def add(self, request, response):
|
||||||
def close(self): pass
|
pass
|
||||||
|
|
||||||
|
def back(self, n, _response):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BasePage(object):
|
class BasePage(object):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from logging import error
|
|
||||||
|
|
||||||
from .config.yamlconfig import YamlConfig
|
from .config.yamlconfig import YamlConfig
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue