Example #1
0
from datetime import timedelta
from utils.utils import get_dom, on_workdays, months_hu_capitalized
from plugin import EbedkePlugin

URL = "https://divinporcello.hu/napi-menu"


@on_workdays
def getMenu(today):
    dom = get_dom(URL)
    #date = f"{months_hu_capitalized[today.month - 1]} {today.day:02}"
    menu = dom.xpath("/html/body//img[contains(@src, 'heti')]/@src")

    return menu


plugin = EbedkePlugin(enabled=False,
                      name='Divin Porcello',
                      id='dp',
                      url=URL,
                      downloader=getMenu,
                      ttl=timedelta(hours=24),
                      cards=[],
                      groups=["ferenciek"])
Example #2
0
def get_menu(today):
    dom = get_dom(URL)
    menu_week_number = dom.xpath(
        "/html/body//div[@class='itemBody']//h2[@class='itemTitle']//text()")
    menu_week_number = ''.join(char for char in ''.join(menu_week_number)
                               if char.isnumeric())
    _, current_week_number, _ = today.date().isocalendar()

    if menu_week_number == str(current_week_number):
        week_menu = dom.xpath(
            "/html/body//div[@class='itemBody']//div[@class='heti-menu']//text()"
        )
        lower = lambda line: remove_accents(line).lower()
        menu = pattern_slice(week_menu, [days_lower_ascii[today.weekday()]],
                             days_lower_ascii,
                             modifier=lower)
    else:
        menu = []

    return menu


plugin = EbedkePlugin(enabled=True,
                      groups=["ferenciek"],
                      name="MagyarQTR",
                      id="mqtr",
                      url=URL,
                      downloader=get_menu,
                      ttl=timedelta(hours=24),
                      cards=[])
Example #3
0
from datetime import timedelta
from utils.utils import get_dom, on_workdays, months_hu_capitalized
from plugin import EbedkePlugin

URL = "http://vigvarju.vakvarju.com/deli-menu/"

@on_workdays
def getMenu(today):
    dom = get_dom(URL)
    date = f"{months_hu_capitalized[today.month - 1]} {today.day}"
    menu = dom.xpath(f'/html/body//p[contains(preceding-sibling::p, "{date}")]/text()')
    menu = list(dish.strip() for dish in menu)

    return menu

plugin = EbedkePlugin(
    enabled=True,
    groups=["ferenciek"],
    name='Víg Varjú',
    id='vv',
    url=URL,
    downloader=getMenu,
    ttl=timedelta(hours=23),
    cards=[]
)
Example #4
0
URL = "https://www.facebook.com/PortumCorvin/posts/"
FB_ID = "728866253985071"


@on_workdays
def getMenu(today):
    is_this_week = lambda date: datetime.strptime(
        date, '%Y-%m-%dT%H:%M:%S%z').date() > today.date() - timedelta(days=7)
    menu_filter = lambda post: is_this_week(post['created_time']) and \
        any(word in post['message'].lower() for word in ["lunch menü ", "business lunch", "előételek", "déli menü", "heti menü", "menünk"])
    menu = get_filtered_fb_post(FB_ID, menu_filter)
    drop_words = [
        "előételek", "főételek", "desszer", "étvágy", "menü", "lunch"
    ]
    menu = skip_empty_lines(
        filter(lambda l: not any(word in l.lower() for word in drop_words),
               menu.splitlines()))
    menu = pattern_slice(menu, [""], ["---", "broth", "soup"], inclusive=True)

    return list(menu)


plugin = EbedkePlugin(enabled=True,
                      groups=["corvin"],
                      name='Portum',
                      id='pt',
                      url=URL,
                      downloader=getMenu,
                      ttl=timedelta(hours=23),
                      cards=[])
