You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/TrashLib/Sonarr/ReleaseProfile/Filters/IncludeExcludeFilter.cs

29 lines
750 B

using Serilog;
using TrashLib.Sonarr.Config;
namespace TrashLib.Sonarr.ReleaseProfile.Filters;
public class IncludeExcludeFilter : IReleaseProfileFilter
{
private readonly ILogger _log;
private readonly ReleaseProfileDataFilterer _filterer;
public IncludeExcludeFilter(ILogger log)
{
_log = log;
_filterer = new ReleaseProfileDataFilterer(log);
}
public ReleaseProfileData Transform(ReleaseProfileData profile, ReleaseProfileConfig config)
{
if (config.Filter == null)
{
return profile;
}
_log.Debug("This profile will be filtered");
var newProfile = _filterer.FilterProfile(profile, config.Filter);
return newProfile ?? profile;
}
}