summaryrefslogtreecommitdiff
path: root/index.ts
diff options
context:
space:
mode:
authorTim Schiewe <git@tforge.de>2018-04-30 18:15:52 +0200
committerTim Schiewe <git@tforge.de>2018-04-30 18:15:52 +0200
commit93b466df50d94d4c15715f5eb4d88a0be7d61c11 (patch)
tree4923ae6a554b6e599af53a401825ec8391250620 /index.ts
parentfba804b69e5cbdbe7cb71d6137b2b2a56230a971 (diff)
downloadsplus-93b466df50d94d4c15715f5eb4d88a0be7d61c11.tar.gz
splus-93b466df50d94d4c15715f5eb4d88a0be7d61c11.zip
Create better structure
Diffstat (limited to 'index.ts')
-rw-r--r--index.ts69
1 files changed, 0 insertions, 69 deletions
diff --git a/index.ts b/index.ts
deleted file mode 100644
index f01ce49..0000000
--- a/index.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-import {readFile} from 'fs';
-import {SplusParser} from './SplusParser';
-let createEvent = (arg) => {};
-let commit = () => {};
-if (process.argv.includes('ics')) {
- createEvent = require('./ICal').createEvent;
- commit = require('./ICal').commit;
-} else {
- createEvent = require('./GoogleCalendar').createEvent;
-}
-
-
-const splusUrl = 'http://splus.ostfalia.de/semesterplan123.php?id=1362F014835FFFD0F67159E302EC1A3C&identifier=%23SPLUS7A3292';
-
-/*
-get(splusUrl, (res) => {
- let data = '';
- res.on('data', chunk => data += chunk);
- res.on('end', () => TODO);
-});
-*/
-
-const baseDate = new Date(2018, 3, 23);
-
-readFile('sample.htm', (err, data) => {
- const lectures = new SplusParser(data.toString()).getLectures(lecture => {
- // Filter some lectures out
- if (lecture.title === '') return false;
- if (lecture.title.indexOf('Mathe-Cafe') !== -1) return false;
- if (lecture.title.indexOf('Mathe-Repetitorium') !== -1) return false;
- if (lecture.title.indexOf('Informatik-Lounge') !== -1) return false;
- if (lecture.title.indexOf('Reservierung') !== -1) return false;
- return lecture.title.indexOf('Kompetenzen') === -1;
- });
-
- lectures.forEach((lec, index) => {
- let beginDate = new Date(baseDate);
-
- beginDate.setDate(beginDate.getDate() + lec.day);
- beginDate.setMinutes(beginDate.getMinutes() + lec.begin * 60);
-
- let endDate = new Date(baseDate);
- endDate.setDate(endDate.getDate() + lec.day);
- endDate.setMinutes(endDate.getMinutes() + lec.end * 60);
-
- console.log(lec.title, beginDate.toISOString(), endDate.toISOString());
-
- createEvent({
- summary: lec.title,
- description: lec.lecturer + (lec.info !== '' ? ' - ' : '') + lec.info,
- location: lec.room,
- start: {
- dateTime: beginDate.toISOString()
- },
- end: {
- dateTime: endDate.toISOString()
- },
- reminders: {
- useDefault: false
- }
- });
-
- // TODO
- if (index == lectures.length - 1) {
- commit();
- }
- })
-});
-