Example #5
0
@on_workdays
def getMenu(today):
    is_this_week = lambda date: datetime.strptime(
        date, '%Y-%m-%dT%H:%M:%S%z').date() > today.date() - timedelta(days=7)
    is_today = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z'
                                              ).date() == today.date()

    menu_filter = lambda post: (is_this_week(post['created_time'])
                               and days_lower[today.weekday()] in post['message'].lower()
                               and "asztalfoglalás" not in post['message'].lower()) \
                               or ("menü" in post['message'].lower()
                                    and is_today(post['created_time'])
                                    and "asztalfoglalás" not in post['message'].lower())

    menu = get_filtered_fb_post(FB_ID, menu_filter)
    menu = pattern_slice(menu.splitlines(),
                         [days_lower[today.weekday()], "mai", "menü"],
                         days_lower + ["ár:"])

    return list(skip_empty_lines(menu))


plugin = EbedkePlugin(enabled=True,
                      groups=["szell"],
                      name='Kubala Barcelona',
                      id='kbarc',
                      url=FB_PAGE,
                      downloader=getMenu,
                      ttl=timedelta(hours=23),
                      cards=[])
Example #6
0
from datetime import timedelta
from utils.utils import get_dom, on_workdays, months_hu_capitalized
from plugin import EbedkePlugin


URL = "https://www.kiosk-budapest.hu/"

@on_workdays
def get_menu(today):
    dom = get_dom(URL)
    weeklymenu = dom.xpath("/html/body//div[contains(@class, 'hetimenupluginbox')]")
    clean = lambda text: '\n'.join(n.strip() for n in text)
    weeklymenu = {
        clean(day.xpath("./div[@class='datum']//text()")): clean(day.xpath("./div[@class='hetimenulist']//text()"))
        for day in weeklymenu
    }

    date = f"{months_hu_capitalized[today.month - 1]} {today.day:02}."
    return weeklymenu[date.lower()].splitlines()

plugin = EbedkePlugin(
    enabled=True,
    groups=["ferenciek"],
    name='KIOSK',
    id='kio',
    url=URL,
    downloader=get_menu,
    ttl=timedelta(hours=23),
    cards=[]
)
Example #7
0
from datetime import timedelta
from utils.utils import get_dom, on_workdays
from plugin import EbedkePlugin

URL = "http://dezsoba.hu/hu/heti-menue"


@on_workdays
def getMenu(today):
    day = today.weekday()
    dom = get_dom(URL)
    menu = dom.xpath('/html/body//div[@class="sppb-menu-text"]')
    if len(menu) < 4:
        menu = []
    else:
        menu = menu[day].xpath("text()")

    return menu


plugin = EbedkePlugin(enabled=True,
                      name='Dezső bá',
                      id='db',
                      url=URL,
                      downloader=getMenu,
                      ttl=timedelta(minutes=20),
                      cards=[],
                      groups=["corvin"])
Example #8
0
from plugin import EbedkePlugin

FB_PAGE = "https://www.facebook.com/pg/bocellipizzeria/posts/"
FB_ID = "401839609844340"


@on_workdays
def getMenu(today):
    is_today = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z'
                                              ).date() == today.date()
    menu_keywords = ["chef", "ajánlat", "1490", "1390", ",-", ".-", "ára"]

    menu_filter = lambda post: is_today(post['created_time']) and any(
        word in post['message'].lower() for word in menu_keywords)

    menu = get_filtered_fb_post(FB_ID, menu_filter)
    menu = (line for line in menu.splitlines()
            if not any(word in line.lower() for word in menu_keywords))

    return menu


plugin = EbedkePlugin(enabled=True,
                      name="Bocelli Pizzeria Italia",
                      id="boc",
                      url=FB_PAGE,
                      downloader=getMenu,
                      ttl=timedelta(hours=23),
                      cards=[],
                      groups=["szell"])
Example #9
0
    ignore_hashtags = lambda post: " ".join(word.lower()
                                            for word in post.split()
                                            if word[0] != "#")
    daily_menu_filter = lambda post: is_today(post['created_time']) \
                            and "menü" in post['message'].lower()
    weekly_menu_filter = lambda post: is_this_week(post['created_time']) \
                            and days_lower[day] in ignore_hashtags(post['message'])
    weekly_menu = get_filtered_fb_post(FB_ID, weekly_menu_filter)
    if weekly_menu:
        menu = pattern_slice(
            weekly_menu.splitlines(), [days_lower[day]],
            days_lower + ["sütiket", "#", "jó étvágyat", "mai menü"])
    else:
        menu_post = get_filtered_fb_post(FB_ID, daily_menu_filter).splitlines()
        menu = []
        for i, line in enumerate(menu_post):
            if "A:" in line:
                menu = list((menu_post[i - 1], menu_post[i], menu_post[i + 1]))
                break
    return menu


plugin = EbedkePlugin(enabled=True,
                      groups=["corvin"],
                      name='Kompót',
                      id='kp',
                      url=FB_PAGE,
                      downloader=getMenu,
                      ttl=timedelta(hours=24),
                      cards=['szep'])
Example #10
0

@on_workdays
def get_menu(today):
    dom = get_dom(URL)
    date = dom.xpath(
        f"/html/body//div/h2[contains(text(), {today.year})]/text()")
    date = date.pop() if date else None
    date = datetime.strptime(date.split("-")[0], "%Y.%m.%d")

    if date <= today < date + timedelta(days=6):
        menu = dom.xpath("/html/body//div[p and ul]//text()")
    else:
        menu = []

    drop_words = ["fogásos"]
    menu = filter(
        lambda line: not any(word in line.lower() for word in drop_words),
        menu)
    return menu


plugin = EbedkePlugin(enabled=True,
                      name='Input bar',
                      id='ib',
                      url=URL,
                      downloader=get_menu,
                      ttl=timedelta(hours=24),
                      cards=["szep"],
                      groups=["corvin"])
Example #11
0
        day = today.weekday()
        remove_accents = lambda word: normalize('NFD', word).encode(
            'ascii', 'ignore')
        menu = islice(
            dropwhile(
                lambda l: remove_accents(days_lower[day]) not in
                remove_accents(l.lower()), menu), 1, None)
        menu = takewhile(
            lambda l: not any(word in l.lower() for word in days_lower), menu)
        skip_words = ["menu", "menü", "fitnesz"] + days_lower
        menu = list(
            map(
                lambda l: l.replace("|", "").strip(),
                filter(
                    lambda l: not any(word in l.lower()
                                      for word in skip_words), menu)))
        menu = sorted(set(menu), key=menu.index)
        return menu
    else:
        return []


plugin = EbedkePlugin(enabled=False,
                      name="CBA Corvin",
                      id="cc",
                      url=FB_PAGE,
                      downloader=get_menu,
                      ttl=timedelta(hours=24),
                      cards=['szep', 'erzs'],
                      groups=["corvin"])
Example #12
0
from plugin import EbedkePlugin

URL = "http://www.jedermann.hu/#napi"


@on_workdays
def get_menu(today):
    dom = get_dom(URL, force_utf8=True)
    menudate = ''.join(dom.xpath('/html/body//div[@id="datum"]//text()'))
    start_month, start_day, *_ = split(" |-", menudate)
    menu_start_date = date(today.year, parse_hungarian_month(start_month),
                           int(start_day))
    if menu_start_date <= today.date() < menu_start_date + timedelta(days=7):
        menu = dom.xpath(
            '/html/body//div[preceding-sibling::div[@id="datum"]]//article[@class="lmenu"]//text()'
        )
        menu = pattern_slice(menu, [days_lower[today.weekday()]], days_lower)
    else:
        menu = []
    return menu


plugin = EbedkePlugin(enabled=True,
                      groups=["corvin"],
                      name="Jedermann",
                      id="jdr",
                      url=URL,
                      downloader=get_menu,
                      ttl=timedelta(hours=24),
                      cards=[])
Example #13
0
FB_ID = "235959913862289"


@on_workdays
def get_menu(today):
    is_this_week = lambda date: datetime.strptime(
        date, '%Y-%m-%dT%H:%M:%S%z').date() >= today.date() - timedelta(days=7)
    menu_filter = lambda post: is_this_week(post[
        'created_time']) and days_lower[today.weekday()] in post['message'
                                                                 ].lower()
    menu = get_filtered_fb_post(FB_ID, menu_filter)
    menu = pattern_slice(menu.splitlines(), [days_lower[today.weekday()]],
                         days_lower,
                         inclusive=True)
    menulist = []
    for line in menu:
        line = line.split(":", maxsplit=1)[1] if ':' in line else line
        menulist.append(line)

    return menulist


plugin = EbedkePlugin(enabled=True,
                      groups=["szell"],
                      name='Pasta Fresca Buda',
                      id='pfr',
                      url=FB_PAGE,
                      downloader=get_menu,
                      ttl=timedelta(hours=23),
                      cards=[])
Example #14
0
from datetime import timedelta
from utils.utils import get_dom, on_workdays
from plugin import EbedkePlugin


URL = "https://www.marcelloetterem.hu"

@on_workdays
def getMenu(today):
    dom = get_dom(URL)
    date = f"{today.month:02}.{today.day:02}"
    menu = dom.xpath(f"/html/body//div[.//a[contains(text(), '{date}')]]/p//text()")
    menu = [m.capitalize() for m in menu[:3]]
    return menu

plugin = EbedkePlugin(
    enabled=True,
    groups=["moricz"],
    name='Marcello',
    id='mrc',
    url=URL,
    downloader=getMenu,
    ttl=timedelta(hours=24),
    cards=["szep", "erzs"]
)
Example #15
0
FB_ID = "271018510265811"


@on_workdays
def getMenu(today):
    is_today = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z'
                                              ).date() == today.date()
    menu_keywords = ["mai menü", "napi menü", days_lower[today.weekday()]]

    menu_filter = lambda post: is_today(post['created_time']) and any(
        word in post['message'].lower() for word in menu_keywords)
    menu = get_filtered_fb_post(FB_ID, menu_filter)
    drop_words = [
        "11:00", "1590", "mindenkit", "minden menü", "étlapunk", "csodás",
        days_lower[today.weekday()]
    ]
    menu = (line for line in menu.splitlines()
            if not any(word in line.lower() for word in drop_words))

    return list(skip_empty_lines(menu))


plugin = EbedkePlugin(enabled=True,
                      groups=["corvin"],
                      name='Seastars',
                      id='sst',
                      url=FB_PAGE,
                      downloader=getMenu,
                      ttl=timedelta(hours=23),
                      cards=[])
Example #16
0
from datetime import timedelta
from itertools import dropwhile, islice
from utils.utils import get_dom, days_lower, skip_empty_lines, on_workdays
from plugin import EbedkePlugin

URL = "http://www.golvonalbisztro.hu/heti-menuajanlat.html"


@on_workdays
def getMenu(today):
    day = today.weekday()
    dom = get_dom(URL)
    menu = dom.xpath(
        "/html/body//div[@class='fck']/*[self::h3 or self::p]//text()")
    menu = dropwhile(lambda line: days_lower[day] not in line.lower(), menu)
    menu = islice(skip_empty_lines(menu), 1, 3)
    menu = list(menu)

    return menu


plugin = EbedkePlugin(enabled=True,
                      name='Gólvonal',
                      id='gv',
                      url=URL,
                      downloader=getMenu,
                      ttl=timedelta(hours=1),
                      cards=[],
                      groups=["corvin"])
Example #17
0
from datetime import datetime as dt, timedelta
from utils.utils import get_filtered_fb_post, on_workdays
from plugin import EbedkePlugin

FB_PAGE = "https://www.facebook.com/pg/Foodie-MinuteBistro-494549960697458/posts"
FB_ID = "494549960697458"


@on_workdays
def getMenu(today):
    is_today = lambda date: dt.strptime(date, '%Y-%m-%dT%H:%M:%S%z').date(
    ) == today.date()
    menu_filter = lambda post: is_today(post[
        'created_time']) and "leveseink" in post['message'].lower()
    dailymenu = get_filtered_fb_post(FB_ID, menu_filter)
    menu = [
        line for line in dailymenu.splitlines() if line.strip().startswith('-')
    ]
    return menu


plugin = EbedkePlugin(enabled=True,
                      name='Foodie',
                      id='fd',
                      url=FB_PAGE,
                      downloader=getMenu,
                      ttl=timedelta(hours=24),
                      cards=['szep', 'erzs'],
                      groups=["corvin"])
