diff --git a/README.md b/README.md index 41d33cf..804fb2d 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ EPG (Guide Information) data is stored to `.dizquetv/xmltv.xml` - Subtitle support. - Auto deinterlace any Plex media not marked `"scanType": "progressive"` - Can be configured to completely force Direct play, if you are ready for the caveats. +- It's up to you if the channels have a life of their own and act as if they continued playing when you weren't watching them or if you want "on-demand" channels that stop their schedules while not being watched. ## Limitations diff --git a/index.js b/index.js index cb8f60b..8f10475 100644 --- a/index.js +++ b/index.js @@ -56,10 +56,13 @@ for (let i = 0, l = process.argv.length; i < l; i++) { process.env.PORT = process.argv[i + 1] if ((process.argv[i] === "-d" || process.argv[i] === "--database") && i + 1 !== l) process.env.DATABASE = process.argv[i + 1] + if ((process.argv[i] === "-v" || process.argv[i] === "--videoport") && i + 1 !== l) + process.env.PORT = process.argv[i + 1] } process.env.DATABASE = process.env.DATABASE || path.join(".", ".dizquetv") process.env.PORT = process.env.PORT || 8000 +process.env.VIDEO_PORT = process.env.VIDEO_PORT || process.env.PORT // Default to serving both on same port if (!fs.existsSync(process.env.DATABASE)) { if (fs.existsSync( path.join(".", ".pseudotv") )) { @@ -289,10 +292,24 @@ app.use('/api/cache/images', cacheImageService.apiRouters()) app.use('/' + fontAwesome, express.static(path.join(process.env.DATABASE, fontAwesome))) app.use('/' + bootstrap, express.static(path.join(process.env.DATABASE, bootstrap))) -app.use(video.router( channelService, fillerDB, db, programmingService, activeChannelService, programPlayTimeDB )) +// TODO: Should the hdhr router be included on the video stream port? I'm not super familiar with its functionality. app.use(hdhr.router) + +// Set up video router on appropriate port +if(process.env.PORT == process.env.VIDEO_PORT) { + app.use(video.router( channelService, fillerDB, db, programmingService, activeChannelService, programPlayTimeDB )) +} else { + // 2nd express app to listen on a different port + let videoApp = express() + videoApp.use(video.router( channelService, fillerDB, db, programmingService, activeChannelService, programPlayTimeDB )) + videoApp.listen(port = process.env.VIDEO_PORT, () => { + console.log(`Video stream server running on port: http://*:${process.env.VIDEO_PORT}`) + }) +} + app.listen(process.env.PORT, () => { console.log(`HTTP server running on port: http://*:${process.env.PORT}`) + // TODO: Resolve hdhr question from above. let hdhrSettings = db['hdhr-settings'].find()[0] if (hdhrSettings.autoDiscovery === true) hdhr.ssdp.start() diff --git a/src/services/tv-guide-service.js b/src/services/tv-guide-service.js index ead286b..1b33c54 100644 --- a/src/services/tv-guide-service.js +++ b/src/services/tv-guide-service.js @@ -562,6 +562,9 @@ function makeEntry(channel, x) { episode: x.program.episode, title: x.program.title, } + } else if (x.program.type === 'track') { + title = x.program.title; + // TODO: Add sub data for tracks here for XML writing } } if (typeof(title)==='undefined') { diff --git a/src/video.js b/src/video.js index a2361dd..f58ef16 100644 --- a/src/video.js +++ b/src/video.js @@ -125,7 +125,8 @@ function video( channelService, fillerDB, db, programmingService, activeChannelS }) let channelNum = parseInt(req.query.channel, 10) - let ff = await ffmpeg.spawnConcat(`http://localhost:${process.env.PORT}/playlist?channel=${channelNum}&audioOnly=${audioOnly}&stepNumber={step}`); + let ff = await ffmpeg.spawnConcat(`http://localhost:${process.env.VIDEO_PORT}/playlist?channel=${channelNum}&audioOnly=${audioOnly}&stepNumber=${step}`); + ff.pipe(res, { end: false} ); }; router.get('/video', async(req, res) => { @@ -599,22 +600,22 @@ function video( channelService, fillerDB, db, programmingService, activeChannelS && (stepNumber == 0) ) { //loading screen - data += `file 'http://localhost:${process.env.PORT}/stream?channel=${channelNum}&first=0&session=${sessionId}&audioOnly=${audioOnly}'\n`; + data += `file 'http://localhost:${process.env.VIDEO_PORT}/stream?channel=${channelNum}&first=0&session=${sessionId}&audioOnly=${audioOnly}'\n`; } let remaining = maxStreamsToPlayInARow; if (stepNumber == 0) { - data += `file 'http://localhost:${process.env.PORT}/stream?channel=${channelNum}&first=1&session=${sessionId}&audioOnly=${audioOnly}'\n` + data += `file 'http://localhost:${process.env.VIDEO_PORT}/stream?channel=${channelNum}&first=1&session=${sessionId}&audioOnly=${audioOnly}'\n` if (transcodingEnabled && (audioOnly !== true)) { - data += `file 'http://localhost:${process.env.PORT}/stream?channel=${channelNum}&between=1&session=${sessionId}&audioOnly=${audioOnly}'\n`; + data += `file 'http://localhost:${process.env.VIDEO_PORT}/stream?channel=${channelNum}&between=1&session=${sessionId}&audioOnly=${audioOnly}'\n`; } remaining--; } for (var i = 0; i < remaining; i++) { - data += `file 'http://localhost:${process.env.PORT}/stream?channel=${channelNum}&session=${sessionId}&audioOnly=${audioOnly}'\n` + data += `file 'http://localhost:${process.env.VIDEO_PORT}/stream?channel=${channelNum}&session=${sessionId}&audioOnly=${audioOnly}'\n` if (transcodingEnabled && (audioOnly !== true) ) { - data += `file 'http://localhost:${process.env.PORT}/stream?channel=${channelNum}&between=1&session=${sessionId}&audioOnly=${audioOnly}'\n` + data += `file 'http://localhost:${process.env.VIDEO_PORT}/stream?channel=${channelNum}&between=1&session=${sessionId}&audioOnly=${audioOnly}'\n` } } diff --git a/src/xmltv.js b/src/xmltv.js index 4b02f5a..784e09d 100644 --- a/src/xmltv.js +++ b/src/xmltv.js @@ -98,6 +98,7 @@ async function _writeProgramme(channel, program, xw, xmlSettings, cacheImageServ xw.writeRaw('\n ') //sub-title + // TODO: Add support for track data (artist, album) here if ( typeof(program.sub) !== 'undefined') { xw.startElement('sub-title') xw.writeAttribute('lang', 'en') diff --git a/web/controllers/guide.js b/web/controllers/guide.js index 1922e8b..f73e719 100644 --- a/web/controllers/guide.js +++ b/web/controllers/guide.js @@ -312,7 +312,7 @@ module.exports = function ($scope, $timeout, dizquetv) { ch.programs.push( { duration: addDuration(b - a), altTitle: altTitle, - showTitle: program.title, + showTitle: program.title, // movie title, episode title or track title subTitle: subTitle, episodeTitle : episodeTitle, start: hasStart,