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.
40 lines
1.2 KiB
40 lines
1.2 KiB
using NLog;
|
|
using NzbDrone.Core.DecisionEngine;
|
|
using NzbDrone.Core.Download;
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
namespace NzbDrone.Core.MediaFiles.TrackImport.Specifications
|
|
{
|
|
public class NoMissingOrUnmatchedTracksSpecification : IImportDecisionEngineSpecification<LocalAlbumRelease>
|
|
{
|
|
private readonly Logger _logger;
|
|
|
|
public NoMissingOrUnmatchedTracksSpecification(Logger logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public Decision IsSatisfiedBy(LocalAlbumRelease item, DownloadClientItem downloadClientItem)
|
|
{
|
|
if (item.IsSingleFileRelease)
|
|
{
|
|
return Decision.Accept();
|
|
}
|
|
|
|
if (item.NewDownload && item.TrackMapping.LocalExtra.Count > 0)
|
|
{
|
|
_logger.Debug("This release has track files that have not been matched. Skipping {0}", item);
|
|
return Decision.Reject("Has unmatched tracks");
|
|
}
|
|
|
|
if (item.NewDownload && item.TrackMapping.MBExtra.Count > 0)
|
|
{
|
|
_logger.Debug("This release is missing tracks. Skipping {0}", item);
|
|
return Decision.Reject("Has missing tracks");
|
|
}
|
|
|
|
return Decision.Accept();
|
|
}
|
|
}
|
|
}
|