Keeps Radarr/Sonarr quality upgrades out of "Recently Added" by keeping a ledger of the first date added per logical medium (movie or episode, identified by provider ids and the series) and restoring it on upgrades. - core logic without Jellyfin types (Reconciler, MediaKeys, GuardProcessor) - thread-safe ledger with atomic, debounced persistence - event processing via channel and background worker, seed on first start - scheduled task "Ledger synchronisieren", status API, configuration page - xUnit tests and a Jellyfin 12.2 integration test - Gitea workflows: build/test, release with jprm and manifest branch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System;
|
|
using Jellyfin.Plugin.RecentlyAddedGuard.Core;
|
|
using Xunit;
|
|
|
|
namespace Jellyfin.Plugin.RecentlyAddedGuard.Tests;
|
|
|
|
public sealed class MediaKeysTests
|
|
{
|
|
[Fact]
|
|
public void ForMovie_ContainsOnlyKnownProviderIds()
|
|
{
|
|
Assert.Equal(["movie:tmdb:603", "movie:imdb:tt0133093"], MediaKeys.ForMovie(" 603 ", "tt0133093", " "));
|
|
Assert.Empty(MediaKeys.ForMovie(null, null, null));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(1, 5, null, "s1e5")]
|
|
[InlineData(1, 5, 5, "s1e5")]
|
|
[InlineData(1, 5, 6, "s1e5-6")]
|
|
[InlineData(0, 1, null, "s0e1")]
|
|
[InlineData(null, 5, null, null)]
|
|
[InlineData(1, null, null, null)]
|
|
public void EpisodePart_RequiresSeasonAndEpisode(int? season, int? episode, int? episodeEnd, string? expected)
|
|
{
|
|
Assert.Equal(expected, MediaKeys.EpisodePart(season, episode, episodeEnd));
|
|
}
|
|
|
|
[Fact]
|
|
public void ForEpisode_AddsSeriesGuidKeyAlways()
|
|
{
|
|
var series = Guid.Parse("0f3c9bd2-38a5-4e47-9d2b-8bd3a1a3e7c4");
|
|
|
|
var keys = MediaKeys.ForEpisode("s2e3", "393189", "83867", null, series);
|
|
|
|
Assert.Equal(
|
|
["ep:tvdb:393189:s2e3", "ep:tmdb:83867:s2e3", "ep:series-guid:0f3c9bd238a54e479d2b8bd3a1a3e7c4:s2e3"],
|
|
keys);
|
|
Assert.Equal(["ep:series-guid:0f3c9bd238a54e479d2b8bd3a1a3e7c4:s2e3"], MediaKeys.ForEpisode("s2e3", null, null, null, series));
|
|
Assert.Empty(MediaKeys.ForEpisode("s2e3", null, null, null, Guid.Empty));
|
|
}
|
|
}
|