-
Lukas Ruge authoredLukas Ruge authored
frab.xml 12.60 KiB
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
{% comment -%}
Documentation: https://git.chaotikum.org/chaotikum/website/-/blob/master/docs/content/media.md(Please update if stuff changes here)
{% endcomment -%}
{% capture nowunix %}{{'now' | date: '%s'}}{% endcapture -%}
{% for c in site.conferences -%}
{% if c.acronym == page.title -%}
{% assign conference = c -%}
{% endif -%}
{% endfor -%}
{% comment -%}
Finding the first and last talk to establish the variables "earliest" and "latest". Then converting this into a duration in days.
{% endcomment -%}
{% capture latest %}0{% endcapture -%}
{% assign conference_media = site.media | where_exp: "video", "video.conferences contains conference.acronym" -%}
{% if page.title == 'all' -%}
{% assign conference_media = site.media -%}
{% endif -%}
{% for video in conference_media -%}
{% if video.event and video.event != '' -%}
{% assign events = site.events | where: "uid", video.event -%}
{% for e in events -%}
{% if e.uid == video.event -%}
{% assign event = e -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% if video.recording_date and recording_date.event != ''-%}
{% assign recording_date = video.recording_date -%}
{% elsif event -%}
{% assign recording_date = event.eventdate -%}
{% else -%}
{% if conference.date and recording_date.event != ''%}
{% assign recording_date = conference.date -%}
{% else -%}
{% assign recording_date = now -%}
{% endif -%}
{% endif -%}
{% capture recordingdate %}{{recording_date | date: '%s'}}{% endcapture -%}
{% if earliest and earliest != '' -%}
{% if recordingdate < earliest -%}
{% assign earliest = recordingdate -%}
{% endif -%}
{% else -%}
{% assign earliest = recordingdate -%}
{% endif -%}
{% if recordingdate > latest -%}
{% assign latest = recordingdate -%}
{% endif -%}
{% endfor -%}
{% capture earliestday %} {{earliest | date: '%Y-%m-%d'}}{% endcapture -%}
{% capture earliestdaydate %}{{earliestday | date: '%s'}}{% endcapture -%}
{% capture latestday %} {{latest | date: '%Y-%m-%d'}}{% endcapture -%}
{% capture latestdaydate %}{{latestday | date: '%s'}}{% endcapture -%}
{% assign seconds = latestdaydate | minus: earliestdaydate -%}
{% assign hours = seconds | divided_by: 60 | divided_by: 60 -%}
{% assign days = hours | divided_by: 24 -%}
{% assign days = days | plus: 1 -%}
{% assign eventcounter = 1 -%}
<schedule>
<version>0.1</version>
<conference>
<acronym>{{conference.acronym | downcase }}</acronym>
<title>{{conference.title}}</title>
<start>{{earliest | date: '%Y-%m-%d' }}</start>
<end>{{latest | date: '%Y-%m-%d' }}</end>
<days>{{days}}</days>
<timeslot_duration>00:15</timeslot_duration>
<base_url>{{conference.base_url}}</base_url>
</conference>
{% capture currentday %}{{earliest | date: '%Y-%m-%d' }}{% endcapture -%}
{% assign daynumber = 1 -%}
{% assign sorted_conference_media = conference_media | sort: 'room' -%}
{% assign sorted_conference_media2 = sorted_conference_media | sort: 'release_date' -%}
{% assign dateArray = "" | split: ',' -%}
{% for v in conference_media-%}
{% if v.recording_date and v.recording_date != '' -%}
{% capture recording_date %}{{v.recording_date }}{% endcapture -%}
{% assign dateArray = dateArray | push: recording_date -%}
{% elsif v.event and v.event != '' -%}
{% assign events = site.events | where: "uid", v.event -%}
{% for e in events -%}
{% if e.uid == v.event -%}
{% capture recording_date %}{{e.eventdate }}{% endcapture -%}
{% assign dateArray = dateArray | push: recording_date -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endfor -%}
{% assign dateArray = dateArray | uniq | sort -%}
{% assign videoUidArray = "" | split: ',' -%}
{% for date in dateArray -%}
{% capture date_s %}{{date | date: '%s'}}{% endcapture -%}
{% for v in conference_media -%}
{% capture recording_date_s %}{{v.recording_date | date: '%s'}}{% endcapture -%}
{% if v.recording_date and recording_date_s == date_s -%}
{% assign videoUidArray = videoUidArray | push: v.uid -%}
{% elsif v.event and v.event != '' -%}
{% assign events = site.events | where: "uid", v.event -%}
{% for e in events -%}
{% capture eventdate_s %}{{e.eventdate | date: '%s'}}{% endcapture -%}
{% if eventdate_s == date_s -%}
{% assign videoUidArray = videoUidArray | push: v.uid -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endfor -%}
{% endfor -%}
{% assign videoUidArray = videoUidArray | uniq -%}
{% assign videoArray = "" | split: ',' -%}
{% for videoUid in videoUidArray -%}
{% for v in conference_media -%}
{% if v.uid == videoUid -%}
{% assign videoArray = videoArray | push: v -%}
{% endif -%}
{% endfor -%}
{% endfor -%}
<day index="1" date="{{earliest | date: '%Y-%m-%d'}}" start="{{earliest | date_to_xmlschema}}" end="{{earliest | date_to_xmlschema}}">
{% for video in videoArray -%}
{% if eventcounter > 1 -%}
</event>
{% endif -%}
{% if video.event and video.event != '' -%}
{% assign events = site.events | where: "uid", video.event -%}
{% for e in site.events -%}
{% if e.uid == video.event -%}
{% assign event = e -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% if video.recording_date and video.recording_date != ''-%}
{% assign recording_date = video.recording_date -%}
{% elsif event -%}
{% assign recording_date = event.eventdate -%}
{% else -%}
{% if conference.date and conference.date != ''%}
{% assign recording_date = conference.date -%}
{% else -%}
{% assign recording_date = earliest -%}
{% endif -%}
{% endif -%}
{% if video.room and video.room != ''-%}
{% assign room = video.room -%}
{% elsif event -%}
{% for r in event.locations -%}
{% assign room = r -%}
{% endfor -%}
{% else -%}
{% if conference.room and conference.room != ''%}
{% assign room = conference.room -%}
{% else -%}
{% assign room = "Undisclosed Location" -%}
{% endif -%}
{% endif -%}
{% if video.fahrplan_url and video.fahrplan_url != ''-%}
{% if video.fahrplan_url contains "https://" -%}
{% assign url = video.fahrplan_url -%}
{% else -%}
{% if conference.base_url contains "https://chaotikum.org" -%}
{% capture url %}https://chaotikum.org{{video.url}}{% endcapture -%}
{% else -%}
{% assign url = video.fahrplan_url -%}
{% endif -%}
{% endif -%}
{% elsif event -%}
{% assign posts = site.posts | where: "uid", event.uid -%}
{% for post in posts -%}
{% if post.uid == event.uid -%}
{% capture url %}https://chaotikum.org{{post.url}}{% endcapture -%}
{% assign eventpost = post -%}
{% endif -%}
{% endfor -%}
{% else -%}
{% assign url = "https://chaotikum.org" -%}
{% endif -%}
{% if video.duration and video.duration != ''-%}
{% assign duration = video.duration -%}
{% elsif event -%}
{% capture eventstart %}{{event.eventdate | date: '%s'}}{% endcapture -%}
{% capture eventend %}{{event.eventend | date: '%s'}}{% endcapture -%}
{% assign seconds = eventend | minus: eventstart -%}
{% assign minutes = seconds | divided_by: 60 -%}
{% assign hours = minutes | divided_by: 60 -%}
{% assign minutes = minutes | modulo: 60 -%}
{% if minutes == 0 -%}
{% capture min %}00{% endcapture -%}
{% elsif minutes < 10 -%}
{% capture min %}0{{minutes}}{% endcapture -%}
{% else -%}
{% capture min %}{{minutes}}{% endcapture -%}
{% endif -%}
{% if hours == 0 -%}
{% capture duration %}00:{{min}}{% endcapture -%}
{% elsif hours < 10 -%}
{% capture duration %}0{{hours}}:{{min}}{% endcapture -%}
{% else -%}
{% capture duration %}{{hours}}:{{min}}{% endcapture -%}
{% endif -%}
{% else -%}
{% capture duration %}00:00{% endcapture -%}
{% endif -%}
{% capture recordingday %}{{recording_date | date: '%Y-%m-%d' }}{% endcapture -%}
{% if currentday != recordingday -%}
{% capture current_room %}{% endcapture -%}
{% capture currentday %}{{recordingday | date: '%Y-%m-%d' }}{% endcapture -%}
{% capture recordingdate %}{{currentday | date: '%s'}}{% endcapture -%}
{% assign seconds = recordingdate | minus: earliestdaydate -%}
{% assign hours = seconds | divided_by: 60 | divided_by: 60 -%}
{% assign day = hours | divided_by: 24 -%}
{% assign day = day | plus: 1 -%}
</room>
</day>
<day index="{{day}}" date="{{recording_date | date: '%Y-%m-%d'}}" start="{{recording_date | date_to_xmlschema}}" end="{{recording_date | date_to_xmlschema}}">
{% endif -%}
{% if current_room != room -%}
{% if current_room and current_room != '' -%}
</room>
<room name="{{room}}">
{% else -%}
<room name="{{room}}">
{% endif -%}
{% capture current_room %}{{room }}{% endcapture -%}
{% endif -%}
{% capture ticket_id %} {{video.ticket_id | strip}}{% endcapture -%}
{% capture ticket_id %}{% include media-id.html ticket=ticket_id uid=video.uid rd=recording_date -%}{% endcapture -%}
<event id="{{ticket_id | strip}}" guid="{{video.uid}}">
<date>{{recording_date | date_to_xmlschema}}</date>
<start>{{recording_date | date: '%H:%M'}}</start>
<duration>{{duration}}</duration>
<room>{{room}}</room>
<slug>{{recording_date | date: '%Y-%m-%d'}}-{{ video.title | replace: 'ü', 'u' | replace: 'ö', 'o' | replace: 'ä', 'a' | replace: 'ß', 's' | url_encode | slugify }}</slug>
<url>{{url}}</url>
<recording>
{% if video.licence and video.licence != '' -%}
<license>{{video.licence}}</license>
{% else -%}
<license>Attribution-NonCommercial-NoDerivatives 4.0 International</license>
{% endif -%}
{% if video.optout and video.optout != '' -%}
<optout>{{video.optout}}</optout>
{% else -%}
<optout>false</optout>
{% endif -%}
</recording>
{% assign name_before_title = false -%}
{% for conf in video.conferences -%}
{% for c in site.conferences -%}
{% if conf == c.acronym and c.name_before_title -%}
{% assign name_before_title = true -%}
{% endif -%}
{% endfor -%}
{% endfor -%}
<title>{% if video.persons and name_before_title -%}{{video.persons | join: ", " }}: {% endif -%}{{video.title}}{% for conf in video.conferences -%}{% for c in site.conferences -%}{% if conf == c.acronym -%}{% if c.ecki -%}[{{c.title| strip_html| xml_escape }}]{% endif -%}{% endif -%}{% endfor -%}{% endfor -%}</title>
{% if video.subtitle and video.subtitle != '' -%}
<subtitle>{{ video.subtitle }}</subtitle>
{% else -%}
<subtitle/>
{% endif -%}
<track/>
<type>Talk</type>
{% if video.language and video.language != '' -%}
<language>{{video.language}}</language>
{% else -%}
<language>de</language>
{% endif -%}
<abstract/>
{% capture ccontent %}{{video.content | strip_html | xml_escape }}{% endcapture -%}
{% if ccontent and ccontent != '' -%}
<description>{{ccontent}} 

