Newer
Older
Bezleputh
committed
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of a weboob module.
Bezleputh
committed
#
# This weboob module is free software: you can redistribute it and/or modify
Bezleputh
committed
# 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.
#
# This weboob module is distributed in the hope that it will be useful,
Bezleputh
committed
# 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 this weboob module. If not, see <http://www.gnu.org/licenses/>.
Bezleputh
committed
from weboob.tools.backend import Module
from weboob.capabilities.calendar import CapCalendarEvent, CATEGORIES
Bezleputh
committed
from .browser import SenscritiqueBrowser
from .calendar import SensCritiquenCalendarEvent
Bezleputh
committed
class SenscritiqueModule(Module, CapCalendarEvent):
Bezleputh
committed
NAME = 'senscritique'
DESCRIPTION = u'senscritique website'
MAINTAINER = u'Bezleputh'
EMAIL = 'carton_ben@yahoo.fr'
LICENSE = 'AGPLv3+'
Bezleputh
committed
ASSOCIATED_CATEGORIES = [CATEGORIES.TELE]
BROWSER = SenscritiqueBrowser
def search_events(self, query):
if self.has_matching_categories(query):
return self.list_events(query.start_date,
query.end_date)
Bezleputh
committed
def list_events(self, date_from, date_to=None):
for item in self.browser.list_events(date_from, date_to):
Bezleputh
committed
Bezleputh
committed
Bezleputh
committed
def get_event(self, _id, event=None):
return self.browser.get_event(_id, event)
Bezleputh
committed
def fill_obj(self, event, fields):
Bezleputh
committed
return self.get_event(event.id, event)
Bezleputh
committed
OBJECTS = {SensCritiquenCalendarEvent: fill_obj}