diff --git a/maloja/__main__.py b/maloja/__main__.py index 67b010b..1da4752 100644 --- a/maloja/__main__.py +++ b/maloja/__main__.py @@ -50,6 +50,7 @@ def print_info(): print(col['lightblue']("Log Directory: "),conf.dir_settings['logs']) print(col['lightblue']("Network: "),f"Dual Stack, Port {conf.malojaconfig['port']}" if conf.malojaconfig['host'] == "*" else f"IPv{ip_address(conf.malojaconfig['host']).version}, Port {conf.malojaconfig['port']}") print(col['lightblue']("Timezone: "),f"UTC{conf.malojaconfig['timezone']:+d}") + print(col['lightblue']("Location Timezone: "),conf.malojaconfig['location_timezone']) print() try: from importlib.metadata import distribution diff --git a/maloja/malojatime.py b/maloja/malojatime.py index 1af046d..bce6bdf 100644 --- a/maloja/malojatime.py +++ b/maloja/malojatime.py @@ -1,13 +1,15 @@ from datetime import timezone, timedelta, date, time, datetime from calendar import monthrange import math +import zoneinfo from abc import ABC, abstractmethod from .pkg_global.conf import malojaconfig OFFSET = malojaconfig["TIMEZONE"] -TIMEZONE = timezone(timedelta(hours=OFFSET)) +LOCATION_TIMEZONE = malojaconfig["LOCATION_TIMEZONE"] +TIMEZONE = timezone(timedelta(hours=OFFSET)) if not LOCATION_TIMEZONE and LOCATION_TIMEZONE in zoneinfo.available_timezones() else zoneinfo.ZoneInfo(LOCATION_TIMEZONE) UTC = timezone.utc FIRST_SCROBBLE = int(datetime.utcnow().replace(tzinfo=UTC).timestamp()) diff --git a/maloja/pkg_global/conf.py b/maloja/pkg_global/conf.py index 64a6ed8..4efbcba 100644 --- a/maloja/pkg_global/conf.py +++ b/maloja/pkg_global/conf.py @@ -207,7 +207,8 @@ malojaconfig = Configuration( "filters_remix":(tp.Set(tp.String()), "Remix Filters", ["Remix", "Remix Edit", "Short Mix", "Extended Mix", "Soundtrack Version"], "Filters used to recognize the remix artists in the title"), "parse_remix_artists":(tp.Boolean(), "Parse Remix Artists", False), "week_offset":(tp.Integer(), "Week Begin Offset", 0, "Start of the week for the purpose of weekly statistics. 0 = Sunday, 6 = Saturday"), - "timezone":(tp.Integer(), "UTC Offset", 0) + "timezone":(tp.Integer(), "UTC Offset", 0), + "location_timezone":(tp.String(), "Location Timezone", None) }, "Web Interface":{ "default_range_startpage":(tp.Choice({'alltime':'All Time','year':'Year','month':"Month",'week':'Week'}), "Default Range for Startpage Stats", "year"), diff --git a/settings.md b/settings.md index 425001b..9f3b317 100644 --- a/settings.md +++ b/settings.md @@ -68,6 +68,7 @@ Settings File | Environment Variable | Type | Description `parse_remix_artists` | `MALOJA_PARSE_REMIX_ARTISTS` | Boolean | Parse Remix Artists `week_offset` | `MALOJA_WEEK_OFFSET` | Integer | Start of the week for the purpose of weekly statistics. 0 = Sunday, 6 = Saturday `timezone` | `MALOJA_TIMEZONE` | Integer | UTC Offset +`location_timezone` | `MALOJA_LOCATION_TIMEZONE` | String | Location Timezone (overrides `timezone`) **Web Interface** `default_range_startpage` | `MALOJA_DEFAULT_RANGE_STARTPAGE` | Choice | Default Range for Startpage Stats `default_step_pulse` | `MALOJA_DEFAULT_STEP_PULSE` | Choice | Default Pulse Step