{% for conf in video.conferences %}
{% for c in site.conferences -%}
{% if conf == c.acronym and c.content != '' -%}
{{c.content | strip_html | xml_escape }} 

{% endif -%}
{% endfor -%}
{% endfor %}
{% if video.licence and video.licence != '' -%}
{{video.licence | strip_html | xml_escape }}
{% else -%}
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (CC BY NC ND 4.0). https://creativecommons.org/licenses/by-nc-nd/4.0/
{% endif -%}</description>
{% else -%}
{% if eventpost and eventpost != '' -%}
{% capture ccontent %}{{eventpost.content | strip_html | xml_escape }}{% endcapture -%}
<description>{{ccontent}} 

{% for conf in video.conferences -%}
{% for c in site.conferences -%}
{% if conf == c.acronym and c.content != '' -%}
{{c.content | strip_html | xml_escape}} 

{% endif -%}
{% endfor -%}
{% endfor -%}
{% if video.licence and video.licence != '' -%}
{{video.licence | strip_html | xml_escape }}
{% else -%}
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (CC BY NC ND 4.0). https://creativecommons.org/licenses/by-nc-nd/4.0/
{% endif -%}</description>
{% else -%}
<description/>
{% endif -%}
{% endif -%}
<logo/>
<persons>
{% for person in video.persons -%}
<person>{{person}}</person>
{% endfor -%}
</persons>
<links/>
{% if video.slides or video.closedcaption -%}
<attachments>
{% if video.slides and video.slides != '' -%}
<attachment href="{{video.slides}}">Slides</attachment>
{% endif -%}
{% if video.closedcaption and video.closedcaption != '' -%}
<attachment href="{{video.closedcaption}}">Closed Captions</attachment>
{% endif -%}
</attachments>
{% else -%}
<attachments/>
{% endif -%}
{% if video.file and video.file != '' -%}
<video_download_url>{{video.file | xml_escape}}</video_download_url>
{% endif -%}
{% assign eventcounter = eventcounter | plus: 1 -%}
{% endfor -%}
</event>
</room>
</day>
</schedule>