-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from MrBrax/develop-ts
Develop ts
- Loading branch information
Showing
11 changed files
with
159 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,5 @@ storage | |
data | ||
**/*.mp4 | ||
**/*.chatdump | ||
**/*.chatdump.line | ||
**/*.chatdump.line | ||
release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,5 @@ vendor/ | |
data/storage | ||
data/cache | ||
data/config | ||
data/payloads | ||
data/payloads | ||
release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const util = require("util"); | ||
const fs = require("fs"); | ||
const exec = util.promisify(require("child_process").exec); | ||
const client_version = require("./client-vue/package.json").version; | ||
const server_version = require("./server/package.json").version; | ||
|
||
console.log(`Client version: ${client_version}`); | ||
console.log(`Server version: ${server_version}`); | ||
|
||
const release_name = `TwitchAutomator-s${server_version}-c${client_version}`; | ||
|
||
if (fs.existsSync(`./release/${release_name}.zip`)) { | ||
fs.unlinkSync(`./release/${release_name}.zip`); | ||
} | ||
|
||
// build client | ||
exec('cd client-vue && yarn install && yarn run build').then(() => { | ||
console.log("Client built"); | ||
|
||
// build server | ||
exec('cd server && yarn install && yarn run build').then(() => { | ||
console.log("Server built"); | ||
|
||
// package files | ||
exec( | ||
`7za a -tzip -r -xr!node_modules ./release/${release_name}.zip ` + | ||
`client-vue/dist ` + | ||
`client-vue/package.json ` + | ||
`server/build ` + | ||
`server/package.json ` + | ||
`server/tsconfig.json ` + | ||
`requirements.txt ` + | ||
`Pipfile ` + | ||
`Pipfile.lock ` + | ||
`vodplayer ` + | ||
`twitch-chat-dumper ` + | ||
`README.md ` + | ||
`LICENSE ` | ||
).then(() => { | ||
console.log("Files packaged"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import cron from "cron"; | ||
import * as CronController from "../Controllers/Cron"; | ||
import { TwitchConfig } from "./TwitchConfig"; | ||
|
||
export class Scheduler { | ||
|
||
public static jobs: Record<string, cron.CronJob> = {}; | ||
|
||
public static schedule(name: string, cronTime: string, callback: () => void): cron.CronJob { | ||
if (this.hasJob(name)) { | ||
this.removeJob(name); | ||
} | ||
const job = new cron.CronJob(cronTime, callback); | ||
this.jobs[name] = job; | ||
job.start(); | ||
return job; | ||
} | ||
|
||
public static defaultJobs() { | ||
// # 0 5 * * 1 curl http://localhost:8080/api/v0/cron/sub | ||
// 0 */12 * * * curl http://localhost:8080/api/v0/cron/check_muted_vods | ||
// 10 */12 * * * curl http://localhost:8080/api/v0/cron/check_deleted_vods | ||
|
||
this.schedule("check_muted_vods", "0 */12 * * *", () => { | ||
if (!TwitchConfig.cfg<boolean>("schedule_muted_vods")) return; | ||
CronController.fCheckMutedVods(); | ||
}); | ||
|
||
this.schedule("check_deleted_vods", "10 */12 * * *", () => { | ||
if (!TwitchConfig.cfg<boolean>("schedule_deleted_vods")) return; | ||
CronController.fCheckDeletedVods(); | ||
}); | ||
|
||
// this.schedule("* * * * *", () => { | ||
// console.log("Cronjob ran", new Date().toISOString()); | ||
// }); | ||
|
||
} | ||
|
||
public static hasJob(name: string) { | ||
return this.jobs[name] !== undefined; | ||
} | ||
|
||
public static removeJob(name: string) { | ||
if (this.hasJob(name)) { | ||
this.jobs[name].stop(); | ||
delete this.jobs[name]; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters