feat: TMDB Discover source + retry yt-dlp once before fallback (v1.0.0.17)
All checks were successful
Publish Release / release (push) Successful in 14s

The fixed TV lists are mostly long-running shows whose first_air_date is
outside ReleaseDateRangeMonths, and paging stops at the first page with no
in-range title, so only ~7 TV candidates were found (5 then dropped by
language). Add a "discover" source per media type that asks /discover for
recent titles in AllowedLanguages, sorted by popularity (1600+ TV results
for en|fr today). TV Discover defaults on, movie Discover off.

yt-dlp failures were mostly passing HTTP 403s from back-to-back requests;
the built-in fallback is sometimes only offered 360p. Retry yt-dlp once
after 15s before falling back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Martin
2026-10-06 00:00:32 -04:00
parent 45405c815d
commit 1de082b96e
6 changed files with 81 additions and 10 deletions

View File

@@ -45,6 +45,8 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Services
_httpClient = new HttpClient(handler) { Timeout = TimeSpan.FromMinutes(10) };
}
private static readonly TimeSpan YtDlpRetryDelay = TimeSpan.FromSeconds(15);
public void Dispose() => _httpClient.Dispose();
/// <summary>
@@ -66,6 +68,14 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Services
if (await DownloadWithYtDlpAsync(youtubeKey, outputPath, preferredHeight, ytDlpPath, ct).ConfigureAwait(false))
return true;
// YouTube answers back-to-back downloads with occasional HTTP 403s that clear on
// their own. One more try after a pause usually gets full quality, where the
// built-in fallback may only be offered a 360p stream.
_logger.LogWarning("|CinemaTrailers4Jellyfins| yt-dlp failed for {Key}; retrying in {Seconds}s.", youtubeKey, YtDlpRetryDelay.TotalSeconds);
await Task.Delay(YtDlpRetryDelay, ct).ConfigureAwait(false);
if (await DownloadWithYtDlpAsync(youtubeKey, outputPath, preferredHeight, ytDlpPath, ct).ConfigureAwait(false))
return true;
_logger.LogWarning("|CinemaTrailers4Jellyfins| yt-dlp failed for {Key}; falling back to the built-in downloader.", youtubeKey);
}