Creates a calendar event from the content of the info page of a self organized session at the CCC
At the moment, the Self Organized Sessions cannot be viewed directly in the Fahrplan app, as in: those cannot be bookmarked in any useful way. So this project came to be to help (at least iOS users) getting those into the own calendar.
[TOC]
- Open the info page of a self organized session in Safari
- Open the share menu and tap the Shortcut name
- The Calendar app opens and shows you the newly created event
- Via iCloud
- Via RoutineHub
- by downloading the the binary Shortcut file from Apple
- Go to the JSON-description page of the shortcut
- Find the key "fields.shortcut.value.downloadURL" and download that URL
- by compiling the source Shortcut file yourself and installing it manually
- there is the XML source:
C3 SoS to Calendar.xml
- there is the JSON source:
C3 SoS to Calendar.json
- there is the XML source:
I used this gist for background info
- Download the download URL
- plutil -convert xml1 -e 'C3 SoS to Calendar.xml' -- 'C3 SoS to Calendar.plist'
- plutil -convert json -e 'C3 SoS to Calendar.json' -- 'C3 SoS to Calendar.plist'
- If you found this because you want to fix the software of the hub: add an ics Button to download an ICS file for the event. Also a JSON-LD document in the page source would be nice.
- If you found this because you want to fix the software of the Fahrplan: detect SOS pages as part of the schedule and allow bookmarking for those.
This is what you are looking for:
// get starting time
var timeStartStr = document.querySelector(".hub-event-details__time").childNodes[0].nodeValue.trim();
// get ending time
var timeEndStr = document.querySelector(".hub-event-details__time").childNodes[4].nodeValue.trim();
// get day number
var dayStr = document.querySelector(".hub-event-details__day").textContent;
var day = parseInt(dayStr.replace(/^(Day|Tag) /i, ""));
// determine current year
var currentYear = parseInt(document.location.pathname.replace(/^\/congress\/([0-9]{4})\//i,"$1"));
// build date from day 0 + event day
var dateStart = new Date(`${currentYear}-12-26T00:00:00.000+01:00`);
dateStart.setDate(dateStart.getDate() + day);
var dateEnd = new Date(dateStart);
// change times of start date to actual starting time
var timeStartSplit = timeStartStr.split(":");
dateStart.setHours(timeStartSplit[0]);
dateStart.setMinutes(timeStartSplit[1]);
// change times of end date to actual ending time
var timeEndSplit = timeEndStr.split(":");
dateEnd.setHours(timeEndSplit[0]);
dateEnd.setMinutes(timeEndSplit[1]);
// get event title
var title = document.querySelector(".hub-head-main").textContent.trim();
// get event location
var location = document.querySelector("main.container.hub-content > article > div.hub-vlayout > div.hub-row.hub-card > div.hub-vlayout-l > div > h2.hub-section-title + div.hub-text").textContent.trim();
// get event description
var description = document.querySelector("main.container.hub-content > article > div.hub-vlayout > div.hub-row.hub-card > div.hub-vlayout-l > div.hub-text > section.hub-markdown").textContent.trim();
// return data to shortcut
completion({
"title": title,
"location": location,
"start": dateStart.toUTCString(),
"end": dateEnd.toUTCString(),
"url": document.location.href,
"notes": description
});
- Max Fuxjäger - Initial work - MaxValue
See also the list of contributors who participated in this project.
I was asked just before 38C3 to create a macro or similar to add SOS to the calendar. At that time I thought it had to be made with ics files and got lost. Some time after 38C3 i needed something to procrastinate with so I finally implemented this Shortcut.