Fixed: (MetadataProfile) Allow usage of `Must Not Contain`

pull/2643/head
Bogdan 11 months ago
parent 484c255fd4
commit 38e39449aa

@ -1,3 +1,4 @@
using System.Collections.Generic;
using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.Profiles.Metadata
@ -12,6 +13,11 @@ namespace NzbDrone.Core.Profiles.Metadata
public bool SkipSeriesSecondary { get; set; }
public string AllowedLanguages { get; set; }
public int MinPages { get; set; }
public string Ignored { get; set; }
public List<string> Ignored { get; set; }
public MetadataProfile()
{
Ignored = new List<string>();
}
}
}

@ -158,7 +158,7 @@ namespace NzbDrone.Core.Profiles.Metadata
FilterByPredicate(hash, x => x.ForeignBookId, localHash, profile, (x, p) => !p.SkipMissingDate || x.ReleaseDate.HasValue, "release date is missing");
FilterByPredicate(hash, x => x.ForeignBookId, localHash, profile, (x, p) => !p.SkipPartsAndSets || !IsPartOrSet(x, seriesLinks.GetValueOrDefault(x), titles), "book is part of set");
FilterByPredicate(hash, x => x.ForeignBookId, localHash, profile, (x, p) => !p.SkipSeriesSecondary || !seriesLinks.ContainsKey(x) || seriesLinks[x].Any(y => y.IsPrimary), "book is a secondary series item");
FilterByPredicate(hash, x => x.ForeignBookId, localHash, profile, (x, p) => !MatchesTerms(x.Title, p.Ignored), "contains ignored terms");
FilterByPredicate(hash, x => x.ForeignBookId, localHash, profile, (x, p) => !p.Ignored.Any(i => MatchesTerms(x.Title, i)), "contains ignored terms");
foreach (var book in hash)
{
@ -184,7 +184,7 @@ namespace NzbDrone.Core.Profiles.Metadata
FilterByPredicate(hash, x => x.ForeignEditionId, localHash, profile, (x, p) => !allowedLanguages.Any() || allowedLanguages.Contains(x.Language?.CanonicalizeLanguage()), "edition language not allowed");
FilterByPredicate(hash, x => x.ForeignEditionId, localHash, profile, (x, p) => !p.SkipMissingIsbn || x.Isbn13.IsNotNullOrWhiteSpace() || x.Asin.IsNotNullOrWhiteSpace(), "isbn and asin is missing");
FilterByPredicate(hash, x => x.ForeignEditionId, localHash, profile, (x, p) => !MatchesTerms(x.Title, p.Ignored), "contains ignored terms");
FilterByPredicate(hash, x => x.ForeignEditionId, localHash, profile, (x, p) => !p.Ignored.Any(i => MatchesTerms(x.Title, i)), "contains ignored terms");
return hash.ToList();
}

@ -15,7 +15,7 @@ namespace Readarr.Api.V1.Profiles.Metadata
public bool SkipSeriesSecondary { get; set; }
public string AllowedLanguages { get; set; }
public int MinPages { get; set; }
public string Ignored { get; set; }
public List<string> Ignored { get; set; }
}
public static class MetadataProfileResourceMapper

Loading…
Cancel
Save