forked from UnicornTranscoder/UnicornTranscoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (33 loc) · 882 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Created by drouar_b on 27/04/2017.
*/
const express = require('express');
const cors = require('cors');
const routes = require('./routes/routes');
const child_process = require('child_process');
const PlexDirectories = require('./utils/plex-directories');
const debug = require('debug')('UnicornTranscoder');
const config = require('./config');
const path = require('path');
let app = express();
app.use(cors());
app.use('/', routes);
//Start EAE
function startEAE() {
debug('Starting EAE');
let eae = child_process.spawn(
PlexDirectories.getEAE(),
[],
{
env: Object.create(process.env),
cwd: path.resolve(config.transcoder.temp_folder)
}
);
eae.on('error', (e) => {
debug("Can't start EAE");
console.error(e);
process.exit(1);
})
}
startEAE();
module.exports = app;