Merge pull request #354 from vexorian/20210808_dev
Do not clone whole channel just to combine the channel
This commit is contained in:
commit
e001fc2ce7
@ -2,6 +2,7 @@ module.exports = {
|
||||
getCurrentProgramAndTimeElapsed: getCurrentProgramAndTimeElapsed,
|
||||
createLineup: createLineup,
|
||||
getWatermark: getWatermark,
|
||||
generateChannelContext: generateChannelContext,
|
||||
}
|
||||
|
||||
let channelCache = require('./channel-cache');
|
||||
@ -10,6 +11,17 @@ const randomJS = require("random-js");
|
||||
const Random = randomJS.Random;
|
||||
const random = new Random( randomJS.MersenneTwister19937.autoSeed() );
|
||||
|
||||
const CHANNEL_CONTEXT_KEYS = [
|
||||
"disableFillerOverlay",
|
||||
"watermark",
|
||||
"icon",
|
||||
"offlinePicture",
|
||||
"offlineSoundtrack",
|
||||
"name",
|
||||
"transcoding",
|
||||
"number",
|
||||
];
|
||||
|
||||
module.exports.random = random;
|
||||
|
||||
function getCurrentProgramAndTimeElapsed(date, channel) {
|
||||
@ -260,6 +272,7 @@ function pickRandomWithMaxDuration(channel, fillers, maxDuration) {
|
||||
}
|
||||
}
|
||||
|
||||
// any channel thing used here should be added to channel context
|
||||
function getWatermark( ffmpegSettings, channel, type) {
|
||||
if (! ffmpegSettings.enableFFMPEGTranscoding || ffmpegSettings.disableChannelOverlay ) {
|
||||
return null;
|
||||
@ -301,3 +314,12 @@ function getWatermark( ffmpegSettings, channel, type) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function generateChannelContext(channel) {
|
||||
let channelContext = {};
|
||||
for (let i = 0; i < CHANNEL_CONTEXT_KEYS.length; i++) {
|
||||
let key = CHANNEL_CONTEXT_KEYS[i];
|
||||
channelContext[key] = JSON.parse( JSON.stringify(channel[key] ) );
|
||||
}
|
||||
return channelContext;
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ function video( channelDB , fillerDB, db) {
|
||||
};
|
||||
}
|
||||
|
||||
let combinedChannel = JSON.parse( JSON.stringify(brandChannel) );
|
||||
let combinedChannel = helperFuncs.generateChannelContext(brandChannel);
|
||||
combinedChannel.transcoding = channel.transcoding;
|
||||
|
||||
let playerContext = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user