Implementing changes from gitlab Merge requests

This commit is contained in:
Austin Tinius 2020-05-14 09:41:34 -07:00
parent bac4b191b2
commit 6d22a72794
3 changed files with 14 additions and 9 deletions

View File

@ -1,12 +1,13 @@
FROM node:12.16
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get install -y ffmpeg && \
rm -rf /var/lib/apt/lists/*
WORKDIR /home/node/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm install -g browserify
RUN npm run build
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y ffmpeg
EXPOSE 8000
CMD [ "npm", "start"]

View File

@ -72,7 +72,7 @@ class FFMPEG extends events.EventEmitter {
if (videoIndex === '-1')
videoIndex = 'v'
if (audioIndex === '-1')
audioIndex === 'a'
audioIndex = 'a'
let sub = (subtitleIndex === '-1' || subtitleIndex === '-2') ? null : lineupItem.streams[subtitleIndex]
@ -112,7 +112,7 @@ class FFMPEG extends events.EventEmitter {
}
}
if (sub === null || lineupItem.type === 'commercial') { // No subs or icon overlays for Commercials
if (sub === null || lineupItem.type === 'commercial') { // No subs or icon overlays for Commercials
tmpargs[vidStream] = '[v]'
tmpargs.splice(vidStream - 1, 0, "-filter_complex", `${iconOverlay}[v1];[v1]${deinterlace}[v]`)
console.log("No Subtitles")
@ -162,13 +162,15 @@ class FFMPEG extends events.EventEmitter {
this.emit('close', code)
else if (code === 0)
this.emit('end')
else if (code === 255)
this.emit('close', code)
else
this.emit('error', { code: code, cmd: `${tmpargs.join(' ')}` })
})
}
kill() {
this.ffmpeg.kill()
this.ffmpeg.kill('SIGQUIT')
}
}
module.exports = FFMPEG
module.exports = FFMPEG

View File

@ -27,6 +27,7 @@ function video(db) {
ffmpeg.on('error', (err) => {
console.error("FFMPEG ERROR", err)
res.status(500).send("FFMPEG ERROR")
return
})
res.on('close', () => { // on HTTP close, kill ffmpeg
@ -34,7 +35,7 @@ function video(db) {
console.log(`\r\nStream ended. Channel: 1 (PseudoTV)`)
})
})
router.get('/video', (req, res) => {
// Check if channel queried is valid
if (typeof req.query.channel === 'undefined') {
@ -69,6 +70,7 @@ function video(db) {
ffmpeg.on('error', (err) => {
console.error("FFMPEG ERROR", err)
res.status(500).send("FFMPEG ERROR")
return
})
ffmpeg.on('end', () => { // On finish transcode - END of program or commercial...
@ -88,4 +90,4 @@ function video(db) {
})
return router
}
}