move core files to weboob.core
This commit is contained in:
parent
944662c4bf
commit
1955d1be59
25 changed files with 66 additions and 44 deletions
|
|
@ -23,7 +23,7 @@ import os
|
||||||
from logging import warning
|
from logging import warning
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.chat import ICapChat
|
from weboob.capabilities.chat import ICapChat
|
||||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||||
from weboob.capabilities.dating import ICapDating, StatusField
|
from weboob.capabilities.dating import ICapDating, StatusField
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
||||||
|
|
||||||
from .browser import BNPorc
|
from .browser import BNPorc
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
# 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 weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.travel import ICapTravel, Station, Departure
|
from weboob.capabilities.travel import ICapTravel, Station, Departure
|
||||||
|
|
||||||
from .browser import CanalTP
|
from .browser import CanalTP
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
# 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 weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
||||||
|
|
||||||
from .browser import Cragr
|
from .browser import Cragr
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.backend import BaseBackend
|
from weboob.core.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
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
|
||||||
NAME = 'dlfp'
|
NAME = 'dlfp'
|
||||||
MAINTAINER = 'Romain Bignon'
|
MAINTAINER = 'Romain Bignon'
|
||||||
EMAIL = 'romain@peerfuse.org'
|
EMAIL = 'romain@peerfuse.org'
|
||||||
VERSION = '1.0'
|
VERSION = '0.1'
|
||||||
LICENSE = 'GPLv3'
|
LICENSE = 'GPLv3'
|
||||||
DESCRIPTION = "Da Linux French Page"
|
DESCRIPTION = "Da Linux French Page"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ from __future__ import with_statement
|
||||||
|
|
||||||
from logging import warning
|
from logging import warning
|
||||||
|
|
||||||
from weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.messages import ICapMessages, Message
|
from weboob.capabilities.messages import ICapMessages, Message
|
||||||
|
|
||||||
from .browser import FourChan
|
from .browser import FourChan
|
||||||
|
|
@ -28,7 +28,7 @@ class FourChanBackend(BaseBackend, ICapMessages):
|
||||||
NAME = 'fourchan'
|
NAME = 'fourchan'
|
||||||
MAINTAINER = 'Romain Bignon'
|
MAINTAINER = 'Romain Bignon'
|
||||||
EMAIL = 'romain@peerfuse.org'
|
EMAIL = 'romain@peerfuse.org'
|
||||||
VERSION = '1.0'
|
VERSION = '0.1'
|
||||||
LICENSE = 'GPLv3'
|
LICENSE = 'GPLv3'
|
||||||
DESCRIPTION = "4chan website"
|
DESCRIPTION = "4chan website"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
# 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 weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.torrent import ICapTorrent
|
from weboob.capabilities.torrent import ICapTorrent
|
||||||
|
|
||||||
from .browser import GazelleBrowser
|
from .browser import GazelleBrowser
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
# 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 weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.video import ICapVideo
|
from weboob.capabilities.video import ICapVideo
|
||||||
|
|
||||||
from .browser import InaBrowser
|
from .browser import InaBrowser
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
# 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 weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.travel import ICapTravel, Station, Departure
|
from weboob.capabilities.travel import ICapTravel, Station, Departure
|
||||||
|
|
||||||
from .browser import Transilien
|
from .browser import Transilien
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
# 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 weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.video import ICapVideo
|
from weboob.capabilities.video import ICapVideo
|
||||||
|
|
||||||
from .browser import YoujizzBrowser
|
from .browser import YoujizzBrowser
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
# 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 weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.video import ICapVideo
|
from weboob.capabilities.video import ICapVideo
|
||||||
|
|
||||||
from .browser import YoupornBrowser
|
from .browser import YoupornBrowser
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.capabilities.video import ICapVideo
|
from weboob.capabilities.video import ICapVideo
|
||||||
|
|
||||||
from .browser import YoutubeBrowser
|
from .browser import YoutubeBrowser
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ from xml.dom import minidom
|
||||||
# TODO store datetime objects instead of strings
|
# TODO store datetime objects instead of strings
|
||||||
# from datetime import datetime
|
# from datetime import datetime
|
||||||
|
|
||||||
from weboob.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
|
||||||
|
|
||||||
class YWeatherBackend(BaseBackend, ICapWeather):
|
class YWeatherBackend(BaseBackend, ICapWeather):
|
||||||
|
|
|
||||||
19
weboob/core/__init__.py
Normal file
19
weboob/core/__init__.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright(C) 2010 Christophe Benz
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, version 3 of the License.
|
||||||
|
#
|
||||||
|
# This program 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
|
from .bcall import CallErrors
|
||||||
|
|
@ -15,13 +15,15 @@
|
||||||
# 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 copy import copy
|
from copy import copy
|
||||||
import logging
|
import logging
|
||||||
from logging import debug
|
from logging import debug
|
||||||
from threading import Thread, Event, RLock, Timer
|
from threading import Thread, Event, RLock, Timer
|
||||||
from .tools.misc import get_backtrace
|
from weboob.tools.misc import get_backtrace
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['BackendsCall', 'CallErrors']
|
__all__ = ['BackendsCall', 'CallErrors']
|
||||||
|
|
||||||
|
|
@ -22,16 +22,16 @@ from logging import warning
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from weboob.bcall import BackendsCall, CallErrors
|
from weboob.core.bcall import BackendsCall
|
||||||
from weboob.modules import ModulesLoader, BackendsConfig
|
from weboob.core.modules import ModulesLoader, BackendsConfig
|
||||||
from weboob.backend import BaseBackend
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.scheduler import Scheduler
|
from weboob.core.scheduler import Scheduler
|
||||||
|
|
||||||
if sys.version_info[:2] <= (2, 5):
|
if sys.version_info[:2] <= (2, 5):
|
||||||
import weboob.tools.property
|
import weboob.tools.property
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Weboob', 'CallErrors']
|
__all__ = ['Weboob']
|
||||||
|
|
||||||
|
|
||||||
class Weboob(object):
|
class Weboob(object):
|
||||||
|
|
@ -25,15 +25,14 @@ import os
|
||||||
import re
|
import re
|
||||||
import stat
|
import stat
|
||||||
|
|
||||||
import weboob.backends
|
from weboob.core.backend import BaseBackend
|
||||||
from weboob.backend import BaseBackend
|
|
||||||
from weboob.capabilities.cap import ICap
|
from weboob.capabilities.cap import ICap
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Module']
|
__all__ = ['Module']
|
||||||
|
|
||||||
|
|
||||||
class Module:
|
class Module(object):
|
||||||
def __init__(self, name, module):
|
def __init__(self, name, module):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.module = module
|
self.module = module
|
||||||
|
|
@ -154,12 +153,13 @@ class ModulesLoader(object):
|
||||||
return self.modules[name]
|
return self.modules[name]
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
path = weboob.backends.__path__[0]
|
import weboob.backends
|
||||||
regexp = re.compile('^%s/([\w\d_]+)$' % path)
|
for path in weboob.backends.__path__:
|
||||||
for root, dirs, files in os.walk(path):
|
regexp = re.compile('^%s/([\w\d_]+)$' % path)
|
||||||
m = regexp.match(root)
|
for root, dirs, files in os.walk(path):
|
||||||
if m and '__init__.py' in files:
|
m = regexp.match(root)
|
||||||
self.load_module('weboob.backends.%s' % m.group(1))
|
if m and '__init__.py' in files:
|
||||||
|
self.load_module('weboob.backends.%s' % m.group(1))
|
||||||
|
|
||||||
def load_module(self, name):
|
def load_module(self, name):
|
||||||
try:
|
try:
|
||||||
|
|
@ -172,8 +172,8 @@ class ModulesLoader(object):
|
||||||
else:
|
else:
|
||||||
error(msg)
|
error(msg)
|
||||||
return
|
return
|
||||||
if name in self.modules:
|
if module.get_name() in self.modules:
|
||||||
warning('Module "%s" is already loaded (%s)' % self.modules[name].module)
|
warning('Module "%s" is already loaded (%s)' % (self.modules[module.get_name()].module, name))
|
||||||
return
|
return
|
||||||
self.modules[module.get_name()] = module
|
self.modules[module.get_name()] = module
|
||||||
debug('Loaded module "%s" (%s)' % (name, module.module.__name__))
|
debug('Loaded module "%s" from %s' % (name, module.module.__path__))
|
||||||
|
|
@ -28,8 +28,8 @@ import sys
|
||||||
import logging
|
import logging
|
||||||
import asyncore
|
import asyncore
|
||||||
|
|
||||||
from weboob import Weboob
|
from weboob.core.engine import Weboob
|
||||||
from weboob.scheduler import Scheduler
|
from weboob.core.scheduler import Scheduler
|
||||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||||
from weboob.tools.application import ConsoleApplication
|
from weboob.tools.application import ConsoleApplication
|
||||||
from weboob.tools.misc import html2text, get_backtrace, utc2local
|
from weboob.tools.misc import html2text, get_backtrace, utc2local
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,10 @@
|
||||||
# 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.
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from weboob import CallErrors
|
from weboob.core import CallErrors
|
||||||
from weboob.capabilities.weather import ICapWeather, CityNotFound
|
from weboob.capabilities.weather import ICapWeather, CityNotFound
|
||||||
from weboob.tools.application import ConsoleApplication
|
from weboob.tools.application import ConsoleApplication
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import logging
|
||||||
import optparse
|
import optparse
|
||||||
from optparse import OptionGroup, OptionParser
|
from optparse import OptionGroup, OptionParser
|
||||||
|
|
||||||
from weboob import Weboob
|
from weboob.core.engine import Weboob
|
||||||
from weboob.tools.config.iconfig import ConfigError
|
from weboob.tools.config.iconfig import ConfigError
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ from optparse import OptionGroup, OptionParser
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import weboob
|
from weboob.core.bcall import CallErrors
|
||||||
from weboob.modules import BackendsConfig
|
from weboob.core.modules import BackendsConfig
|
||||||
|
|
||||||
from .base import BaseApplication
|
from .base import BaseApplication
|
||||||
from .formatters import formatters
|
from .formatters import formatters
|
||||||
|
|
@ -150,7 +150,7 @@ class ConsoleApplication(BaseApplication):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command_result = func(*args)
|
command_result = func(*args)
|
||||||
except weboob.CallErrors, errors:
|
except CallErrors, errors:
|
||||||
logging.error(errors)
|
logging.error(errors)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from weboob import Weboob
|
from weboob.core.engine import Weboob
|
||||||
from weboob.scheduler import Scheduler
|
from weboob.core.scheduler import Scheduler
|
||||||
|
|
||||||
from .console import ConsoleApplication
|
from .console import ConsoleApplication
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ from PyQt4.QtGui import QMainWindow, QApplication, QStyledItemDelegate, \
|
||||||
QStyleOptionViewItemV4, QTextDocument, QStyle, \
|
QStyleOptionViewItemV4, QTextDocument, QStyle, \
|
||||||
QAbstractTextDocumentLayout, QPalette
|
QAbstractTextDocumentLayout, QPalette
|
||||||
|
|
||||||
from weboob import Weboob
|
from weboob.core.engine import Weboob
|
||||||
from weboob.scheduler import IScheduler
|
from weboob.core.scheduler import IScheduler
|
||||||
|
|
||||||
from ..base import BaseApplication
|
from ..base import BaseApplication
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue