Skip to content

Commit d9c62cf

Browse files
fix ci pipeline (#10)
* ci: fix package command * chore: bump version to 0.0.8 * chore: run auto formatter * chore: update .gitignore Co-authored-by: Valentin Rieß <valentin.riess@posteo.de>
1 parent 7f2c48b commit d9c62cf

File tree

8 files changed

+22
-15
lines changed

8 files changed

+22
-15
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
- name: Create .mbp package
3131
run: |
3232
mkdir artifacts
33-
zip -9r ./artifacts/$(grep 'id:' maubot.yaml | sed 's/id: //')'-v'$(grep 'version:' maubot.yaml | sed 's/version: //').mbp maubot.yaml mensabot.py LICENSE.txt
34-
33+
zip -9r ./artifacts/$(grep 'id:' maubot.yaml | sed 's/id: //')'-v'$(grep 'version:' maubot.yaml | sed 's/version: //').mbp ovgumensabot/* *.yaml
34+
3535
- name: Release and attach artifacts
3636
uses: fnkr/github-action-ghr@v1
3737
if: startsWith(github.ref, 'refs/tags/')

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
venv
33

44
# Maubot plugin
5-
*.mbp
5+
*.mbp
6+
7+
.DS_Store
8+
/artifacts/

maubot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ maubot: 0.2.0
55
id: com.valentinriess.mensa
66

77
# A PEP 440 compliant version string.
8-
version: 0.0.7
8+
version: 0.0.8
99

1010
# The SPDX license identifier for the plugin. https://spdx.org/licenses/
1111
# Optional, assumes all rights reserved if omitted.

ovgumensabot/db.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def add_meals_to_menu(self, menu: Menu):
6161
logging.getLogger("maubot").info(f"Add meals to menu from {menu.day}.")
6262
if self.menu_day_exists(menu):
6363
self.db.execute(self.meals.insert(),
64-
[{"menu_day": menu.day, "price": meal.price,
65-
"name": meal.name}
66-
for meal in menu.meals])
64+
[{"menu_day": menu.day, "price": meal.price,
65+
"name": meal.name}
66+
for meal in menu.meals])
6767

6868
def subscriptions_not_empty(self) -> bool:
6969
rows = self.db.execute(select([func.count()]).select(self.subscriptions)).scalar()

ovgumensabot/meal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from typing import List, Dict
2+
23
from attr import dataclass
34

45

ovgumensabot/mensabot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import asyncio
22
from datetime import datetime, timedelta, date
3-
import pytz
43

4+
import pytz
55
from markdown import markdown
66
from maubot import Plugin, MessageEvent
77
from maubot.handlers import command
88
from mautrix.errors import MForbidden
99
from mautrix.types import TextMessageEventContent, MessageType, Format, RelatesTo, RelationType, RoomID
1010

11-
from .parser import get_menus, parse_movies
1211
from .db import MenuDatabase
1312
from .menu import Menu
13+
from .parser import get_menus, parse_movies
1414

1515
URLS = [
1616
'https://www.studentenwerk-magdeburg.de/mensen-cafeterien/mensa-unicampus/speiseplan-unten/',

ovgumensabot/menu.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
from typing import List, Dict
44

55
import pytz
6+
from attr import dataclass
67
from bs4 import BeautifulSoup
78
from maubot import Plugin
89

910
from .meal import Meal
1011

11-
from attr import dataclass
12-
1312

1413
@dataclass
1514
class Menu:

ovgumensabot/parser.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ async def parse_movies(mensabot: Plugin, url: str) -> list[tuple[datetime, str]]
104104
soup = BeautifulSoup(page, "html.parser")
105105

106106
# locate calendar for current semester
107-
div_semester = soup.find("div", class_="kino-detail-spielplan spielplan-thisSemester")
107+
div_semester = soup.find(
108+
"div", class_="kino-detail-spielplan spielplan-thisSemester")
108109

109110
# locate all movies in current semester
110-
div_movie: List[BeautifulSoup] = div_semester.find_all("div", class_="semester-film-row")
111+
div_movie: List[BeautifulSoup] = div_semester.find_all(
112+
"div", class_="semester-film-row")
111113

112114
movies_dict = {}
113115

@@ -116,9 +118,11 @@ async def parse_movies(mensabot: Plugin, url: str) -> list[tuple[datetime, str]]
116118
date = movie.find("div", class_="film-row-text film-row-datum").text
117119
time = movie.find("div", class_="film-row-text film-row-uhrzeit").text
118120
date_time_str = f"{date.strip().split(' ', 1)[1]}-{time.split(' ', 1)[0]}"
119-
parsed_datetime: datetime = datetime.strptime(date_time_str, "%d.%m.%Y-%H:%M")
121+
parsed_datetime: datetime = datetime.strptime(
122+
date_time_str, "%d.%m.%Y-%H:%M")
120123
# ignore space at the end of each title
121-
title = movie.find("div", class_="film-row-text film-row-titel").text.strip()
124+
title = movie.find(
125+
"div", class_="film-row-text film-row-titel").text.strip()
122126

123127
movies_dict[parsed_datetime] = title
124128

0 commit comments

Comments
 (0)