Added setting for timezone

This commit is contained in:
Krateng 2020-12-01 18:59:39 +01:00
parent c87dc32455
commit e475b0c716
2 changed files with 8 additions and 1 deletions

View File

@ -71,6 +71,9 @@ CHARTS_DISPLAY_TILES = false
# prevent visitors from mindlessly clicking on those options and hogging your cpu
DISCOURAGE_CPU_HEAVY_STATS = false
# offset to UTC
TIMEZONE = 0
[Fluff]
# how many scrobbles a track needs to aquire this status

View File

@ -1,9 +1,13 @@
import datetime
from datetime import datetime as dtm
from datetime import timezone, timedelta
from calendar import monthrange
from os.path import commonprefix
import math
from doreah.settings import get_settings
OFFSET = get_settings("TIMEZONE")
TIMEZONE = timezone(timedelta(hours=OFFSET))
FIRST_SCROBBLE = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())
@ -545,7 +549,7 @@ def timestamp_desc(t,short=False):
return timeobject.strftime("%Y")
else:
timeobject = datetime.datetime.fromtimestamp(t)
timeobject = datetime.datetime.fromtimestamp(t,tz=TIMEZONE)
return timeobject.strftime("%d. %b %Y %I:%M %p")