feat: add Trailer Pre-Roll and Feature Pre-Roll bumpers
All checks were successful
Publish Release / release (push) Successful in 14s

Adds two optional IIntroProvider bumper slots, mirroring CherryFloors'
cinema mode plugin: a "Trailer Pre-Roll" played before the trailer block
and a "Feature Pre-Roll" played right before the movie/episode. Each is
configured by picking an existing Jellyfin Movie library, from which a
random Movie is injected as the bumper.

Bump version to 1.0.0.5.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin
2026-06-10 01:13:52 -04:00
parent 18c3c49a26
commit a0bddac48d
6 changed files with 226 additions and 66 deletions

View File

@@ -68,5 +68,15 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Configuration
/// <summary>Also inject trailers before TV episodes, but only before the first episode a user watches each day.</summary>
public bool TrailersForEpisodes { get; set; } = false;
// ── Pre-Roll Bumpers ─────────────────────────────────────────────────
/// <summary>Jellyfin movie library (VirtualFolder ItemId) to pick a random "Trailer Pre-Roll"
/// bumper from, played before the trailer block. Empty = disabled.</summary>
public string TrailerPreRollLibraryId { get; set; } = string.Empty;
/// <summary>Jellyfin movie library (VirtualFolder ItemId) to pick a random "Feature Pre-Roll"
/// bumper from, played after the trailer block, right before the feature. Empty = disabled.</summary>
public string FeaturePreRollLibraryId { get; set; } = string.Empty;
}
}

View File

@@ -341,6 +341,38 @@
</div>
</fieldset>
<!-- Pre-Roll Bumpers -->
<fieldset class="verticalSection verticalSection-extrabottompadding">
<legend><h3 class="sectionTitle">Pre-Roll Bumpers</h3></legend>
<p class="fieldDescription">
Optional: pick existing Jellyfin Movie libraries to pull random bumper
videos from, bookending the trailer block above. Each is independent —
leave either set to "None" to disable it.
</p>
<div class="selectContainer">
<label class="selectLabel" for="trailer-preroll-library">Trailer Pre-Roll library</label>
<select is="emby-select" id="trailer-preroll-library" class="emby-select-withcolor emby-select">
<option value="">— None (disabled) —</option>
</select>
<div class="fieldDescription">
A Movie library to pick a random "Now Playing" style bumper from,
played before the trailer block.
</div>
</div>
<div class="selectContainer">
<label class="selectLabel" for="feature-preroll-library">Feature Pre-Roll library</label>
<select is="emby-select" id="feature-preroll-library" class="emby-select-withcolor emby-select">
<option value="">— None (disabled) —</option>
</select>
<div class="fieldDescription">
A Movie library to pick a random "Feature Presentation" style bumper
from, played right before the movie/episode (after trailers).
</div>
</div>
</fieldset>
<!-- Advanced -->
<fieldset class="verticalSection verticalSection-extrabottompadding">
<legend><h3 class="sectionTitle">Advanced</h3></legend>
@@ -375,7 +407,24 @@
$('.cinemaTrailers4JellyfinsConfigPage').on('pageshow', function () {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(pluginId).then(function (config) {
Promise.all([
ApiClient.getPluginConfiguration(pluginId),
ApiClient.getJSON(ApiClient.getUrl('Library/VirtualFolders'))
]).then(function (results) {
var config = results[0];
var movieFolders = results[1].filter(function (f) { return f.CollectionType === 'movies'; });
[['trailer-preroll-library', config.TrailerPreRollLibraryId],
['feature-preroll-library', config.FeaturePreRollLibraryId]]
.forEach(function (entry) {
var select = document.getElementById(entry[0]);
movieFolders.forEach(function (f) {
var opt = document.createElement('option');
opt.value = f.ItemId;
opt.text = f.Name;
select.appendChild(opt);
});
select.value = entry[1] || '';
});
document.getElementById('tmdb-api-key').value = config.TmdbApiKey || '';
document.getElementById('source-now-playing').checked = config.SourceNowPlaying !== false;
document.getElementById('source-upcoming').checked = config.SourceUpcoming !== false;
@@ -442,6 +491,8 @@
config.FilterByRating = document.getElementById('filter-rating').checked;
config.AvoidRepeats = document.getElementById('avoid-repeats').checked;
config.TrailersForEpisodes = document.getElementById('trailers-for-episodes').checked;
config.TrailerPreRollLibraryId = document.getElementById('trailer-preroll-library').value;
config.FeaturePreRollLibraryId = document.getElementById('feature-preroll-library').value;
ApiClient.updatePluginConfiguration(pluginId, config)
.then(Dashboard.processPluginConfigurationUpdateResult);
});