diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2018-05-02 09:15:09 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2018-05-02 09:15:09 +0200 |
| commit | 5cb003e51b7388a6acc50b8fd9acb0c69c119eb4 (patch) | |
| tree | da07bfcdcf8bd1baf29cdf4d6d080614692b7385 /src/index.ts | |
| parent | 567a0f7a2f248cd25b8a5e0e357f9b10c16a9036 (diff) | |
| download | splus-5cb003e51b7388a6acc50b8fd9acb0c69c119eb4.tar.gz splus-5cb003e51b7388a6acc50b8fd9acb0c69c119eb4.zip | |
rm ISource & FileSource, combine request & parsing, split filter from parser
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/index.ts b/src/index.ts index 47bc00c..4fa7c20 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,13 @@ import * as moment from 'moment'; -import {SplusParser} from './core/SplusParser'; import {config} from './config'; +import {SplusApi} from './core/SplusApi'; import {IEvent} from './core/IEvent'; -const baseDate = moment().startOf('week'); - -config.source.getData(baseDate.weeks()).then(async data => { - const lectures = new SplusParser(data.toString()).getLectures(config.lectureFilter); +async function main() { + const baseDate = moment().startOf('week'); + const unfilteredLectures = await SplusApi.getData(config.course, baseDate.weeks()); + const lectures = unfilteredLectures.filter(config.lectureFilter); for (let i = 0; i < lectures.length; i++) { const lec = lectures[i]; @@ -38,4 +38,6 @@ config.source.getData(baseDate.weeks()).then(async data => { } await config.sink.commit(); -}); +} + +main(); |
