liquidsoap does not manage tz; fix it
This commit is contained in:
parent
cf92f50fcd
commit
66bee810eb
|
@ -24,11 +24,11 @@ import pytz
|
||||||
tz.activate(pytz.UTC)
|
tz.activate(pytz.UTC)
|
||||||
|
|
||||||
|
|
||||||
class Tracer:
|
# FIXME liquidsoap does not manage timezones -- we have to convert
|
||||||
"""
|
# 'on_air' metadata we get from it into utc one in order to work
|
||||||
Keep trace of played item and update logs in adequation to it
|
# correctly.
|
||||||
"""
|
import tzlocal
|
||||||
pass
|
local_tz = tzlocal.get_localzone()
|
||||||
|
|
||||||
|
|
||||||
class Monitor:
|
class Monitor:
|
||||||
|
@ -143,11 +143,11 @@ class Monitor:
|
||||||
if log:
|
if log:
|
||||||
# check if sound on air changed compared to logged one
|
# check if sound on air changed compared to logged one
|
||||||
try:
|
try:
|
||||||
# FIXME: TO-check liquidsoap ensure we have utc time
|
# FIXME: liquidsoap does not have timezone
|
||||||
on_air = current_source.metadata and \
|
on_air = current_source.metadata and \
|
||||||
current_source.metadata.get('on_air')
|
current_source.metadata.get('on_air')
|
||||||
on_air = tz.datetime.strptime(on_air, "%Y/%m/%d %H:%M:%S")
|
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
|
is_diff = log.date != on_air
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -14,4 +14,5 @@ django-modelcluster==2.0
|
||||||
django-honeypot>=0.5.0
|
django-honeypot>=0.5.0
|
||||||
django-jet>=1.0.3
|
django-jet>=1.0.3
|
||||||
mutagen>=1.37
|
mutagen>=1.37
|
||||||
|
tzlocal>=1.4
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user