Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

May, 26 Update #39

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/templates/static_page.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
{% endfor %}
<div id="default-container" class="container" style="display: none;">
<div class="metadata">
<div class="metadata-item">המשחק ⚽ הבא: {{ games['game_1'][0] | babel_format_full_heb }}</div>
<div class="metadata-item">המשחק ⚽ הבא: {{ games.get('game_1', ['אין משחקים קרבים'])[0] | babel_format_full_heb }}</div>
<div class="metadata-item"><img src="assets/images/qrcode.png" alt="QR Code" style="max-width: 100px; margin-top: 1rem;"></div>
{{ notification_channel() | indent(6) }}
</div>
Expand Down
10 changes: 6 additions & 4 deletions cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def random_choice(rand):
def check_games_today(games):
# Set today to datetime.date(YEAR, M, D) when debugging specific date
today = datetime.date.today()
for _, value in games.items():
if today == value[0].date():
logger.info("Yesh mishak!")
yield value

if not isinstance(games, str):
for _, value in games.items():
if today == value[0].date():
logger.info("Yesh mishak!")
yield value

return False

Expand Down
5 changes: 4 additions & 1 deletion jinja_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ def babel_format_day_heb(s):


def babel_format_full_heb(s):
return format_date(s, format="full", locale="he")
try:
return format_date(s, format="full", locale="he")
except Exception:
return s
3 changes: 2 additions & 1 deletion web_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def scrape(self):
games_list.append(text)

if len(games_list) < 2:
msg = f"List returned empty, no games today? Scrape result: {result}"
msg = f"List returned empty, no games today?"
logger.warning(msg)
return f"<pre>{msg}</pre>"

Expand All @@ -73,6 +73,7 @@ def scrape(self):

def decoratored_games(self, scraped):
if isinstance(scraped, str):
gen_static_page({})
return scraped

deco_games = {}
Expand Down
Loading