From cd1e37917660d1d424133b04330d35e114c36108 Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Mon, 1 Apr 2019 09:33:29 +0200 Subject: [PATCH] [biplan] Delete module concert hall is closing --- modules/biplan/__init__.py | 24 ------ modules/biplan/browser.py | 49 ------------ modules/biplan/calendar.py | 44 ----------- modules/biplan/favicon.png | Bin 16586 -> 0 bytes modules/biplan/module.py | 72 ----------------- modules/biplan/pages.py | 154 ------------------------------------- modules/biplan/test.py | 34 -------- 7 files changed, 377 deletions(-) delete mode 100644 modules/biplan/__init__.py delete mode 100644 modules/biplan/browser.py delete mode 100644 modules/biplan/calendar.py delete mode 100644 modules/biplan/favicon.png delete mode 100644 modules/biplan/module.py delete mode 100644 modules/biplan/pages.py delete mode 100644 modules/biplan/test.py diff --git a/modules/biplan/__init__.py b/modules/biplan/__init__.py deleted file mode 100644 index 81701c18e9..0000000000 --- a/modules/biplan/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2013 Bezleputh -# -# This file is part of a weboob module. -# -# This weboob module 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. -# -# This weboob module 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 this weboob module. If not, see . - - -from .module import BiplanModule - - -__all__ = ['BiplanModule'] diff --git a/modules/biplan/browser.py b/modules/biplan/browser.py deleted file mode 100644 index 5596593e6a..0000000000 --- a/modules/biplan/browser.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2013 Bezleputh -# -# This file is part of a weboob module. -# -# This weboob module 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. -# -# This weboob module 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 this weboob module. If not, see . - - -from weboob.browser import PagesBrowser, URL - -from .pages import ProgramPage, EventPage - -__all__ = ['BiplanBrowser'] - - -class BiplanBrowser(PagesBrowser): - BASEURL = 'https://www.lebiplan.org' - - program_page = URL('/fr/biplan-prog-(?P<_category>.*).php', ProgramPage) - event_page = URL('/(?P<_id>.*).html', EventPage) - - def list_events_concert(self, date_from, date_to=None, city=None, categories=None): - return self.program_page.go(_category='concert').list_events(date_from=date_from, - date_to=date_to, - city=city, - categories=categories, - is_concert=True) - - def list_events_theatre(self, date_from, date_to=None, city=None, categories=None): - return self.program_page.go(_category='theatre').list_events(date_from=date_from, - date_to=date_to, - city=city, - categories=categories, - is_concert=False) - - def get_event(self, _id, event=None): - return self.event_page.go(_id=_id).get_event(obj=event) diff --git a/modules/biplan/calendar.py b/modules/biplan/calendar.py deleted file mode 100644 index 01a258fa5f..0000000000 --- a/modules/biplan/calendar.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2013 Bezleputh -# -# This file is part of a weboob module. -# -# This weboob module 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. -# -# This weboob module 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 this weboob module. If not, see . - -from weboob.capabilities.calendar import BaseCalendarEvent, TRANSP, STATUS, CATEGORIES - - -class BiplanCalendarEvent(BaseCalendarEvent): - - def __init__(self): - BaseCalendarEvent.__init__(self) - self.city = u'LILLE' - self.location = u'19, rue Colbert' - self.sequence = 1 - self.transp = TRANSP.TRANSPARENT - self.status = STATUS.CONFIRMED - self.timezone = u'Europe/Paris' - - -class BiplanCalendarEventConcert(BiplanCalendarEvent): - def __init__(self): - BiplanCalendarEvent.__init__(self) - self.category = CATEGORIES.CONCERT - - -class BiplanCalendarEventTheatre(BiplanCalendarEvent): - def __init__(self): - BiplanCalendarEvent.__init__(self) - self.category = CATEGORIES.THEATRE diff --git a/modules/biplan/favicon.png b/modules/biplan/favicon.png deleted file mode 100644 index e2f65474828f1c926e91af8c3b221178dbad497a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16586 zcmb8$2l%&B`2g_qzDD*gGhSO$Q7J|C3Q1I2$d%QwB^hsjt_#^J2}y*ggcc3TXlIX7 zDLbQ*22#%d{@kzo`9JTkpY%W1_57aatoz*izRx+|-%(p_x$(SnEiqSXZQe~c*Uri$&wKoi^Eei`EWYv9;-kwf01h_XDl% z_p;U=+@ZBKPibw@Jx<#GnvDY3R-10H?luQZY3r&uGF;$;;-g*1R8*ki=nP;AP`Vvbl(Y1lO z!U`+&g%@5pzn5EXxjy&YbLaQUE3e#VnPrw-|AjAnVYcZr-aI%NKV{04ti!41TGtxp z8#{IC)Wm15x#r5cHaIT7{PKOl1s5E~X!k6+y#3=J|43NDz!pTdzy0lRy4oU( zERx?~kL!Q```@z;=cSiky8Y=-f6B)?*0BDv%PyO1Jo@OPZR(9T-q;ZH+~+>7W|NQ5y7jqD+U{pxB!4FOffq=KnGRq{)67tjs zAAB$+2LYX-LOH=71Ve_D5e0}g3j&6#>JY*R+$TZIvN$Or77`FvNDwo?D5+Sp`e~ZE z#(;x)U>Nh*V~=GU<{?0_o~M`tCe1akh&Rr9=(z8```RD=@CQv*oL48o#~*(@>lVdCjCjEdUXX->XHnAAjwrAYWKGhAuy%NmoH|CrqtqWG z%~NQketk5@xRR#1;WKjW(gt%DUwrX2!QcJvcRANO3Z~Bzh)?$cAYyReV)M^Ge{xnk zZbBI1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_sD5jhOCqs(O07VEhlFZ;;b6R{2sRGm5R6H_;X_M&!w+7?q;i-vmC!^g zO!iGnX|0TN2&Mp3frN<#MBSp8B5A=O1#yUy>f$tHAPgaeYEwJ07km<-QTok8AfyVO zx^e2(^yr6dsXa-8qpz5gi^U&f;R$x(4knzza8N2l!?!ZW89}okjNS#nLJIpPU3On> z7y>Z`GfH*G%%l~?5bcmt5NQnvVxFRoIJS&&`beG$nX8{VE9&rJehQr61|PdVW~{An z)#o3+j4v4GP0D~Gz+~Tm0ZhekQX6R(0n?^U%QlE35D^LuC|K&|f>lMG-!R5n1yjPq zRLnQVItU?x>grNze4ERu(Zu}t&7Wk8MNKce&?y!Y)N+;Q7!dmewMmQ6R@a)S%k+u?uy7kmJN A0{{R3 diff --git a/modules/biplan/module.py b/modules/biplan/module.py deleted file mode 100644 index 7d647b9b32..0000000000 --- a/modules/biplan/module.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2013 Bezleputh -# -# This file is part of a weboob module. -# -# This weboob module 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. -# -# This weboob module 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 this weboob module. If not, see . - - -from weboob.tools.backend import Module -from weboob.capabilities.calendar import CapCalendarEvent, CATEGORIES -import itertools - -from .browser import BiplanBrowser -from.calendar import BiplanCalendarEvent - -__all__ = ['BiplanModule'] - - -class BiplanModule(Module, CapCalendarEvent): - NAME = 'biplan' - DESCRIPTION = u'lebiplan.org website' - MAINTAINER = u'Bezleputh' - EMAIL = 'carton_ben@yahoo.fr' - LICENSE = 'AGPLv3+' - VERSION = '1.6' - ASSOCIATED_CATEGORIES = [CATEGORIES.CONCERT, CATEGORIES.THEATRE] - BROWSER = BiplanBrowser - - def search_events(self, query): - if self.has_matching_categories(query): - theatre_events = [] - concert_events = [] - if CATEGORIES.CONCERT in query.categories: - concert_events = self.browser.list_events_concert(query.start_date, - query.end_date, - query.city, - query.categories) - if CATEGORIES.THEATRE in query.categories: - theatre_events = self.browser.list_events_theatre(query.start_date, - query.end_date, - query.city, - query.categories) - - items = list(itertools.chain(concert_events, theatre_events)) - items.sort(key=lambda o: o.start_date) - return items - - def list_events(self, date_from, date_to=None): - items = list(itertools.chain(self.browser.list_events_concert(date_from, date_to), - self.browser.list_events_theatre(date_from, date_to))) - items.sort(key=lambda o: o.start_date) - return items - - def get_event(self, _id): - return self.browser.get_event(_id) - - def fill_obj(self, event, fields): - return self.browser.get_event(event.id, event) - - OBJECTS = {BiplanCalendarEvent: fill_obj} diff --git a/modules/biplan/pages.py b/modules/biplan/pages.py deleted file mode 100644 index ce86595c8c..0000000000 --- a/modules/biplan/pages.py +++ /dev/null @@ -1,154 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2013 Bezleputh -# -# This file is part of a weboob module. -# -# This weboob module 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. -# -# This weboob module 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 this weboob module. If not, see . - -from __future__ import unicode_literals - -import re -from datetime import datetime, time - -import weboob.tools.date as date_util -from .calendar import BiplanCalendarEventConcert, BiplanCalendarEventTheatre - -from weboob.browser.elements import ItemElement, SkipItem, ListElement, method -from weboob.browser.pages import HTMLPage -from weboob.browser.filters.standard import Filter, CleanText, Env, Regexp, CombineDate -from weboob.browser.filters.html import Link, CleanHTML - - -class BiplanPrice(Filter): - def filter(self, el): - index = 1 if len(el) > 1 else 0 - content = CleanText.clean(CleanText('.', ['HORAIRES'])(el[index])) - a_price = content.split(' - ')[-1] - parsed_price = re.findall(r"\d*\,\d+|\d+", " ".join(a_price)) - - if parsed_price and len(parsed_price) > 0: - return float(parsed_price[0].replace(',', '.')) - - return float(0) - - -class BiplanDate(Filter): - def filter(self, el): - content = CleanText.clean(CleanText(CleanHTML('.'), ['*'])(el[0])) - a_date = content[0:content.index(' - ')] - - for fr, en in date_util.DATE_TRANSLATE_FR: - a_date = fr.sub(en, a_date) - - try: - _month = datetime.strptime(a_date, "%A %d %B").month - if (datetime.now().month > _month): - a_date += u' %i' % (datetime.now().year + 1) - else: - a_date += u' %i' % (datetime.now().year) - except ValueError: - pass - - return datetime.strptime(a_date, "%A %d %B %Y") - - -class StartTime(Filter): - def filter(self, el): - index = 1 if len(el) > 1 else 0 - content = CleanText.clean(CleanText('.', ['HORAIRES'])(el[index])) - _content = content.split(' - ') - a_time = _content[2] if len(_content) > 2 else _content[0] - regexp = re.compile(r'(?P\d+)h?(?P\d+)') - m = regexp.search(a_time) - if m: - return time(int(m.groupdict()['hh'] or 0), int(m.groupdict()['mm'] or 0)) - return time(0, 0) - - -class EndTime(Filter): - def filter(self, el): - return time.max - - -class ProgramPage(HTMLPage): - - @method - class list_events(ListElement): - item_xpath = '//div[@class="ligne"]' - - class item(ItemElement): - def klass(self): - return BiplanCalendarEventConcert() if self.env['is_concert'] else BiplanCalendarEventTheatre() - - def condition(self): - return (self.el.xpath('./div') and CleanText('./div/a/img/@src')(self)[-1] != '/') - - def validate(self, obj): - return (self.is_valid_event(obj, self.env['city'], self.env['categories']) and - self.is_event_in_valid_period(obj.start_date, self.env['date_from'], self.env['date_to'])) - - def is_valid_event(self, event, city, categories): - if city and city != '' and city.upper() != event.city.upper(): - return False - - if categories and len(categories) > 0 and event.category not in categories: - return False - - return True - - def is_event_in_valid_period(self, event_date, date_from, date_to): - if event_date >= date_from: - if not date_to: - return True - else: - if event_date <= date_to: - return True - return False - - obj_id = Regexp(Link('./div/a'), '/(.*?).html') - obj_start_date = CombineDate(BiplanDate('div/div/b'), StartTime('div/div/b')) - obj_end_date = CombineDate(BiplanDate('div/div/b'), EndTime('.')) - obj_price = BiplanPrice('div/div/b') - obj_summary = CleanText("div/div/div/a/strong") - - -class EventPage(HTMLPage): - - encoding = u'utf-8' - - @method - class get_event(ItemElement): - klass = BiplanCalendarEventConcert if Env('is_concert') else BiplanCalendarEventTheatre - - def parse(self, el): - _div = "//div/div/div[@id='popup']" - div = el.xpath("%s" % _div)[0] - if self.obj.id: - event = self.obj - event.url = self.page.url - event.description = CleanHTML("%s/div/div[@class='presentation-popup']" % _div)(self) - raise SkipItem() - - self.env['is_concert'] = (div.attrib['class'] != 'theatre-popup') - self.env['url'] = self.page.url - - obj_id = Env('_id') - base = "//div[@id='popup']" - obj_price = BiplanPrice("%s/div/b" % base) - obj_start_date = CombineDate(BiplanDate("%s/div/b" % base), StartTime("%s/div/b" % base)) - obj_end_date = CombineDate(BiplanDate("%s/div/b" % base), EndTime(".")) - obj_url = Env('url') - obj_summary = CleanText('%s/div/div/span' % base) - obj_description = CleanHTML('%s/div/div[@class="presentation-popup"]' % base) diff --git a/modules/biplan/test.py b/modules/biplan/test.py deleted file mode 100644 index cf7fedb49e..0000000000 --- a/modules/biplan/test.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2013 Bezleputh -# -# This file is part of a weboob module. -# -# This weboob module 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. -# -# This weboob module 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 this weboob module. If not, see . - -from datetime import datetime - -from weboob.tools.test import BackendTest, SkipTest - - -class BiplanTest(BackendTest): - MODULE = 'biplan' - - def test_biplan_list(self): - if datetime.now() > datetime(datetime.now().year, 7, 14) and datetime.now() < datetime(datetime.now().year, 9, 15): - raise SkipTest("Fermeture estivale") - l = list(self.backend.list_events(datetime.now())) - assert len(l) - event = self.backend.get_event(l[0].id) - self.assertTrue(event.url, 'URL for event "%s" not found: %s' % (event.id, event.url)) -- GitLab