From ad05fa17d91cdd24374e058b9f40ba0c19317f46 Mon Sep 17 00:00:00 2001 From: Marc Fauser <297020273+MarcFauser@users.noreply.github.com> Date: Tue, 15 Sep 2026 00:13:44 +0200 Subject: [PATCH] Skip non-positive provider ids instead of forwarding them A negative placeholder is an established convention in Jellyfin libraries for "do not match this item": the anime providers only search by name when the stored id is empty (AniDbSeriesProvider, AniListSeriesProvider), so writing a deliberately invalid id suppresses a wrong match. Jellyfin stores provider ids as strings and does not validate them as numbers - ProviderIdsExtensions has format validators for IMDb, TMDb, AudioDb and MusicBrainz only. TryGetIntProviderId forwards such a value because NumberStyles.Integer allows a leading sign, so "-1" parses happily. The API then rejects the whole batch and names only the first offending index, so one item costs every lookup in it. Returning null instead drops the field from the request body, because the lookup models use int? and SkipMeApiClient sets JsonIgnoreCondition.WhenWritingNull. No lookup is lost by this: shows are only abandoned when tvdb_series_id, tmdb_id, imdb_series_id AND anilist_id are all null (TryBuildShowLookup), and on the library this was measured against, all 81 affected series carried a Tvdb, Tmdb or Imdb id as well. --- SkipMe.Db.Plugin/Tasks/SyncSegmentsTask.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SkipMe.Db.Plugin/Tasks/SyncSegmentsTask.cs b/SkipMe.Db.Plugin/Tasks/SyncSegmentsTask.cs index 476593c..966a3fc 100644 --- a/SkipMe.Db.Plugin/Tasks/SyncSegmentsTask.cs +++ b/SkipMe.Db.Plugin/Tasks/SyncSegmentsTask.cs @@ -479,8 +479,16 @@ private static string BuildMovieLookupCacheKey(MovieLookupRequest request) private static int? TryGetIntProviderId(BaseItem? item, string provider) { + // Only positive ids are real. Jellyfin stores provider ids as strings and does not + // validate them as numbers, and a negative placeholder is an established convention + // for "do not match this item" - the anime providers only search by name when the id + // is empty, so a deliberately invalid one suppresses a wrong match. Forwarding such a + // value makes the API reject the entire batch, and NumberStyles.Integer parses it + // happily because it allows a leading sign. Returning null instead drops the field + // from the request body via JsonIgnoreCondition.WhenWritingNull. if (item?.ProviderIds.TryGetValue(provider, out var raw) == true - && int.TryParse(raw, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsed)) + && int.TryParse(raw, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsed) + && parsed > 0) { return parsed; }