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:
parent
51378e1e6f
commit
51499f251f
1 changed files with 9 additions and 8 deletions
|
@ -61,19 +61,20 @@ class AirtimeApiClient:
|
||||||
result = {"media": {}}
|
result = {"media": {}}
|
||||||
for item in data:
|
for item in data:
|
||||||
start = isoparse(item["starts"])
|
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 = 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_instance = self.services.show_instance_url(id=item["instance_id"])
|
||||||
show = self.services.show_url(id=show_instance["show_id"])
|
show = self.services.show_url(id=show_instance["show_id"])
|
||||||
|
|
||||||
result["media"][key] = {
|
result["media"][start_key] = {
|
||||||
"start": start.strftime("%Y-%m-%d-%H-%M-%S"),
|
"start": start_key,
|
||||||
"end": end.strftime("%Y-%m-%d-%H-%M-%S"),
|
"end": end_key,
|
||||||
"row_id": item["id"],
|
"row_id": item["id"],
|
||||||
"show_name": show["name"],
|
"show_name": show["name"],
|
||||||
}
|
}
|
||||||
current = result["media"][key]
|
current = result["media"][start_key]
|
||||||
if item["file"]:
|
if item["file"]:
|
||||||
current["independent_event"] = False
|
current["independent_event"] = False
|
||||||
current["type"] = "file"
|
current["type"] = "file"
|
||||||
|
@ -104,7 +105,7 @@ class AirtimeApiClient:
|
||||||
# Stream events are instantaneous
|
# Stream events are instantaneous
|
||||||
current["end"] = current["start"]
|
current["end"] = current["start"]
|
||||||
|
|
||||||
result[f"{key}_0"] = {
|
result[f"{start_key}_0"] = {
|
||||||
"id": current["id"],
|
"id": current["id"],
|
||||||
"type": "stream_output_start",
|
"type": "stream_output_start",
|
||||||
"start": current["start"],
|
"start": current["start"],
|
||||||
|
@ -114,7 +115,7 @@ class AirtimeApiClient:
|
||||||
"independent_event": current["independent_event"],
|
"independent_event": current["independent_event"],
|
||||||
}
|
}
|
||||||
|
|
||||||
result[end.isoformat()] = {
|
result[end_key] = {
|
||||||
"type": "stream_buffer_end",
|
"type": "stream_buffer_end",
|
||||||
"start": current["end"],
|
"start": current["end"],
|
||||||
"end": current["end"],
|
"end": current["end"],
|
||||||
|
@ -123,7 +124,7 @@ class AirtimeApiClient:
|
||||||
"independent_event": current["independent_event"],
|
"independent_event": current["independent_event"],
|
||||||
}
|
}
|
||||||
|
|
||||||
result[f"{end.isoformat()}_0"] = {
|
result[f"{end_key}_0"] = {
|
||||||
"type": "stream_output_end",
|
"type": "stream_output_end",
|
||||||
"start": current["end"],
|
"start": current["end"],
|
||||||
"end": current["end"],
|
"end": current["end"],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue