Skip to content

Commit

Permalink
Add video URLs to frab XML if they're available.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukegb committed Jan 13, 2024
1 parent 51fd31d commit 5d79380
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/schedule/schedule_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@ def add_persons(event_node, event):


def add_recording(event_node, event):
video = event.get("video", {})

recording_node = etree.SubElement(event_node, "recording")

_add_sub_with_text(recording_node, "license", "CC BY-SA 3.0")
_add_sub_with_text(
recording_node, "optout", "false" if event.get("may_record") else "true"
)
if "ccc" in video:
_add_sub_with_text(recording_node, "url", video["ccc"])
elif "youtube" in video:
_add_sub_with_text(recording_node, "url", video["youtube"])


def export_frab(schedule):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_frab_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def test_export_frab(frab_schema, request_context):
"user_id": 123,
"end_date": _local_datetime(2016, 8, 5, 11, 00),
"start_date": _local_datetime(2016, 8, 5, 10, 30),
"video": {
"ccc": "http://example.com/media.ccc.de",
},
},
{
"id": 2,
Expand All @@ -106,6 +109,9 @@ def test_export_frab(frab_schema, request_context):
"user_id": 123,
"end_date": _local_datetime(2016, 8, 5, 11, 00),
"start_date": _local_datetime(2016, 8, 5, 10, 30),
"video": {
"youtube": "http://example.com/youtube.com",
},
},
{
"id": 3,
Expand All @@ -118,6 +124,10 @@ def test_export_frab(frab_schema, request_context):
"user_id": 123,
"end_date": _local_datetime(2016, 8, 6, 11, 00),
"start_date": _local_datetime(2016, 8, 6, 10, 30),
"video": {
"ccc": "http://example.com/media.ccc.de",
"youtube": "http://example.com/youtube.com",
},
},
]

Expand Down

0 comments on commit 5d79380

Please sign in to comment.