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; }