diff --git a/poetry.lock b/poetry.lock index 89810ff..c489901 100644 --- a/poetry.lock +++ b/poetry.lock @@ -13,22 +13,23 @@ files = [ [[package]] name = "anyio" -version = "4.6.2.post1" +version = "4.7.0" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false python-versions = ">=3.9" files = [ - {file = "anyio-4.6.2.post1-py3-none-any.whl", hash = "sha256:6d170c36fba3bdd840c73d3868c1e777e33676a69c3a72cf0a0d5d6d8009b61d"}, - {file = "anyio-4.6.2.post1.tar.gz", hash = "sha256:4c8bc31ccdb51c7f7bd251f51c609e038d63e34219b44aa86e47576389880b4c"}, + {file = "anyio-4.7.0-py3-none-any.whl", hash = "sha256:ea60c3723ab42ba6fff7e8ccb0488c898ec538ff4df1f1d5e642c3601d07e352"}, + {file = "anyio-4.7.0.tar.gz", hash = "sha256:2f834749c602966b7d456a7567cafcb309f96482b5081d14ac93ccd457f9dd48"}, ] [package.dependencies] idna = ">=2.8" sniffio = ">=1.1" +typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""} [package.extras] -doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21.0b1)"] +doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx_rtd_theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21)"] trio = ["trio (>=0.26.1)"] [[package]] @@ -961,13 +962,13 @@ wsproto = ">=0.14" [[package]] name = "types-python-dateutil" -version = "2.9.0.20241003" +version = "2.9.0.20241206" description = "Typing stubs for python-dateutil" optional = false python-versions = ">=3.8" files = [ - {file = "types-python-dateutil-2.9.0.20241003.tar.gz", hash = "sha256:58cb85449b2a56d6684e41aeefb4c4280631246a0da1a719bdbe6f3fb0317446"}, - {file = "types_python_dateutil-2.9.0.20241003-py3-none-any.whl", hash = "sha256:250e1d8e80e7bbc3a6c99b907762711d1a1cdd00e978ad39cb5940f6f0a87f3d"}, + {file = "types_python_dateutil-2.9.0.20241206-py3-none-any.whl", hash = "sha256:e248a4bc70a486d3e3ec84d0dc30eec3a5f979d6e7ee4123ae043eedbb987f53"}, + {file = "types_python_dateutil-2.9.0.20241206.tar.gz", hash = "sha256:18f493414c26ffba692a72369fea7a154c502646301ebfe3d56a04b3767284cb"}, ] [[package]] diff --git a/src/ics_cal/ics.py b/src/ics_cal/ics.py index 94dc426..3714f82 100644 --- a/src/ics_cal/ics.py +++ b/src/ics_cal/ics.py @@ -46,4 +46,4 @@ def get_events(self, ics_url, calStartDatetime, calEndDatetime, displayTZ, numDa else: calDict.setdefault(event["startDatetime"].date(), []).append(event) - return calDict + return sorted(calDict.items(), key=lambda x: x[0]) diff --git a/src/ics_cal/icshelper.py b/src/ics_cal/icshelper.py index 69d4e9d..d3d3489 100644 --- a/src/ics_cal/icshelper.py +++ b/src/ics_cal/icshelper.py @@ -39,8 +39,11 @@ def retrieve_events(self, ics_url, startDatetime, endDatetime, localTZ): ) and event.begin < arrow.Arrow.fromdatetime(endDatetime): # extracting and converting events data into a new list new_event = {"summary": event.name} - new_event["allday"] = event.all_day + if event.location: + new_event["location"] = event.location + + new_event["allday"] = event.all_day if new_event["allday"]: # All-day events are always midnight UTC to midnight UTC, therefore timezone needs to be set new_event["startDatetime"] = dt.datetime.fromisoformat( @@ -61,9 +64,7 @@ def retrieve_events(self, ics_url, startDatetime, endDatetime, localTZ): new_event["isMultiday"] = ( new_event["endDatetime"] - new_event["startDatetime"] ) > dt.timedelta(days=1) + event_list.append(new_event) - # We need to sort eventList because the event will be sorted in "calendar order" instead of hours order - # TODO: improve because of double cycle for now is not much cost - event_list = sorted(event_list, key=lambda k: k["startDatetime"]) return event_list diff --git a/src/main.py b/src/main.py index efef3ad..cb32130 100644 --- a/src/main.py +++ b/src/main.py @@ -66,9 +66,6 @@ def get_image() -> FileResponse: cfg.DISPLAY_TZ, cfg.NUM_CAL_DAYS_TO_QUERY, ) - events_sorted = sorted( - events.items(), key=lambda x: x[0] - ) # sort by date so we can later take the first N days end_time = time.time() logger.info(f"Completed data retrieval in {round(end_time - start_time, 3)} seconds.") @@ -84,7 +81,7 @@ def get_image() -> FileResponse: current_weather, hourly_forecast, daily_forecast, - events_sorted[: cfg.NUM_DAYS_IN_TEMPLATE], + events[: cfg.NUM_DAYS_IN_TEMPLATE], tf.name, ) diff --git a/src/render/css/styles.css b/src/render/css/styles.css index 811c95a..765e200 100644 --- a/src/render/css/styles.css +++ b/src/render/css/styles.css @@ -13,7 +13,7 @@ src: url('../font/TiltWarp-Regular.ttf'); } -h1, h2, p, span, .h1, .h2, .p, .span { +h1, h2, h3, p, span { font-family: "Lexend-Regular", sans-serif; } @@ -21,10 +21,6 @@ h1, h2, p, span, .h1, .h2, .p, .span { text-overflow: ellipsis; } -.event-time { - color: gray -} - .big-day { font-family: "TiltWarp-Regular", sans-serif; font-size: 18rem; @@ -42,6 +38,15 @@ h1, h2, p, span, .h1, .h2, .p, .span { text-overflow: ellipsis; } +.event-time, .event-location { + color: gray +} + +.weather-forecast { + font-family: "Lexend-Regular", sans-serif; + font-size: 2rem; +} + .info-bar { font-family: "Lexend-Light", sans-serif; font-size: 1.5rem; diff --git a/src/render/dashboard_template.html b/src/render/dashboard_template.html index d251568..ae6af21 100644 --- a/src/render/dashboard_template.html +++ b/src/render/dashboard_template.html @@ -12,7 +12,7 @@