Commit bf24ffd 1 parent 986b36b commit bf24ffd Copy full SHA for bf24ffd
File tree 8 files changed +17
-25
lines changed
8 files changed +17
-25
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ python-dateutil
8
8
numpy
9
9
Pillow
10
10
gitpython
11
+ babel
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ RUN apk add --update \
10
10
libc-dev \
11
11
libffi-dev \
12
12
openssl-dev \
13
- musl-locales \
13
+ git \
14
14
&& rm -rf /var/cache/apk/*
15
15
16
16
COPY assets/. ./assets
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ Join the notification #channel on [Telegram](https://t.me/sammy_ofer_notificatio
13
13
14
14
## Web-UI
15
15
16
- ![ Web-UI screenshot] ( screen.png ) ****
16
+ ![ Web-UI screenshot] ( screen.png )
17
17
18
18
## Static landing page ([ link] ( https://drehelis.github.io/sammy_ofer/static.html ) )
19
19
@@ -33,6 +33,7 @@ docker run -d --name sammy_ofer \
33
33
--restart=on-failure \
34
34
--env TELEGRAM_CHANNEL_ID=<required> \
35
35
--env TELEGRAM_TOKEN=<required> \
36
+ --env GH_PAT (optional) \
36
37
sammy_ofer:latest
37
38
```
38
39
Original file line number Diff line number Diff line change 39
39
<div class =" metadata-item" >📣: {{ notes }}</div >
40
40
{% endif %}
41
41
<div class =" metadata-item" ><img src =" assets/images/qrcode.png" alt =" QR Code" style =" max-width : 100px ; margin-top : 1rem ;" ></div >
42
- <div ><img src =" https://img.shields.io/endpoint?color=neon&style=plastic&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsammy_ofer_notification_channel" ></div >
42
+ <div ><img src =" https://img.shields.io/endpoint?color=neon&style=plastic&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsammy_ofer_notification_channel&label=Sammy%20Ofer%20Notification%20Channel " ></div >
43
43
</div >
44
44
</div >
45
45
<script >
54
54
<div class =" metadata" >
55
55
<div class =" metadata-item" >⚪ המשחק ⚽ הבא: {{ games['game_1'] [0] .strftime('%A, %d/%m/%Y') }} ⚪</div >
56
56
<div class =" metadata-item" ><img src =" assets/images/qrcode.png" alt =" QR Code" style =" max-width : 100px ; margin-top : 1rem ;" ></div >
57
- <img src =" https://img.shields.io/endpoint?color=neon&style=plastic&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsammy_ofer_notification_channel" >
57
+ <img src =" https://img.shields.io/endpoint?color=neon&style=plastic&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsammy_ofer_notification_channel&label=Sammy%20Ofer%20Notification%20Channel " >
58
58
</div >
59
59
</div >
60
60
Original file line number Diff line number Diff line change 84
84
< div class ="divTableRow ">
85
85
< div class ="divTableCell "> {{ loop.index }}</ div >
86
86
< div class ="divTableCell "> {{ scraped_date_time.strftime('%Y-%m-%d') }}</ div >
87
- < div class ="divTableCell "> {{ scraped_date_time.strftime('%A') }}</ div >
87
+ < div class ="divTableCell "> {{ scraped_date_time | babel_format_day_heb }}</ div >
88
88
< div class ="divTableCell "> {{ scraped_date_time.strftime('%H:%M') }}</ div >
89
89
< div class ="divTableCell "> {{ league }}</ div >
90
90
< div class ="divTableCell "> < img width ="18 " height ="18 " src ="assets/teams/{{ home_team_en }}.png "> < a href ="{{ home_team_url }} " target ="_blank "> {{ home_team }}</ a > </ div >
Original file line number Diff line number Diff line change 3
3
from pathlib import Path
4
4
from shutil import copy
5
5
import datetime
6
+ import os
6
7
7
8
from git import Repo
8
9
from logger import logger
9
10
10
- REPO_URL = "https://github.com/drehelis/sammy_ofer"
11
+ REPO_URL = f "https://{ os . getenv ( "GH_PAT" ) } @ github.com/drehelis/sammy_ofer"
11
12
TMP_REPO_DIR = "/tmp/sammy_ofer"
12
13
STATIC_HTML_FILENAME = "static.html"
13
14
GH_PAGES_BRANCH = "static_page"
@@ -42,6 +43,9 @@ def git_commit():
42
43
except :
43
44
repo = Repo .clone_from (REPO_URL , TMP_REPO_DIR )
44
45
46
+ repo .config_writer ().set_value ("user" , "name" , "sammy-ofer-bot" ).release ()
47
+ repo .
config_writer ().
set_value (
"user" ,
"email" ,
"[email protected] " ).
release ()
48
+
45
49
try :
46
50
repo .git .checkout (GH_PAGES_BRANCH )
47
51
except :
Original file line number Diff line number Diff line change 9
9
from flask import Flask , render_template , request
10
10
from flask .helpers import send_file
11
11
from markupsafe import Markup
12
- from spectators import SPECTATORS
13
12
13
+ from spectators import SPECTATORS
14
14
import web_scrape
15
15
16
16
17
- def b64encode (s ):
18
- return base64 .b64encode (s .encode ())
19
-
17
+ def babel_format_day_heb (s ):
18
+ from babel .dates import format_date
20
19
21
- def b64decode (s ):
22
- data = base64 .b64decode (s )
23
- return data .decode ()
20
+ return format_date (s , "EEEE" , locale = "he" )
24
21
25
22
26
23
app = Flask (__name__ , template_folder = "html_templates" )
27
- app .jinja_env .filters ["b64encode" ] = b64encode
28
- app .jinja_env .filters ["b64decode" ] = b64decode
24
+ app .jinja_env .filters ["babel_format_day_heb" ] = babel_format_day_heb
29
25
30
26
31
27
@app .route ("/next" , methods = ["GET" ])
Original file line number Diff line number Diff line change 8
8
from dateutil import parser
9
9
from pathlib import Path
10
10
from logger import logger
11
- import locale
12
11
import requests
13
12
import re
14
13
19
18
from static_html_page import gen_static_page
20
19
from metadata import TEAMS_METADATA , DESKTOP_AGENTS
21
20
22
- try :
23
- locale .setlocale (locale .LC_TIME , "he_IL" ) # MacOS
24
- except locale .Error :
25
- try :
26
- # apt-get install language-pack-he language-pack-he-base
27
- locale .setlocale (locale .LC_TIME , "he_IL.UTF-8" ) # Ubuntu
28
- except locale .Error :
29
- pass
30
-
31
21
32
22
def random_ua ():
33
23
return {"User-Agent" : choice (DESKTOP_AGENTS )}
You can’t perform that action at this time.
0 commit comments