diff --git a/assets/teams/Bnei Reineh.png b/assets/teams/Bnei Reineh.png new file mode 100644 index 0000000..04030fe Binary files /dev/null and b/assets/teams/Bnei Reineh.png differ diff --git a/assets/teams/Maccabi Bnei Reineh.png b/assets/teams/Maccabi Bnei Reineh.png new file mode 100644 index 0000000..04030fe Binary files /dev/null and b/assets/teams/Maccabi Bnei Reineh.png differ diff --git a/assets/teams/Maccabi Netanya.png b/assets/teams/Maccabi Netanya.png new file mode 100644 index 0000000..8d5d54d Binary files /dev/null and b/assets/teams/Maccabi Netanya.png differ diff --git a/cron.py b/cron.py index fe6ba5a..2a8aefa 100755 --- a/cron.py +++ b/cron.py @@ -67,6 +67,8 @@ def create_message(*args): custom_road_block_time = f"החל מ {road_block_time}" if int(specs_number) >= 28000: custom_sepcs_number = f"\\({specs_number:,}\\) 😱" + if 1 <= int(specs_number) <= 6000: + custom_sepcs_number = f"\\({specs_number:,}\\) 🤏" if specs_word == "ללא" or int(specs_number) <= 6000: custom_road_block_time = "אין" elif specs_word == "גדול מאוד": diff --git a/metadata.py b/metadata.py index e1be3f8..77dfbb0 100644 --- a/metadata.py +++ b/metadata.py @@ -10,7 +10,7 @@ "Unavailable": { "name": "Unavailable", "url": "", - "logo": "", + "logo": "" }, "מכבי חיפה": { "name": "Maccabi Haifa", @@ -47,6 +47,21 @@ "url": "https://www.football.co.il/hapoel-tel-aviv", "logo": "https://static.football.co.il/wp-content/themes/kingclub-theme/images/teams/4530.png", }, + "מכבי בני ריינה": { + "name": "Bnei Reineh", + "url": "https://www.football.co.il/bnei-reineh", + "logo": "https://static.football.co.il/wp-content/themes/kingclub-theme/images/teams/30249.png", + }, + "מכבי נתניה": { + "name": "Maccabi Netanya", + "url": "https://www.football.co.il/maccabi-netanya", + "logo": "https://static.football.co.il/wp-content/themes/kingclub-theme/images/teams/4545.png", + }, + "בני סכנין": { + "name": "Bnei Sakhnin", + "url": "https://www.football.co.il/bnei-sakhnin", + "logo": "https://static.football.co.il/wp-content/themes/kingclub-theme/images/teams/15960.png", + }, } EMOJI_HEARTS = [ diff --git a/web_scrape.py b/web_scrape.py index 53ca093..c4ecfc8 100755 --- a/web_scrape.py +++ b/web_scrape.py @@ -143,8 +143,9 @@ class GenerateTeamsPNG: def __init__(self, home_team, guest_team): self.home_team = TEAMS_METADATA.get(home_team, TEAMS_METADATA.get("Unavailable")) self.guest_team = TEAMS_METADATA.get(guest_team, TEAMS_METADATA.get("Unavailable")) + self.absolute_path = Path(__file__).resolve().parent - Path("./assets/teams").mkdir(parents=True, exist_ok=True) + Path(self.absolute_path / "assets/teams").mkdir(parents=True, exist_ok=True) def fetch_logo(self): teams = (self.home_team, self.guest_team) @@ -153,22 +154,24 @@ def fetch_logo(self): fname = f"{team.get('name')}.png" logo_url = team.get('logo') - full_path = Path("./assets/teams") / fname + full_path = self.absolute_path / Path("assets/teams") / fname if full_path.is_file(): if full_path.stat().st_size != 0: logger.info(f"File '{full_path}' exists, fetching is skipped") continue - r = requests.get(logo_url) - - with open(full_path, 'wb') as f: - logger.info(f"Writing new file '{full_path}'") - f.write(r.content) + try: + r = requests.get(logo_url) + with open(full_path, 'wb') as f: + logger.info(f"Writing new file '{full_path}'") + f.write(r.content) + except requests.exceptions.MissingSchema: + pass def banner(self): - guest_team_fname = Path("./assets/teams") / f"{self.guest_team.get('name')}.png" - versus_image_fname = choice(list(Path("./assets/versus").glob('**/*'))) - home_team_fname = Path("./assets/teams") / f"{self.home_team.get('name')}.png" + guest_team_fname = self.absolute_path / Path("assets/teams") / f"{self.guest_team.get('name')}.png" + versus_image_fname = choice(list(Path(f"{self.absolute_path}/assets/versus").glob('**/*'))) + home_team_fname = self.absolute_path / Path("assets/teams") / f"{self.home_team.get('name')}.png" banner_list = [ guest_team_fname,