From f49c32f18196061e38576055c4fdf2bf8e8426a3 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 10 Jun 2026 00:41:37 -0400 Subject: [PATCH] feat: add TV show trailer downloads, episode trailers, and movie/TV trailer separation - Download trailers for TV shows from TMDB with separate sources and an independent max-count cap (0 disables a category) - Play trailers before TV episodes via IIntroProvider, limited to the first episode a user watches each day - Tag TV show trailers in their NFO so movies only get movie trailers and episodes only get TV show trailers Co-Authored-By: Claude Sonnet 4.6 --- .../Configuration/PluginConfiguration.cs | 18 +- .../Configuration/config.html | 120 +++++++-- ...fin.Plugin.CinemaTrailers4Jellyfins.csproj | 4 +- .../ScheduledTasks/DownloadTrailersTask.cs | 238 +++++++++++++++--- .../Services/FakeMovieService.cs | 5 +- .../Services/TmdbService.cs | 185 +++++++++----- .../Services/TrailerIntroProvider.cs | 72 +++++- .../Services/TrailerTags.cs | 12 + build.yaml | 15 +- 9 files changed, 542 insertions(+), 127 deletions(-) create mode 100644 Jellyfin.Plugin.CinemaTrailers4Jellyfins/Services/TrailerTags.cs diff --git a/Jellyfin.Plugin.CinemaTrailers4Jellyfins/Configuration/PluginConfiguration.cs b/Jellyfin.Plugin.CinemaTrailers4Jellyfins/Configuration/PluginConfiguration.cs index 7c6515e..4445996 100644 --- a/Jellyfin.Plugin.CinemaTrailers4Jellyfins/Configuration/PluginConfiguration.cs +++ b/Jellyfin.Plugin.CinemaTrailers4Jellyfins/Configuration/PluginConfiguration.cs @@ -8,13 +8,20 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Configuration public string TmdbApiKey { get; set; } = string.Empty; - // ── Sources ─────────────────────────────────────────────────────────── + // ── Sources (Movies) ───────────────────────────────────────────────── public bool SourceNowPlaying { get; set; } = true; public bool SourceUpcoming { get; set; } = true; public bool SourcePopular { get; set; } = false; public bool SourceTopRated { get; set; } = false; + // ── Sources (TV Shows) ─────────────────────────────────────────────── + + public bool SourceTvAiringToday { get; set; } = true; + public bool SourceTvOnTheAir { get; set; } = true; + public bool SourceTvPopular { get; set; } = false; + public bool SourceTvTopRated { get; set; } = false; + // ── Date Range ──────────────────────────────────────────────────────── public int ReleaseDateRangeMonths { get; set; } = 6; @@ -22,7 +29,13 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Configuration // ── Download Settings ───────────────────────────────────────────────── public string DownloadFolder { get; set; } = string.Empty; + + /// Maximum movie trailers to download per run. 0 = don't download movie trailers. public int MaxTrailersToDownload { get; set; } = 20; + + /// Maximum TV show trailers to download per run. 0 = don't download TV show trailers. + public int MaxTvTrailersToDownload { get; set; } = 0; + public int MaxPagesPerSource { get; set; } = 3; public int PreferredVideoHeight { get; set; } = 720; public bool SkipAlreadyDownloaded { get; set; } = true; @@ -52,5 +65,8 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Configuration /// Cycle through all trailers before repeating any. public bool AvoidRepeats { get; set; } = true; + + /// Also inject trailers before TV episodes, but only before the first episode a user watches each day. + public bool TrailersForEpisodes { get; set; } = false; } } diff --git a/Jellyfin.Plugin.CinemaTrailers4Jellyfins/Configuration/config.html b/Jellyfin.Plugin.CinemaTrailers4Jellyfins/Configuration/config.html index e6f1fc5..ca78c44 100644 --- a/Jellyfin.Plugin.CinemaTrailers4Jellyfins/Configuration/config.html +++ b/Jellyfin.Plugin.CinemaTrailers4Jellyfins/Configuration/config.html @@ -72,11 +72,11 @@ - +
-

Trailer Sources

+

Movie Trailer Sources

- Choose which TMDB lists to pull trailers from. Enable multiple for more variety. + Choose which TMDB lists to pull movie trailers from. Enable multiple for more variety.

@@ -120,11 +120,60 @@
+ +
+

TV Show Trailer Sources

+

+ Choose which TMDB lists to pull TV show trailers from. Enable multiple for more variety. + Has no effect if "Max TV show trailers per run" below is set to 0. +

+ +
+ +
+ TV shows airing today. +
+
+ +
+ +
+ TV shows airing in the next 7 days. +
+
+ +
+ +
+ Most popular TV shows on TMDB right now, filtered by the date range below. +
+
+ +
+ +
+ Highest rated TV shows on TMDB, filtered by the date range below. +
+
+
+

Date Range

- +
- Applies to all sources. "Now Playing" and "Upcoming" already have tight date windows - set by TMDB, but this provides an additional filter. + Applies to all sources (movie release date / TV show first-air date). "Now Playing", + "Upcoming", "Airing Today" and "On The Air" already have tight date windows set by + TMDB, but this provides an additional filter.
@@ -153,10 +203,20 @@
- - + +
- Maximum number of trailers to download each time the task runs. Default: 20. + Maximum number of movie trailers to download each time the task runs. + Set to 0 to not download any movie trailers. Default: 20. +
+
+ +
+ + +
+ Maximum number of TV show trailers to download each time the task runs. + Set to 0 to not download any TV show trailers. Default: 0.
@@ -164,7 +224,7 @@
- How many pages to fetch from each TMDB source (20 movies per page). Default: 3. + How many pages to fetch from each TMDB source (20 results per page). Default: 3.
@@ -180,10 +240,10 @@
- Trailers for movies you already own won't be downloaded. + Trailers for movies and TV shows you already own won't be downloaded.
@@ -193,7 +253,7 @@ Skip trailers already downloaded
- If a folder already exists for a movie, don't re-download it. + If a folder already exists for a movie or TV show, don't re-download it.
@@ -268,6 +328,17 @@ Resets automatically once every trailer has been shown. Default: on. + +
+ +
+ Only plays before the first episode a user watches each day — + if you watch several episodes back-to-back, only the first gets trailers. +
+
@@ -295,6 +366,13 @@