From 2707eecbd98ff08f16e15b23c1000ae7297f7026 Mon Sep 17 00:00:00 2001 From: LucasVbr Date: Mon, 6 Jun 2022 17:56:26 +0200 Subject: [PATCH] Add Emoji to Meteo --- Utils.py | 4 ++- src/meteoEmoji.py | 69 ++++++++++++++++++++++++++++++++++++++++ templates/index.md.jinja | 6 ++-- 3 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 src/meteoEmoji.py diff --git a/Utils.py b/Utils.py index de5556f..c2b04db 100644 --- a/Utils.py +++ b/Utils.py @@ -5,6 +5,7 @@ from flask import Flask, render_template from src.Badge import Badge, getBadgeColor from meteofrance_api import MeteoFranceClient from src.FileUtils import setFileData, getJsonData +from src.meteoEmoji import EMOJIS """ 05/06/2022 @@ -38,7 +39,8 @@ def getWeather(city: str) -> dict: return { "temperature": weather.get('T').get('value'), - "description": weather.get("weather").get("desc") + "description": weather.get("weather").get("desc"), + "icon": EMOJIS.get(weather.get("weather").get("icon")) } diff --git a/src/meteoEmoji.py b/src/meteoEmoji.py new file mode 100644 index 0000000..322e641 --- /dev/null +++ b/src/meteoEmoji.py @@ -0,0 +1,69 @@ +EMOJIS = { + "p1j": ":sunny:", + "p1n": ":full_moon:", + "p2j": ":partly_sunny:", + "p2n": ":cloud:", + "p3j": ":cloud:", + "p3n": ":cloud:", + "p4j": ":fog:", + "p4n": ":fog:", + "p5j": ":fog:", + "p5n": ":fog:", + "p6j": ":fog:", + "p6n": ":fog:", + "p7j": ":fog:", + "p7n": ":fog:", + "p8j": ":fog:", + "p8n": ":fog:", + "p9j": ":cloud_with_rain:", + "p9n": ":cloud_with_rain:", + "p10j": ":cloud_with_rain:", + "p10n": ":cloud_with_rain:", + "p11j": ":cloud_with_rain:", + "p11n": ":cloud_with_rain:", + "p12j": ":cloud_with_rain:", + "p12n": ":cloud_with_rain:", + "p13j": ":cloud_with_rain:", + "p13n": ":cloud_with_rain:", + "p14j": ":cloud_with_rain:", + "p14n": ":cloud_with_rain:", + "p15j": ":cloud_with_rain:", + "p15n": ":cloud_with_rain:", + "p16j": ":cloud_with_lightning:", + "p16n": ":cloud_with_lightning:", + "p17j": ":cloud_with_snow:", + "p17n": ":cloud_with_snow:", + "p18j": ":cloud_with_snow:", + "p18n": ":cloud_with_snow:", + "p19j": ":cloud_with_snow:", + "p19n": ":cloud_with_snow:", + "p20j": ":cloud_with_snow:", + "p20n": ":cloud_with_snow:", + "p21j": ":cloud_with_snow:", + "p21n": ":cloud_with_snow:", + "p22j": ":cloud_with_snow:", + "p22n": ":cloud_with_snow:", + "p23j": ":cloud_with_snow:", + "p23n": ":cloud_with_snow:", + "p24j": ":cloud_with_lightning:", + "p24n": ":cloud_with_lightning:", + "p25j": ":cloud_with_lightning:", + "p25n": ":cloud_with_lightning:", + "p26j": ":cloud_with_lightning:", + "p26n": ":cloud_with_lightning:", + "p27j": ":cloud_with_lightning:", + "p27n": ":cloud_with_lightning:", + "p28j": ":cloud_with_lightning:", + "p28n": ":cloud_with_lightning:", + "p29j": ":cloud_with_lightning:", + "p29n": ":cloud_with_lightning:", + "p30j": ":cloud_with_lightning:", + "p30n": ":cloud_with_lightning:", + "p31j": ":star:", + "p31n": ":star:", + "p32j": ":tornado:", + "p32n": ":tornado:", + "p33j": ":tornado:", + "p33n": ":tornado:", + +} diff --git a/templates/index.md.jinja b/templates/index.md.jinja index fcbffd0..ded8976 100644 --- a/templates/index.md.jinja +++ b/templates/index.md.jinja @@ -2,8 +2,8 @@ # Hello there ! {{ imageWithSize(data.info.hi_img) }} -I'm {{ data.info.name }}, a passionate developer from {{ imageWithSize(data.info.france_img) }} {{ data.info.city }}, France. -
Currently, the weather is: **{{ data.weather.temperature }}°C**, **{{ data.weather.description }}** +I'm {{ data.info.name }}, a passionate developer from {{ imageWithSize(data.info.france_img) }} **{{ data.info.city }}, France**. +
Currently, the weather is: **{{ data.weather.temperature }}°C** :thermometer:, **{{ data.weather.description }}** {{ data.weather.icon }} ### I code with {% for img in data.tools -%} @@ -18,7 +18,7 @@ I'm {{ data.info.name }}, a passionate developer from {{ imageWithSize(data.info
-This README is generated every 3 hours.
+This **README** is generated **every 3 hours**.
Last refresh: **{{ data.today }}** ({{ data.info.timezone }})
{% for img in data.footer_badges -%} {{ image(img) }}