1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-20 21:54:58 -04:00

Fixed: Minimum seeding check causing exception when release was pushed via api instead of by indexer.

This commit is contained in:
Taloth Saldono
2017-05-27 22:02:30 +02:00
parent e83e852e0d
commit 8cc02a9d9c
3 changed files with 128 additions and 7 deletions
@@ -1,6 +1,5 @@
using System.Linq;
using NLog;
using NzbDrone.Common.Reflection;
using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
@@ -9,10 +8,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
{
public class TorrentSeedingSpecification : IDecisionEngineSpecification
{
private readonly IndexerFactory _indexerFactory;
private readonly IIndexerFactory _indexerFactory;
private readonly Logger _logger;
public TorrentSeedingSpecification(IndexerFactory indexerFactory, Logger logger)
public TorrentSeedingSpecification(IIndexerFactory indexerFactory, Logger logger)
{
_indexerFactory = indexerFactory;
_logger = logger;
@@ -26,12 +25,22 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
{
var torrentInfo = remoteEpisode.Release as TorrentInfo;
if (torrentInfo == null)
if (torrentInfo == null || torrentInfo.IndexerId == 0)
{
return Decision.Accept();
}
var indexer = _indexerFactory.Get(torrentInfo.IndexerId);
IndexerDefinition indexer;
try
{
indexer = _indexerFactory.Get(torrentInfo.IndexerId);
}
catch (ModelNotFoundException)
{
_logger.Debug("Indexer with id {0} does not exist, skipping seeders check", torrentInfo.IndexerId);
return Decision.Accept();
}
var torrentIndexerSettings = indexer.Settings as ITorrentIndexerSettings;
if (torrentIndexerSettings != null)