Made merging-adjacent programs optional and disabled by default

This commit is contained in:
tim000x3 2025-05-04 04:44:09 -04:00
parent 54ce365f8e
commit 39a99d1ba1
3 changed files with 18 additions and 2 deletions

View File

@ -105,6 +105,11 @@ function cleanUpChannel(channel) {
delete channel.filler;
channel.fallback = channel.fallback.flatMap( cleanUpProgram );
// Set default for mergeAdjacentPrograms if not already defined
if (typeof channel.mergeAdjacentPrograms === 'undefined') {
channel.mergeAdjacentPrograms = false; // Disabled by default for backward compatibility
}
// Calculate total channel duration using effective durations
channel.duration = 0;
for (let i = 0; i < channel.programs.length; i++) {

View File

@ -365,8 +365,10 @@ class TVGuideService extends events.EventEmitter
}
}
// Merge adjacent programs with the same ratingKey
result.programs = this.mergeAdjacentSamePrograms(result.programs);
// Only merge programs if enabled in channel settings
if (channel.mergeAdjacentPrograms === true) {
result.programs = this.mergeAdjacentSamePrograms(result.programs);
}
return result;
}

View File

@ -727,6 +727,15 @@
<span class='text-muted' id="stealthHelp">(This will hide the channel from TV guides, spoofed HDHR, m3u playlist... The channel can still be streamed directly or be used as a redirect target.)</span>
</div>
<div class='form-group' ng-show='! channel.stealth'>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="mergeAdjacentPrograms" ng-model="channel.mergeAdjacentPrograms">
<label class="form-check-label" for="mergeAdjacentPrograms">Merge adjacent programs with same content</label>
<span class='text-muted' id="mergeAdjacentProgramsHelp">(When enabled, adjacent programs with the same content ID will appear as a single program in the guide. This is useful for shows split by commercials or bumpers.)</span>
</div>
</div>
<br></br>
<div class='form-group' ng-show='! channel.stealth'>
<label class='form-label' >Placeholder program title:</label>