Compare commits
No commits in common. "5e0e203fa3d2fabbf9ff749540e82029af88ba3e" and "d6d682a4b0873da3b7f508742b2f0059d3d94ce7" have entirely different histories.
5e0e203fa3
...
d6d682a4b0
4 changed files with 1289 additions and 19 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,4 +14,3 @@ tmp
|
|||
config/client_google_auth.json
|
||||
|
||||
## output ##
|
||||
dist
|
||||
|
|
1282
package-lock.json
generated
Normal file
1282
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"axios": "^1.3.4",
|
||||
"cron": "^2.3.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"express": "^4.18.2",
|
||||
"googleapis": "^113.0.0",
|
||||
|
|
24
src/index.ts
24
src/index.ts
|
@ -3,8 +3,6 @@ import GameSource from './GameSource';
|
|||
import fs from 'fs';
|
||||
import Ics from './Ics';
|
||||
|
||||
const CronJob = require('cron').CronJob;
|
||||
|
||||
|
||||
class App {
|
||||
googleCalendar: GoogleCalendar;
|
||||
|
@ -33,19 +31,11 @@ class App {
|
|||
|
||||
const app = new App();
|
||||
|
||||
const start = async () => {
|
||||
const outputFileLocation = 'public/maccabi-haifa-fc.ics';
|
||||
const games = await app.gameSource.getGamesFromHaifa();
|
||||
const icsEvents = app.ics.generateIcsOutputFromGames(games);
|
||||
fs.writeFileSync(outputFileLocation, icsEvents);
|
||||
}
|
||||
|
||||
const job = new CronJob(
|
||||
"0 10 * * *",
|
||||
async () => {
|
||||
console.log("START")
|
||||
const outputFileLocation = 'maccabi-haifa-fc.ics';
|
||||
const games = await app.gameSource.getGamesFromHaifa();
|
||||
const icsEvents = app.ics.generateIcsOutputFromGames(games);
|
||||
fs.writeFileSync(outputFileLocation, icsEvents);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
'Asia/Jerusalem'
|
||||
);
|
||||
|
||||
|
||||
start();
|
Loading…
Reference in a new issue