-
Lukas Ruge authoredLukas Ruge authored
frab2.xml 9.78 KiB
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
{% comment -%}
Documentation: https://wiki.chaotikum.org/howto:chaotikumwebsite:media (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 earliest %}{{'now' | date: '%s'}}{% endcapture -%}
{% capture latest %}0{% endcapture -%}
{% assign conference_media = site.media | where_exp: "video", "video.conferences contains conference.acronym" -%}
{% for video in conference_media -%}
{% if video.event and video.event != '' -%}
{% for e in site.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 = earliest -%}
{% endif -%}
{% endif -%}
{% capture recordingdate %}{{recording_date | date: '%s'}}{% endcapture -%}
{% if recordingdate < earliest -%}
{% 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' -%}
{% comment -%}
!!!!!!!!!!!!!!!!!!!! V1
{% endcomment -%}
{% comment -%}
- A day is supposed to have a start and an end. This is probably just helpfull for visualisation in fahrplan apps in not essential... but if we want it, its an extra loop per day I guess...
{% endcomment -%}
<day index="1" date="{{earliest | date: '%Y-%m-%d'}}" start="{{earliest | date: '%Y-%m-%d'}}T00:00:00" end="{{earliest | date: '%Y-%m-%d'}}T23:59:59">
{% for video in sorted_conference_media2 -%}
{% if eventcounter > 1 -%}
</event>
{% endif -%}
{% comment -%}
some fields may be done via the event.xml and can be left out of the video markdown file. However, if added in the markdown file of the video, they overwrite the information in the event.
{% endcomment -%}
{% if video.event and 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.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 -%}
{% for post in site.posts -%}
{% if post.uid == event.uid -%}
{% capture url %}https://chaotikum.org{{post.url}}{% endcapture -%}
{% 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: '%Y-%m-%d'}}T00:00:00" end="{{recording_date | date: '%Y-%m-%d'}}T23:59:59">
{% 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 -%}
{% comment -%}
!!!!!!!!!!!!!! eventcounter als ID ist schlecht! Wie kriegen wir eine eindeutige unveränderliche ID?
{% endcomment -%}
<event id="{{eventcounter}}" guid="{{video.uid}}">
<date>{{recording_date | date: '%Y-%m-%dT%H:%M:%S'}}</date>
<start>{{recording_date | date: '%H:%M'}}</start>
<duration>{{duration}}</duration>
<room>{{room}}</room>
<slug>{{ video.title | 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>
{% endif -%}
<track/>
<type>Talk</type>
{% if video.language and video.language != '' -%}
<language>{{video.language}}</language>
{% else -%}
<language>de</language>
{% endif -%}
<abstract/>
{% if video.content and video.content != '' -%}
<description> {{video.content | strip_html }}
{% for conf in video.conferences -%}
{% for c in site.conferences -%}
{% if conf == c.acronym and c.content != '' -%}
{{c.content| markdownify | strip_html | markdownify | xml_escape}}
{% endif -%}
{% endfor -%}
{% endfor -%}
{% if video.licence and video.licence != '' -%}
{{video.licence | markdownify | strip_html | markdownify| 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 -%}
<logo/>
<persons>
{% for person in video.persons -%}
<person>{{person}}</person>
{% endfor -%}
</persons>
<links/>
<attachments/>
{% if video.file and video.file != '' -%}
<video_download_url>{{video.file}}</video_download_url>
{% endif -%}
{% assign eventcounter = eventcounter | plus: 1 -%}
{% endfor -%}
</event>
</room>
</day>
</schedule>