feat: restrict anime trailers, not all animation (v1.0.0.12)
All checks were successful
Publish Release / release (push) Successful in 9s
All checks were successful
Publish Release / release (push) Successful in 9s
v1.0.0.11 kept every animated trailer away from non-animated content, which also blocked Western animation (Pixar, Disney...). Only anime should be restricted. At download, a trailer is tagged ct4j-anime when TMDB has the "anime" or "based on manga" keyword, or it is Animation in ja/zh/ko (keywords are now appended to the details request). At playback, anime trailers are dropped unless the feature is anime (genre "Anime", or those keywords as tags). Western animation follows the normal genre/rating filters again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -147,12 +147,12 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
// Animation is a style, not a topic: animated trailers (anime included) only play
|
||||
// before animated content. Applied before the fallback below, so a live-action
|
||||
// feature never gets one — it gets no trailer instead.
|
||||
var eligible = IsAnimated(feature)
|
||||
// Anime trailers only play before anime. Applied before the fallback below, so
|
||||
// non-anime content never gets one — it gets no trailer instead. Western animation
|
||||
// is not affected and follows the normal filters.
|
||||
var eligible = IsAnimeFeature(feature)
|
||||
? pairs
|
||||
: pairs.Where(p => !IsAnimated(p.Movie)).ToList();
|
||||
: pairs.Where(p => !IsAnimeTrailer(p.Movie)).ToList();
|
||||
|
||||
// Apply enabled filters. If nothing survives, fall back to the eligible pool.
|
||||
var filtered = ApplyFilters(eligible, feature, config);
|
||||
@@ -236,11 +236,19 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Services
|
||||
return new IntroInfo { ItemId = movie.Id, Path = movie.Path };
|
||||
}
|
||||
|
||||
// TMDB tags anime as "Animation"; anime metadata providers (e.g. AniDB) use "Anime".
|
||||
private static readonly string[] AnimatedGenres = { "Animation", "Anime" };
|
||||
// Library items: anime providers (e.g. AniDB) set the "Anime" genre; TMDB-scraped items
|
||||
// carry TMDB keywords as tags ("anime", "based on manga"). "Animation" alone is not enough —
|
||||
// it also covers Western animation.
|
||||
private static readonly string[] AnimeFeatureTags = { "anime", "based on manga" };
|
||||
|
||||
private static bool IsAnimated(BaseItem item)
|
||||
=> item.Genres.Any(g => AnimatedGenres.Contains(g, StringComparer.OrdinalIgnoreCase));
|
||||
private static bool IsAnimeFeature(BaseItem item)
|
||||
=> item.Genres.Contains("Anime", StringComparer.OrdinalIgnoreCase)
|
||||
|| item.Tags.Any(t => AnimeFeatureTags.Contains(t, StringComparer.OrdinalIgnoreCase));
|
||||
|
||||
// Trailers are tagged at download time from TMDB data (see TmdbService.IsAnime).
|
||||
private static bool IsAnimeTrailer(BaseItem item)
|
||||
=> item.Tags.Contains(TrailerTags.Anime, StringComparer.OrdinalIgnoreCase)
|
||||
|| item.Genres.Contains("Anime", StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private static List<(Movie Movie, BaseItem Trailer)> ApplyFilters(
|
||||
List<(Movie Movie, BaseItem Trailer)> pairs,
|
||||
|
||||
Reference in New Issue
Block a user