Skip to content

Commit

Permalink
1.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
vexorian committed Oct 21, 2024
1 parent 7e9db8c commit 1960338
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)

Create live TV channel streams from media on your Plex servers.
Expand Down
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
}

process.env.unlock = false;
unlockPath = false;
for (let i = 0, l = process.argv.length; i < l; i++) {
if ((process.argv[i] === "-p" || process.argv[i] === "--port") && i + 1 !== l)
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] === "--unlock") {
process.env.unlock = true;
unlockPath = true;
}
}

Expand Down Expand Up @@ -105,7 +106,7 @@ channelService = new ChannelService(channelDB);
fillerDB = new FillerDB( path.join(process.env.DATABASE, 'filler') , channelService );
customShowDB = new CustomShowDB( path.join(process.env.DATABASE, 'custom-shows') );
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() {
try {
Expand Down
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.4"
VERSION_NAME: "1.5.5"
}
12 changes: 7 additions & 5 deletions src/database-migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
const path = require('path');
var fs = require('fs');

const TARGET_VERSION = 804;
const TARGET_VERSION = 805;
const DAY_MS = 1000 * 60 * 60 * 24;

const STEPS = [
Expand All @@ -44,7 +44,8 @@ const STEPS = [
[ 800, 801, (db) => addImageCache(db) ],
[ 801, 802, () => addGroupTitle() ],
[ 802, 803, () => fixNonIntegerDurations() ],
[ 803, 804, (db) => addFFMpegLock(db) ],
[ 803, 805, (db) => addFFMpegLock(db) ],
[ 804, 805, (db) => addFFMpegLock(db) ],
]

const { v4: uuidv4 } = require('uuid');
Expand Down Expand Up @@ -386,7 +387,8 @@ function ffmpeg() {
//How default ffmpeg settings should look
configVersion: 5,
ffmpegPath: "/usr/bin/ffmpeg",
pathLockDate: new Date().getTime() + DAY_MS,
ffmpegPathLockDate: new Date().getTime() + DAY_MS,
threads: 4,
concatMuxDelay: "0",
logFfmpeg: false,
enableFFMPEGTranscoding: true,
Expand Down Expand Up @@ -770,12 +772,12 @@ function addScalingAlgorithm(db) {
function addFFMpegLock(db) {
let ffmpegSettings = db['ffmpeg-settings'].find()[0];
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..");
// We are migrating an existing db that had a ffmpeg path. Make sure
// 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] ) );
}
Expand Down
16 changes: 8 additions & 8 deletions src/services/ffmpeg-settings-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,33 @@ class FfmpegSettingsService {
ffmpeg.lock = true;
}
// Hid this info from the API
delete ffmpeg.pathLockDate;
delete ffmpeg.ffmpegPathLockDate;
return ffmpeg;
}

unlock() {
let ffmpeg = this.getCurrentState();
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)
}


update(attempt) {
let ffmpeg = this.getCurrentState();
attempt.pathLockDate = ffmpeg.pathLockDate;
attempt.ffmpegPathLockDate = ffmpeg.ffmpegPathLockDate;
if (isLocked(ffmpeg)) {
console.log("Note: ffmpeg path is not being updated since it's been locked for your security.");
attempt.ffmpegPath = ffmpeg.ffmpegPath;
if (typeof(ffmpeg.pathLockDate) === 'undefined') {
if (typeof(ffmpeg.ffmpegPathLockDate) === '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) {
// lock it right now
attempt.pathLockDate = new Date().getTime() - DAY_MS;
attempt.ffmpegPathLockDate = new Date().getTime() - DAY_MS;
} else {
attempt.pathLockDate = new Date().getTime() + DAY_MS;
attempt.ffmpegPathLockDate = new Date().getTime() + DAY_MS;
}
delete attempt.addLock;
delete attempt.lock;
Expand Down Expand Up @@ -115,7 +115,7 @@ function isValidFilePath(filePath) {
}

function isLocked(ffmpeg) {
return isNaN(ffmpeg.pathLockDate) || ffmpeg.pathLockDate < new Date().getTime();
return isNaN(ffmpeg.ffmpegPathLockDate) || ffmpeg.ffmpegPathLockDate < new Date().getTime();
}


Expand Down

0 comments on commit 1960338

Please sign in to comment.