diff --git a/README.md b/README.md index 4cb5f49..804fb2d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# dizqueTV 1.5.2 +# dizqueTV 1.5.3 ![Discord](https://img.shields.io/discord/711313431457693727?logo=discord&logoColor=fff&style=flat-square) ![GitHub top language](https://img.shields.io/github/languages/top/vexorian/dizquetv?logo=github&style=flat-square) ![Docker Pulls](https://img.shields.io/docker/pulls/vexorian/dizquetv?logo=docker&logoColor=fff&style=flat-square) Create live TV channel streams from media on your Plex servers. @@ -75,3 +75,5 @@ npm run dev-server * Original pseudotv-Plex code was released under [MIT license (c) 2020 Dan Ferguson](https://github.com/DEFENDORe/pseudotv/blob/665e71e24ee5e93d9c9c90545addb53fdc235ff6/LICENSE) * dizqueTV's improvements are released under zlib license (c) 2020 Victor Hugo Soliz Kuncar + * FontAwesome: [https://fontawesome.com/license/free](https://archive.fo/PRqis) + * Bootstrap: https://github.com/twbs/bootstrap/blob/v4.4.1/LICENSE \ No newline at end of file diff --git a/index.js b/index.js index 96fe298..cb8f60b 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ const db = require('diskdb') const fs = require('fs') +const unzip = require('unzipper') const path = require('path') const express = require('express') const bodyParser = require('body-parser') @@ -90,6 +91,9 @@ if(!fs.existsSync(path.join(process.env.DATABASE, 'cache','images'))) { channelDB = new ChannelDB( path.join(process.env.DATABASE, 'channels') ); db.connect(process.env.DATABASE, ['channels', 'plex-servers', 'ffmpeg-settings', 'plex-settings', 'xmltv-settings', 'hdhr-settings', 'db-version', 'client-id', 'cache-images', 'settings']) + +let fontAwesome = "fontawesome-free-5.15.4-web"; +let bootstrap = "bootstrap-4.4.1-dist"; initDB(db, channelDB) channelService = new ChannelService(channelDB); @@ -282,6 +286,8 @@ app.use('/custom.css', express.static(path.join(process.env.DATABASE, 'custom.cs // API Routers app.use(api.router(db, channelService, fillerDB, customShowDB, xmltvInterval, guideService, m3uService, eventService )) 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 )) app.use(hdhr.router) @@ -293,6 +299,7 @@ app.listen(process.env.PORT, () => { }) function initDB(db, channelDB) { + //TODO: this is getting so repetitive, do it better if (!fs.existsSync(process.env.DATABASE + '/images/dizquetv.png')) { let data = fs.readFileSync(path.resolve(path.join(__dirname, 'resources/dizquetv.png'))) fs.writeFileSync(process.env.DATABASE + '/images/dizquetv.png', data) @@ -330,7 +337,24 @@ function initDB(db, channelDB) { let data = fs.readFileSync(path.resolve(path.join(__dirname, 'resources', 'default-custom.css'))) fs.writeFileSync( path.join(process.env.DATABASE, 'custom.css'), data) } + if (!fs.existsSync( path.join(process.env.DATABASE, fontAwesome) )) { + + let sourceZip = path.resolve(__dirname, 'resources', fontAwesome) + ".zip"; + let destinationPath = path.resolve(process.env.DATABASE); + + fs.createReadStream(sourceZip) + .pipe(unzip.Extract({ path: destinationPath })); + + } + if (!fs.existsSync( path.join(process.env.DATABASE, bootstrap) )) { + + let sourceZip = path.resolve(__dirname, 'resources', bootstrap) + ".zip"; + let destinationPath = path.resolve(process.env.DATABASE); + fs.createReadStream(sourceZip) + .pipe(unzip.Extract({ path: destinationPath })); + + } } diff --git a/package.json b/package.json index 7182ff1..e99057b 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "random-js": "2.1.0", "request": "^2.88.2", "uuid": "9.0.1", + "unzipper": "0.10.14", "xml-writer": "^1.7.0" }, "bin": "dist/index.js", diff --git a/resources/bootstrap-4.4.1-dist.zip b/resources/bootstrap-4.4.1-dist.zip new file mode 100644 index 0000000..9117d20 Binary files /dev/null and b/resources/bootstrap-4.4.1-dist.zip differ diff --git a/resources/fontawesome-free-5.15.4-web.zip b/resources/fontawesome-free-5.15.4-web.zip new file mode 100644 index 0000000..d731f32 Binary files /dev/null and b/resources/fontawesome-free-5.15.4-web.zip differ diff --git a/src/constants.js b/src/constants.js index 6bdc93a..0a2d664 100644 --- a/src/constants.js +++ b/src/constants.js @@ -35,5 +35,5 @@ module.exports = { // staying active, it checks every 5 seconds PLAYED_MONITOR_CHECK_FREQUENCY: 5*1000, - VERSION_NAME: "1.5.2" + VERSION_NAME: "1.5.3" } diff --git a/src/ffmpeg.js b/src/ffmpeg.js index 779e379..c503279 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -495,9 +495,17 @@ class FFMPEG extends events.EventEmitter { if ( transcodeVideo && (this.audioOnly !== true) ) { // add the video encoder flags ffmpegArgs.push( + '-crf', '22', `-maxrate:v`, `${this.opts.videoBitrate}k`, `-bufsize:v`, `${this.opts.videoBufSize}k` ); + if (this.opts.videoEncoder.toLowerCase() === "mpeg2video") { + // This makes message "impossible bitrate constraints, this will fail" appear but nothing actually fails and it really looks like b:v is the only way to make the video look good when using mpeg2video + ffmpegArgs.push( + `-qscale:v`, `1`, + '-b:v', `${this.opts.videoBitrate}k` + ); + } } if ( transcodeAudio ) { // add the audio encoder flags diff --git a/src/throttler.js b/src/throttler.js index 10e4c67..4e2d1d0 100644 --- a/src/throttler.js +++ b/src/throttler.js @@ -7,8 +7,19 @@ function equalItems(a, b) { if ( (typeof(a) === 'undefined') || a.isOffline || b.isOffline ) { return false; } - console.log("no idea how to compare this: " + JSON.stringify(a) ); - console.log(" with this: " + JSON.stringify(b) ); + if ( + (a.type === "loading") || (a.type === "interlude") + || (b.type === "loading") || (b.type === "interlude") + ) { + return (a.type === b.type); + } + if (a.type != b.type) { + return false; + } + if (a.type !== "program") { + console.log("no idea how to compare this: " + JSON.stringify(a).slice(0,100) ); + console.log(" with this: " + JSON.stringify(b).slice(0,100) ); + } return a.title === b.title; } diff --git a/src/video.js b/src/video.js index c21481c..a2361dd 100644 --- a/src/video.js +++ b/src/video.js @@ -183,6 +183,11 @@ function video( channelService, fillerDB, db, programmingService, activeChannelS return } + if (ffmpegSettings.disablePreludes === true) { + //disable the preludes + isBetween = false; + } + diff --git a/web/public/index.html b/web/public/index.html index e9f8d7b..0524b25 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -4,8 +4,8 @@