fix(api_client): use same date format as schedule key

The webstream end event are ignored by playout if they do not follow the right datetime format.
This commit is contained in:
jo 2022-02-02 14:12:18 +01:00 committed by Kyle Robbertze
parent 51378e1e6f
commit 51499f251f

View file

@ -61,19 +61,20 @@ class AirtimeApiClient:
result = {"media": {}}
for item in data:
start = isoparse(item["starts"])
key = start.strftime("%Y-%m-%d-%H-%M-%S")
start_key = start.strftime("%Y-%m-%d-%H-%M-%S")
end = isoparse(item["ends"])
end_key = end.strftime("%Y-%m-%d-%H-%M-%S")
show_instance = self.services.show_instance_url(id=item["instance_id"])
show = self.services.show_url(id=show_instance["show_id"])
result["media"][key] = {
"start": start.strftime("%Y-%m-%d-%H-%M-%S"),
"end": end.strftime("%Y-%m-%d-%H-%M-%S"),
result["media"][start_key] = {
"start": start_key,
"end": end_key,
"row_id": item["id"],
"show_name": show["name"],
}
current = result["media"][key]
current = result["media"][start_key]
if item["file"]:
current["independent_event"] = False
current["type"] = "file"
@ -104,7 +105,7 @@ class AirtimeApiClient:
# Stream events are instantaneous
current["end"] = current["start"]
result[f"{key}_0"] = {
result[f"{start_key}_0"] = {
"id": current["id"],
"type": "stream_output_start",
"start": current["start"],
@ -114,7 +115,7 @@ class AirtimeApiClient:
"independent_event": current["independent_event"],
}
result[end.isoformat()] = {
result[end_key] = {
"type": "stream_buffer_end",
"start": current["end"],
"end": current["end"],
@ -123,7 +124,7 @@ class AirtimeApiClient:
"independent_event": current["independent_event"],
}
result[f"{end.isoformat()}_0"] = {
result[f"{end_key}_0"] = {
"type": "stream_output_end",
"start": current["end"],
"end": current["end"],