feat: add genre, rating, and avoid-repeats trailer filters
All checks were successful
Publish Release / release (push) Successful in 23s
All checks were successful
Publish Release / release (push) Successful in 23s
Trailer selection now supports three optional filters:
- Genre match: prefer trailers whose fake-movie genre overlaps with the
feature being played (requires TMDB genres in NFO)
- Age rating ceiling: exclude trailers rated higher than the feature
(requires TMDB certification in NFO)
- Avoid repeats: cycle through all trailers before replaying any;
resets per-user once the pool is exhausted
Genre and certification are fetched from TMDB at download time via a
single /movie/{id}?append_to_response=release_dates call and written
into the fake-movie NFO as <genre> and <mpaa> tags. All filters fall
back to the full unfiltered pool when no match is found.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
@@ -55,7 +56,7 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Services
|
||||
/// Writes a minimal Jellyfin/Kodi-compatible movie NFO with <lockdata>true</lockdata>
|
||||
/// so Jellyfin never tries to refresh metadata for the fake entry from TMDB.
|
||||
/// </summary>
|
||||
public void WriteNfo(string nfoPath, string title, int? year)
|
||||
public void WriteNfo(string nfoPath, string title, int? year, IReadOnlyList<string>? genres = null, string? mpaa = null)
|
||||
{
|
||||
var settings = new XmlWriterSettings { Indent = true };
|
||||
using var writer = XmlWriter.Create(nfoPath, settings);
|
||||
@@ -64,6 +65,11 @@ namespace Jellyfin.Plugin.CinemaTrailers4Jellyfins.Services
|
||||
writer.WriteElementString("title", title);
|
||||
if (year.HasValue)
|
||||
writer.WriteElementString("year", year.Value.ToString());
|
||||
if (genres != null)
|
||||
foreach (var genre in genres)
|
||||
writer.WriteElementString("genre", genre);
|
||||
if (!string.IsNullOrWhiteSpace(mpaa))
|
||||
writer.WriteElementString("mpaa", mpaa);
|
||||
writer.WriteElementString("lockdata", "true");
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndDocument();
|
||||
|
||||
Reference in New Issue
Block a user