mirror of
https://github.com/Readarr/Readarr
synced 2025-12-29 19:54:20 +01:00
Fixed: (MetadataProfile) Allow usage of Must Not Contain
This commit is contained in:
parent
484c255fd4
commit
38e39449aa
3 changed files with 10 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore;
|
||||
|
||||
namespace NzbDrone.Core.Profiles.Metadata
|
||||
|
|
@ -12,6 +13,11 @@ public class MetadataProfile : ModelBase
|
|||
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 @@ private List<Book> FilterBooks(IEnumerable<Book> remoteBooks, List<Book> localBo
|
|||
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 @@ private List<Edition> FilterEditions(IEnumerable<Edition> editions, List<Edition
|
|||
|
||||
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 @@ public class MetadataProfileResource : RestResource
|
|||
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…
Reference in a new issue