Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
vexorian committed Nov 29, 2023
2 parents 323caa2 + 869987b commit 08c81f9
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
24 changes: 24 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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 }));

}
}


Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Binary file added resources/bootstrap-4.4.1-dist.zip
Binary file not shown.
Binary file added resources/fontawesome-free-5.15.4-web.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
8 changes: 8 additions & 0 deletions src/ffmpeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions src/throttler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Expand Down
5 changes: 5 additions & 0 deletions src/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ function video( channelService, fillerDB, db, programmingService, activeChannelS
return
}

if (ffmpegSettings.disablePreludes === true) {
//disable the preludes
isBetween = false;
}




Expand Down
4 changes: 2 additions & 2 deletions web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<title>dizqueTV</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="/favicon.svg" ></link>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css">
<link rel="stylesheet" href="bootstrap-4.4.1-dist/css/bootstrap.min.css">
<link rel="stylesheet" href="fontawesome-free-5.15.4-web/css/all.css">
<link href="style.css" rel="stylesheet">
<link href="custom.css" rel="stylesheet">
<script src="version.js"></script>
Expand Down
12 changes: 12 additions & 0 deletions web/public/templates/ffmpeg-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ <h6>Transcoding Features</h6>
</div>
</div>

<br ></br>
<div class="row">
<div class="col-sm-9">
<div class="form-group">
<input id="disablePreludes" type="checkbox" ng-model="settings.disablePreludes" ng-disabled="isTranscodingNotNeeded()" ></input>
<label for="disablePreludes">Disable Preludes</label>
<small class="form-text text-muted">In an attempt to improve playback, dizqueTV insets really short clips of black screen between videos. The idea is that if the stream pauses because Plex is taking too long to reply, it will pause during one of those black screens instead of interrupting the last second of a video. If you suspect these black screens are causing trouble instead of helping, you can disable them with this option.
</small>
</div>
</div>
</div>

</div>


Expand Down

0 comments on commit 08c81f9

Please sign in to comment.