This commit is contained in:
vexorian 2024-10-21 02:44:51 -04:00
parent 7e9db8c1f6
commit 196033844a
5 changed files with 21 additions and 18 deletions

View File

@ -1,4 +1,4 @@
# dizqueTV 1.5.4 # dizqueTV 1.5.5
![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) ![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. Create live TV channel streams from media on your Plex servers.

View File

@ -51,14 +51,15 @@ if (NODE < 12) {
console.error(`WARNING: Your nodejs version ${process.version} is lower than supported. dizqueTV has been tested best on nodejs 12.16.`); console.error(`WARNING: Your nodejs version ${process.version} is lower than supported. dizqueTV has been tested best on nodejs 12.16.`);
} }
process.env.unlock = false; unlockPath = false;
for (let i = 0, l = process.argv.length; i < l; i++) { for (let i = 0, l = process.argv.length; i < l; i++) {
if ((process.argv[i] === "-p" || process.argv[i] === "--port") && i + 1 !== l) if ((process.argv[i] === "-p" || process.argv[i] === "--port") && i + 1 !== l)
process.env.PORT = process.argv[i + 1] process.env.PORT = process.argv[i + 1]
if ((process.argv[i] === "-d" || process.argv[i] === "--database") && i + 1 !== l) if ((process.argv[i] === "-d" || process.argv[i] === "--database") && i + 1 !== l)
process.env.DATABASE = process.argv[i + 1] process.env.DATABASE = process.argv[i + 1]
if (process.argv[i] === "--unlock") { if (process.argv[i] === "--unlock") {
process.env.unlock = true; unlockPath = true;
} }
} }
@ -105,7 +106,7 @@ channelService = new ChannelService(channelDB);
fillerDB = new FillerDB( path.join(process.env.DATABASE, 'filler') , channelService ); fillerDB = new FillerDB( path.join(process.env.DATABASE, 'filler') , channelService );
customShowDB = new CustomShowDB( path.join(process.env.DATABASE, 'custom-shows') ); customShowDB = new CustomShowDB( path.join(process.env.DATABASE, 'custom-shows') );
let programPlayTimeDB = new ProgramPlayTimeDB( path.join(process.env.DATABASE, 'play-cache') ); let programPlayTimeDB = new ProgramPlayTimeDB( path.join(process.env.DATABASE, 'play-cache') );
let ffmpegSettingsService = new FfmpegSettingsService(db, process.env.unlock); let ffmpegSettingsService = new FfmpegSettingsService(db, unlockPath);
async function initializeProgramPlayTimeDB() { async function initializeProgramPlayTimeDB() {
try { try {

View File

@ -35,5 +35,5 @@ module.exports = {
// staying active, it checks every 5 seconds // staying active, it checks every 5 seconds
PLAYED_MONITOR_CHECK_FREQUENCY: 5*1000, PLAYED_MONITOR_CHECK_FREQUENCY: 5*1000,
VERSION_NAME: "1.5.4" VERSION_NAME: "1.5.5"
} }

View File

@ -20,7 +20,7 @@
const path = require('path'); const path = require('path');
var fs = require('fs'); var fs = require('fs');
const TARGET_VERSION = 804; const TARGET_VERSION = 805;
const DAY_MS = 1000 * 60 * 60 * 24; const DAY_MS = 1000 * 60 * 60 * 24;
const STEPS = [ const STEPS = [
@ -44,7 +44,8 @@ const STEPS = [
[ 800, 801, (db) => addImageCache(db) ], [ 800, 801, (db) => addImageCache(db) ],
[ 801, 802, () => addGroupTitle() ], [ 801, 802, () => addGroupTitle() ],
[ 802, 803, () => fixNonIntegerDurations() ], [ 802, 803, () => fixNonIntegerDurations() ],
[ 803, 804, (db) => addFFMpegLock(db) ], [ 803, 805, (db) => addFFMpegLock(db) ],
[ 804, 805, (db) => addFFMpegLock(db) ],
] ]
const { v4: uuidv4 } = require('uuid'); const { v4: uuidv4 } = require('uuid');
@ -386,7 +387,8 @@ function ffmpeg() {
//How default ffmpeg settings should look //How default ffmpeg settings should look
configVersion: 5, configVersion: 5,
ffmpegPath: "/usr/bin/ffmpeg", ffmpegPath: "/usr/bin/ffmpeg",
pathLockDate: new Date().getTime() + DAY_MS, ffmpegPathLockDate: new Date().getTime() + DAY_MS,
threads: 4,
concatMuxDelay: "0", concatMuxDelay: "0",
logFfmpeg: false, logFfmpeg: false,
enableFFMPEGTranscoding: true, enableFFMPEGTranscoding: true,
@ -770,12 +772,12 @@ function addScalingAlgorithm(db) {
function addFFMpegLock(db) { function addFFMpegLock(db) {
let ffmpegSettings = db['ffmpeg-settings'].find()[0]; let ffmpegSettings = db['ffmpeg-settings'].find()[0];
let f = path.join(process.env.DATABASE, 'ffmpeg-settings.json'); let f = path.join(process.env.DATABASE, 'ffmpeg-settings.json');
if ( typeof(ffmpegSettings.pathLockDate) === 'undefined' || ffmpegSettings.pathLockDate == null ) { if ( typeof(ffmpegSettings.ffmpegPathLockDate) === 'undefined' || ffmpegSettings.ffmpegPathLockDate == null ) {
console.log("Adding ffmpeg lock. For your security it will not be possible to modify the ffmpeg path using the UI anymore unless you launch dizquetv by following special instructions.."); console.log("Adding ffmpeg lock. For your security it will not be possible to modify the ffmpeg path using the UI anymore unless you launch dizquetv by following special instructions..");
// We are migrating an existing db that had a ffmpeg path. Make sure // We are migrating an existing db that had a ffmpeg path. Make sure
// it's already locked. // it's already locked.
ffmpegSettings.pathLockDate = new Date().getTime() - 2 * DAY_MS; ffmpegSettings.ffmpegPathLockDate = new Date().getTime() - 2 * DAY_MS;
} }
fs.writeFileSync( f, JSON.stringify( [ffmpegSettings] ) ); fs.writeFileSync( f, JSON.stringify( [ffmpegSettings] ) );
} }

View File

@ -17,33 +17,33 @@ class FfmpegSettingsService {
ffmpeg.lock = true; ffmpeg.lock = true;
} }
// Hid this info from the API // Hid this info from the API
delete ffmpeg.pathLockDate; delete ffmpeg.ffmpegPathLockDate;
return ffmpeg; return ffmpeg;
} }
unlock() { unlock() {
let ffmpeg = this.getCurrentState(); let ffmpeg = this.getCurrentState();
console.log("ffmpeg path UI unlocked for another day..."); console.log("ffmpeg path UI unlocked for another day...");
ffmpeg.pathLockDate = new Date().getTime() + DAY_MS; ffmpeg.ffmpegPathLockDate = new Date().getTime() + DAY_MS;
this.db['ffmpeg-settings'].update({ _id: ffmpeg._id }, ffmpeg) this.db['ffmpeg-settings'].update({ _id: ffmpeg._id }, ffmpeg)
} }
update(attempt) { update(attempt) {
let ffmpeg = this.getCurrentState(); let ffmpeg = this.getCurrentState();
attempt.pathLockDate = ffmpeg.pathLockDate; attempt.ffmpegPathLockDate = ffmpeg.ffmpegPathLockDate;
if (isLocked(ffmpeg)) { if (isLocked(ffmpeg)) {
console.log("Note: ffmpeg path is not being updated since it's been locked for your security."); console.log("Note: ffmpeg path is not being updated since it's been locked for your security.");
attempt.ffmpegPath = ffmpeg.ffmpegPath; attempt.ffmpegPath = ffmpeg.ffmpegPath;
if (typeof(ffmpeg.pathLockDate) === 'undefined') { if (typeof(ffmpeg.ffmpegPathLockDate) === 'undefined') {
// make sure to lock it even if it was undefined // make sure to lock it even if it was undefined
attempt.pathLockDate = new Date().getTime() - DAY_MS; attempt.ffmpegPathLockDate = new Date().getTime() - DAY_MS;
} }
} else if (attempt.addLock === true) { } else if (attempt.addLock === true) {
// lock it right now // lock it right now
attempt.pathLockDate = new Date().getTime() - DAY_MS; attempt.ffmpegPathLockDate = new Date().getTime() - DAY_MS;
} else { } else {
attempt.pathLockDate = new Date().getTime() + DAY_MS; attempt.ffmpegPathLockDate = new Date().getTime() + DAY_MS;
} }
delete attempt.addLock; delete attempt.addLock;
delete attempt.lock; delete attempt.lock;
@ -115,7 +115,7 @@ function isValidFilePath(filePath) {
} }
function isLocked(ffmpeg) { function isLocked(ffmpeg) {
return isNaN(ffmpeg.pathLockDate) || ffmpeg.pathLockDate < new Date().getTime(); return isNaN(ffmpeg.ffmpegPathLockDate) || ffmpeg.ffmpegPathLockDate < new Date().getTime();
} }