cccamp23-schedule: init

This commit is contained in:
Astro 2023-08-15 15:56:54 +02:00
parent 8e5e23360f
commit 35bbd65a50
3 changed files with 64 additions and 0 deletions

5
camp23-schedules/combine.sh Executable file
View File

@ -0,0 +1,5 @@
#! /usr/bin/env bash
set -e
curl -s https://events.ccc.de/camp/2023/hub/api/c/camp23/schedule.xml | xsltproc fix.xsl -

57
camp23-schedules/fix.xsl Normal file
View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="xsl xsi">
<xsl:output method="xml"
version="1.0"
encoding="utf-8"
indent="yes"/>
<xsl:template match="/schedule">
<schedule>
<xsl:apply-templates/>
</schedule>
</xsl:template>
<xsl:template match="/schedule/day">
<day index="{@day}" date="{@date}" start="{@start}" end="{@end}">
<xsl:apply-templates/>
</day>
</xsl:template>
<xsl:template match="/schedule/day/room">
<room name="{@name}" guid="{@guid}">
<xsl:apply-templates/>
</room>
</xsl:template>
<xsl:template match="/schedule/day/room/event">
<event guid="{@guid}" id="{@id}">
<xsl:apply-templates/>
</event>
</xsl:template>
<xsl:template match="/schedule/day/room/event/duration">
<duration>
<xsl:variable name="minutes" select="substring-after(., ':')"/>
<xsl:choose>
<xsl:when test="contains($minutes, ':')">
<xsl:text>00:30</xsl:text>
</xsl:when>
<xsl:when test="number($minutes) &gt;= 60">
<xsl:value-of select="substring-before(., ':')"/>
<xsl:text>:</xsl:text>
<xsl:text>00</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before(., ':')"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="$minutes"/>
</xsl:otherwise>
</xsl:choose>
</duration>
</xsl:template>
<xsl:template match="*">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

View File

@ -48,4 +48,6 @@ in {
museen-dresden = wrapScript "museen-dresden" ./museen-dresden/scrape.rb;
criticalmass = wrapScript "criticalmass" ./criticalmass/scrape.rb;
kosmotique = wrapScript "kosmotique" ./kosmotique/scrape.rb;
cccamp23-schedules = ./camp23-schedules;
}