Example #18
0
def get_menu(today):
    is_this_week = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z').date() >= today.date() - timedelta(days=7)
    menu_filter = lambda post: is_this_week(post['created_time']) and "heti menü" in post['message'].lower()
    image = get_fb_post_attached_image(FB_ID, menu_filter)
    if image:
        image = Image.open(BytesIO(image)).convert('L')
        f = BytesIO()
        image.save(f, format="png", optimize=True)
        menu = ocr_image(f).splitlines()
        if not menu:
            return []

        menu = pattern_slice(menu, [days_lower[today.weekday()]], days_lower + ['desszert', "890"], inclusive=False)
        menu = list(skip_empty_lines(menu))
    else:
        return []

    return menu


plugin = EbedkePlugin(
    enabled=True,
    groups=["corvin"],
    name='Kerova',
    id='kv',
    url=FB_PAGE,
    downloader=get_menu,
    ttl=timedelta(hours=23),
    cards=[]
)
Example #19
0
from plugin import EbedkePlugin

URL = "http://muzikum.hu/heti-menu/"

@on_workdays
def getMenu(today):
    day = today.weekday()
    dom = get_dom(URL)
    date = dom.xpath('//div[@class="content-right"]//h2/text()')
    date = date[0].strip().split('|')[1].strip()[:5]
    date = datetime.strptime(f'{ today.year }.{ date }', '%Y.%m.%d').date()
    if date > today.date() - timedelta(days=7):
        menu = dom.xpath('//div[@class="content-right"]//div/p[not(span)]')
        menu = menu[day].text_content().splitlines()
    else:
        menu = []

    return menu


plugin = EbedkePlugin(
    enabled=True,
    groups=["corvin"],
    name='Muzikum',
    id='mz',
    url=URL,
    downloader=getMenu,
    ttl=timedelta(hours=23),
    cards=['szep']
)
Example #20
0
@on_workdays
def getMenu(today):
    today = today.strftime("%Y-%m-%d")
    dom = get_dom(PQS_MENU)
    column = 0
    for i, th in enumerate(dom.xpath('//table[@id="menu"]/thead//th')):
        text = ''.join(th.xpath('text()'))
        if today in text:
            column = i + 1
    texts = dom.xpath('//*[@id="menu"]//tr[th[contains(text(),"enü") '
                      'or contains(text(),"őztje") '
                      'or contains(text(),"eves")]]'
                      f'/following-sibling::tr[1]/td[{ column }]/ul//text()')
    menu = ''.join(texts)
    menu = menu.replace("Választott leves", "")
    menu = menu.replace("\t", "")
    menu = list(i for i in menu.splitlines() if i)

    return menu


plugin = EbedkePlugin(enabled=True,
                      groups=["corvin"],
                      name='PQS Skypark',
                      id='pq',
                      url=PQS_MENU,
                      downloader=getMenu,
                      ttl=timedelta(hours=6),
                      cards=['szep'])
Example #21
0
from datetime import timedelta, datetime
from utils.utils import get_filtered_fb_post, days_lower, on_workdays, pattern_slice
from plugin import EbedkePlugin

FB_PAGE = "https://www.facebook.com/pg/gilicekonyha/posts/"
FB_ID = "910845662306901"

@on_workdays
def get_menu(today):
    is_this_week = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z').date() >= today.date() - timedelta(days=7)
    menu_filter = lambda post: is_this_week(post['created_time']) and "jelmagyarázat" in post['message'].lower()
    menu = get_filtered_fb_post(FB_ID, menu_filter)
    menu = pattern_slice(menu.splitlines(), [days_lower[today.weekday()]], days_lower, inclusive=False)

    return menu


plugin = EbedkePlugin(
    enabled=True,
    name='Gólya',
    id='gl',
    url=FB_PAGE,
    downloader=get_menu,
    ttl=timedelta(hours=18),
    cards=['szep'],
    groups=["corvin"]
)
Example #22
0
from datetime import datetime, timedelta
from utils.utils import get_filtered_fb_post, on_workdays, skip_empty_lines
from plugin import EbedkePlugin

FB_PAGE = "https://www.facebook.com/szatyorbar/posts"
FB_ID = "140232679345332"


@on_workdays
def get_menu(today):
    is_today = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z'
                                              ).date() == today.date()
    menu_filter = lambda post: is_today(post[
        'created_time']) and "menü" in post['message'].lower()
    menu = get_filtered_fb_post(FB_ID, menu_filter).splitlines()
    menu = list(
        skip_empty_lines(line.strip() for line in menu
                         if "menü" not in line.lower()))

    return menu


