diff --git a/aircox/management/commands/streamer.py b/aircox/management/commands/streamer.py index 5f5552b..5b4ed60 100755 --- a/aircox/management/commands/streamer.py +++ b/aircox/management/commands/streamer.py @@ -24,11 +24,11 @@ import pytz tz.activate(pytz.UTC) -class Tracer: - """ - Keep trace of played item and update logs in adequation to it - """ - pass +# FIXME liquidsoap does not manage timezones -- we have to convert +# 'on_air' metadata we get from it into utc one in order to work +# correctly. +import tzlocal +local_tz = tzlocal.get_localzone() class Monitor: @@ -143,11 +143,11 @@ class Monitor: if log: # check if sound on air changed compared to logged one try: - # FIXME: TO-check liquidsoap ensure we have utc time + # FIXME: liquidsoap does not have timezone on_air = current_source.metadata and \ current_source.metadata.get('on_air') on_air = tz.datetime.strptime(on_air, "%Y/%m/%d %H:%M:%S") - on_air = tz.make_aware(on_air) + on_air = local_tz.localize(on_air) is_diff = log.date != on_air except: diff --git a/requirements.txt b/requirements.txt index d59d998..62cf325 100755 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,5 @@ django-modelcluster==2.0 django-honeypot>=0.5.0 django-jet>=1.0.3 mutagen>=1.37 +tzlocal>=1.4