Skip to content

Commit 897f766

Browse files
committed
feat: add cronjob to refresh showtimes
1 parent 6f00c34 commit 897f766

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
FROM python:3.12-slim
22

3+
RUN apt-get update && apt-get install -y --no-install-recommends cron && rm -rf /var/lib/apt/lists/*
4+
35
WORKDIR /app
46

57
COPY requirements.txt .
68
RUN pip install --no-cache-dir -r requirements.txt gunicorn
79

810
COPY . .
911

12+
RUN echo "0 * * * * kill -HUP 1 > /proc/1/fd/1 2>&1" | crontab -
13+
1014
EXPOSE 5000
1115

12-
CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
16+
CMD cron && gunicorn -b 0.0.0.0:5000 app:app

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# <img src="https://raw.githubusercontent.com/MathiasDPX/MathiasDPX/main/assets/cinebrest.png" style="height:1em"> CinéBrest
44
</p>
55

6-
A platform that consolidates all Brest cinema schedules on one page, offering real-time updates and a user-friendly design for effortless movie planning.
6+
An instance of [grainParisArt](https://github.com/solene-drnx/grainParisArt-Public/) that consolidates all Brest cinema schedules on one page, offering real-time updates and a user-friendly design for effortless movie planning.
77

88
## 📍 Autres villes
99

app.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,16 @@ def getShowtimes(date):
5858

5959
return data
6060

61-
showtimes = []
62-
for i in range(0, 7):
63-
day_showtimes = getShowtimes(datetime.now(timezone) + timedelta(days=i))
64-
showtimes.append(day_showtimes)
65-
print(f"{len(day_showtimes)} séances récupéré {i + 1}/7!")
61+
def refreshShowtimes():
62+
global showtimes
63+
new_showtimes = []
64+
for i in range(0, 7):
65+
day_showtimes = getShowtimes(datetime.now(timezone) + timedelta(days=i))
66+
new_showtimes.append(day_showtimes)
67+
print(f"{len(day_showtimes)} séances récupéré {i + 1}/7!")
68+
showtimes = new_showtimes
69+
70+
refreshShowtimes()
6671

6772

6873
def translate_month(num: int) -> str:

0 commit comments

Comments
 (0)