plugin = EbedkePlugin(enabled=True,
                      groups=["moricz"],
                      name='Szatyor',
                      id='sz',
                      url=FB_PAGE,
                      downloader=get_menu,
                      ttl=timedelta(hours=23),
                      cards=[])
Example #23
0
from datetime import timedelta
from utils.utils import get_dom, skip_empty_lines, on_workdays
from plugin import EbedkePlugin

URL = "http://semmiextra.hu/bartok-bela-ut-etterem#heti-menu"


@on_workdays
def getMenu(today):
    dom = get_dom(URL)
    menu = dom.xpath(
        "/html/body//div[@id='heti-menu']//ul[@class='dotted']/li/text()")
    menu = list(skip_empty_lines(menu))

    return menu


plugin = EbedkePlugin(enabled=True,
                      groups=["moricz", "szepvolgyi"],
                      name='Semmi Extra',
                      id='se',
                      url=URL,
                      downloader=getMenu,
                      ttl=timedelta(hours=4),
                      cards=['erzs'])
Example #24
0
from utils.utils import get_filtered_fb_post, on_workdays
from plugin import EbedkePlugin

FB_PAGE = "https://www.facebook.com/pg/Dagoba-bisztró-1742309292469507/posts"
FB_ID = "1742309292469507"


@on_workdays
def get_menu(today):
    is_today = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z'
                                              ).date() == today.date()
    menu_heuristic = lambda msg: msg.count(':') + msg.count('+') >= 3
    menu_filter = lambda post: is_today(post['created_time']
                                        ) and menu_heuristic(post['message'])
    menu = get_filtered_fb_post(FB_ID, menu_filter).splitlines()
    drop = lambda l: l.strip().endswith((':', '!', '.', ','))
    for i in (n for n in (0, -1) if menu and drop(menu[n])):
        menu.pop(i)

    return menu


plugin = EbedkePlugin(enabled=True,
                      name='Dagoba',
                      id='dg',
                      url=FB_PAGE,
                      downloader=get_menu,
                      ttl=timedelta(hours=23),
                      cards=[],
                      groups=["corvin"])
Example #25
0
from utils.utils import get_filtered_fb_post, on_workdays, skip_empty_lines
from plugin import EbedkePlugin

FB_PAGE = "https://www.facebook.com/aranytacsko/"
FB_ID = "211285456287124"


@on_workdays
def get_menu(today):
    is_today = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z'
                                              ).date() == today.date()
    menu_filter = lambda post: is_today(post['created_time']) and \
        any(word in post['message'].lower() for word in ["ebédmenü", "ebéd menü", "mai menü", "déli menü", "mai ebéd", "ajánlat"])
    menu = get_filtered_fb_post(FB_ID, menu_filter)
    drop_words = ["ajánlat", "tacskó", "ebéd", "menü", "="]
    menu = list(
        skip_empty_lines(
            filter(lambda l: not any(word in l.lower() for word in drop_words),
                   menu.splitlines())))
    return menu


plugin = EbedkePlugin(enabled=True,
                      groups=["corvin"],
                      name='Arany Tacskó bistro',
                      id='tc',
                      url=FB_PAGE,
                      downloader=get_menu,
                      ttl=timedelta(hours=23),
                      cards=[])
Example #26
0
FB_PAGE = "https://www.facebook.com/Finomfalat17/"
FB_ID = "270764739711603"


def fb_filter(post, today):
    created = datetime.strptime(post['created_time'], '%Y-%m-%dT%H:%M:%S%z')
    trigger_words = ["ajánlatunk", "leves"]
    triggered = any(word in post["message"].lower() for word in trigger_words)
    return created.date() == today.date() and triggered


@on_workdays
def get_menu(today):
    fbfilter = lambda post: fb_filter(post, today)
    menu = get_filtered_fb_post(FB_ID, fbfilter)
    drop_words = ["ajánlatunk"]
    menu = filter(
        lambda line: not any(word in line.lower() for word in drop_words),
        menu.splitlines())
    return menu


