diff --git a/dist/index.js b/dist/index.js index 307d910..c502e37 100644 --- a/dist/index.js +++ b/dist/index.js @@ -39,6 +39,7 @@ let fd; let index; let port; let sequences; +let videos; let width; let height; log.info('Starting filmout_manager...'); @@ -57,6 +58,7 @@ async function createTemplate(filePath) { } async function settings() { let sequencesExists = false; + let videosExists = false; if (typeof process.env['FD'] === 'undefined') { log.error('Please include an FD value containing the path to your fd binary in .env'); process.exit(1); @@ -115,6 +117,19 @@ async function settings() { } log.info(`SEQUENCES=${sequences}`); } + if (typeof process.env['VIDEOS'] === 'undefined') { + log.error('Please include a VIDEOS directory where the videos will be located in .env'); + process.exit(7); + } + else { + videos = process.env['VIDEOS']; + videosExists = await files_1.Files.exists(videos); + if (!sequencesExists) { + log.error(`The VIDEOS directory in .env, ${videos}, does not exist`); + process.exit(8); + } + log.info(`VIDEOS=${videos}`); + } } app.get('/', async (req, res, next) => { const dirs = await files_1.Files.enumerateSequences(sequences); diff --git a/dist/index.js.map b/dist/index.js.map index e72e25e..6f4bb2f 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAAsB;AACtB,sDAA8B;AAE9B,2DAA6B;AAI7B,8DAAqC;AAKrC,uDAAyC;AAEzC,+BAAiC;AAEjC,mCAAgC;AAMhC,MAAM,GAAG,GAAY,IAAA,eAAS,EAAC,IAAI,CAAC,CAAC;AACrC,MAAM,GAAG,GAAa,IAAA,iBAAO,GAAE,CAAC;AAChC,IAAI,EAAO,CAAC;AACZ,IAAI,KAAuC,CAAC;AAE5C,IAAI,IAAa,CAAC;AAClB,IAAI,SAAkB,CAAC;AACvB,IAAI,KAAc,CAAC;AACnB,IAAI,MAAe,CAAC;AAEpB,GAAG,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAExC,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,I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AE,CAAC"} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index ad2a6ae..c81c343 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import { v4 as uuid } from 'uuid'; import getType from 'mime'; import type { Logger } from 'winston'; import * as Handlebars from 'handlebars'; +import { Server } from 'ws'; import { createLog } from './log' import { sendMail } from './mail'; @@ -27,6 +28,7 @@ let index : HandlebarsTemplateDelegate; let port : number; let sequences : string; +let videos : string; let width : number; let height : number; @@ -48,6 +50,7 @@ async function createTemplate (filePath : string) : Promise { @@ -116,4 +131,5 @@ async function main () { }); } + main(); \ No newline at end of file