From 5a8cb978dc8a9ac93a89005ef85688c551b39691 Mon Sep 17 00:00:00 2001 From: Stefan Schlott Date: Thu, 19 Feb 2015 23:01:39 +0100 Subject: [PATCH] Script for generating Vortragsreihe event placeholders --- content/_data/platzhalter.yaml | 53 ++++++++++++++++++------- scripts/generate-vortragsplatzhalter.rb | 38 ++++++++++++++++++ 2 files changed, 77 insertions(+), 14 deletions(-) create mode 100755 scripts/generate-vortragsplatzhalter.rb diff --git a/content/_data/platzhalter.yaml b/content/_data/platzhalter.yaml index cacbc3a1..67a4be7d 100644 --- a/content/_data/platzhalter.yaml +++ b/content/_data/platzhalter.yaml @@ -1,37 +1,62 @@ --- events: -- title: CCCS Vortragsabend (Thema noch offen) - startdate: 2015-01-08T19:30:00Z +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-01-08 19:30:00.000000000 +01:00 duration: 2h location: location: bib -- title: CCCS Vortragsabend (Thema noch offen) - startdate: 2015-02-12T19:30:00Z +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-02-12 19:30:00.000000000 +01:00 duration: 2h location: location: bib -- title: CCCS Vortragsabend (Thema noch offen) - startdate: 2015-02-12T19:30:00Z +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-03-12 19:30:00.000000000 +01:00 duration: 2h location: location: bib -- title: CCCS Vortragsabend (Thema noch offen) - startdate: 2015-03-12T19:30:00Z +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-04-09 19:30:00.000000000 +02:00 duration: 2h location: location: bib -- title: CCCS Vortragsabend (Thema noch offen) - startdate: 2015-04-09T19:30:00Z +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-05-14 19:30:00.000000000 +02:00 duration: 2h location: location: bib -- title: CCCS Vortragsabend (Thema noch offen) - startdate: 2015-05-14T19:30:00Z +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-06-11 19:30:00.000000000 +02:00 duration: 2h location: location: bib -- title: CCCS Vortragsabend (Thema noch offen) - startdate: 2015-06-11T19:30:00Z +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-07-09 19:30:00.000000000 +02:00 + duration: 2h + location: + location: bib +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-08-13 19:30:00.000000000 +02:00 + duration: 2h + location: + location: bib +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-09-10 19:30:00.000000000 +02:00 + duration: 2h + location: + location: bib +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-10-08 19:30:00.000000000 +02:00 + duration: 2h + location: + location: bib +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-11-12 19:30:00.000000000 +01:00 + duration: 2h + location: + location: bib +- title: CCCS Vortragsreihe (Thema noch offen) + startdate: 2015-12-10 19:30:00.000000000 +01:00 duration: 2h location: location: bib diff --git a/scripts/generate-vortragsplatzhalter.rb b/scripts/generate-vortragsplatzhalter.rb new file mode 100755 index 00000000..362c61fb --- /dev/null +++ b/scripts/generate-vortragsplatzhalter.rb @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby +# encoding: utf-8 + +require 'rubygems' +require 'bundler/setup' + +require 'date' +require 'yaml' + + +def event(day, dayoffset, title) + startDate = Time.local(day.year, day.month, day.day + dayoffset, 19, 30, 0) + { + 'title' => title, + 'startdate' => startDate, + 'duration' => '2h', + 'location' => { + 'location' => 'bib' + } + } +end + + +year=ARGV[0].to_i +result = { 'events' => [] } + +for month in 1..12 + date = Date.new(year,month,1) + firstthursday = if (date.wday<=4) + date + (4-date.wday) + else + date + (11-date.wday) + end + result['events'] << event(firstthursday, 7, 'CCCS Vortragsreihe (Thema noch offen)') +end + +puts result.to_yaml +