plugin = EbedkePlugin(enabled=True,
                      name='Finom Falat',
                      id='fifa',
                      url=FB_PAGE,
                      downloader=get_menu,
                      ttl=timedelta(hours=24),
                      cards=[],
                      groups=["ferenciek"])
Example #27
0
from datetime import datetime, timedelta
from utils.utils import get_filtered_fb_post, on_workdays, skip_empty_lines
from plugin import EbedkePlugin

FB_PAGE = "https://www.facebook.com/pg/greenhousegrillferencvaros/posts"
FB_ID = "169496610086809"


@on_workdays
def get_menu(today):
    is_today = lambda date: datetime.strptime(date, '%Y-%m-%dT%H:%M:%S%z'
                                              ).date() == today.date()
    menu_filter = lambda post: is_today(post[
        'created_time']) and "mai menü" in post['message'].lower()
    menu = get_filtered_fb_post(FB_ID, menu_filter)
    drop_words = ["mai menünk", "jó étvágyat"]
    menu = skip_empty_lines(
        filter(lambda l: not any(word in l.lower() for word in drop_words),
               menu.splitlines()))
    return list(menu)


plugin = EbedkePlugin(enabled=True,
                      name='Green House Grill',
                      id='gh',
                      url=FB_PAGE,
                      downloader=get_menu,
                      ttl=timedelta(hours=23),
                      cards=[],
                      groups=["corvin"])
Example #28
0
from datetime import timedelta
from utils.utils import get_dom, on_workdays, skip_empty_lines
from plugin import EbedkePlugin

URL = "http://www.jegkert.hu/napiebedmenu"


@on_workdays
def getMenu(today):
    dom = get_dom(URL)
    date = today.strftime("%Y-%m-%d")
    menu = dom.xpath(
        f'/html/body//div[@id="NapiEbedMenu"]//tr[.//div[contains(text(), "{ date }")]]/td[position()=2 or position()=3]//text()'
    )
    if menu:
        menu = list(skip_empty_lines(menu))
    else:
        menu = []

    return menu


plugin = EbedkePlugin(enabled=True,
                      name='Jégkert',
                      id='jk',
                      url=URL,
                      downloader=getMenu,
                      ttl=timedelta(hours=23),
                      cards=[],
                      groups=["szell"])
Example #29
0
from datetime import timedelta
import re

from utils.utils import get_dom, on_workdays, days_upper
from plugin import EbedkePlugin

URL = "https://www.wasabi.hu/szolgaltatas/napimenu"


@on_workdays
def getMenu(today):
    dom = get_dom(URL, force_utf8=True)
    weekday = today.isoweekday()
    items = dom.xpath(f"//blockquote[{weekday}]//text()")[1:]
    for stopword in ["LEVES", "FŐÉTEL", "DESSZERT", "ELŐÉTEL", ":"
                     ] + days_upper:
        items = [re.sub(f'({stopword}):? ?', '', i).strip() for i in items]
    menu = list(line.strip() for line in items if line)
    return menu


plugin = EbedkePlugin(enabled=True,
                      groups=["szepvolgyi"],
                      name='Wasabi',
                      id='wasabi',
                      url=URL,
                      downloader=getMenu,
                      ttl=timedelta(hours=23),
                      cards=['szep', 'erzs'])
Example #30
0
from datetime import timedelta
from utils.utils import get_dom, on_workdays
from plugin import EbedkePlugin

URL = "http://www.gyorsetterem.hu/hetimenu.php"


@on_workdays
def getMenu(today):
    dom = get_dom(URL, force_utf8=True)
    date = dom.xpath("/html/body//div[@class='maidatum']/text()")
    date = date.pop().strip() if date else None
    if date == today.strftime("%Y-%m-%d"):
        menu = dom.xpath("/html/body//div[@class='napimenu']/p/text()")
        menu = list(menu)
    else:
        menu = ''
    return menu


plugin = EbedkePlugin(enabled=True,
                      name='JóAsszony',
                      id='ja',
                      url=URL,
                      downloader=getMenu,
                      ttl=timedelta(hours=24),
                      cards=[],
                      groups=["szell", "corvin"])