Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
{% capture nowunix %}{{'now' | date: '%s'}}{% endcapture -%}
{% comment -%}
Finding the conference.
{% endcomment -%}
{% 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}}</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>
{% comment -%}
- The Loop over all videos in the conference is first sorted by room, then by date in the hope to reduce repeating rooms. This probebly does nor work and we should use grouoping by rooms inseide of recoeding dates, bit this also does not work and I don't relay have a solution here. It's probably fine for rooms to repeat inside a day i guess.
{% endcomment -%}
{% 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 -%}
- 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'}}">
{% for video in sorted_conference_media2 -%}
{% capture release_date %}{{media.release_date | date: '%s'}}{% endcapture -%}
{% 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 recording_date.event != ''%}
{% assign recording_date = conference.date -%}
{% else -%}
{% assign recording_date = earliest -%}
{% 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'}}">
{% endif -%}
{% if current_room != video.room -%}
{% if current_room and current_room != '' -%}
<room name="{{video.room}}">
{% else -%}
<room name="{{video.room}}">
{% endif -%}
{% capture current_room %}{{video.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>{{video.recording_date | date: '%Y-%m-%dT%H:%M:%S'}}</date>
<duration>{{duration}}</duration>
<room>{{video.room}}</room>
<slug>{{ video.title | slugify }}</slug>
<url>{{video.url}}</url>
<recording>
{% if video.licence and video.licence != '' -%}
<license>Attribution-NonCommercial-NoDerivatives 4.0 International</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 -%}
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
</recording>
<title>{{ video.title }}</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/>
<description> {{video.content | strip_html }} </description>
<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>