mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-11 13:32:42 +01:00
c5df00cc87
Fixed: unavailable nzbdrone service will no longer block series from being added.
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System;
|
|
using System.Linq;
|
|
using NLog;
|
|
using NzbDrone.Core.Model.Notification;
|
|
using NzbDrone.Core.Providers;
|
|
|
|
namespace NzbDrone.Core.Jobs
|
|
{
|
|
public class SeriesSearchJob : IJob
|
|
{
|
|
private readonly SeasonSearchJob _seasonSearchJob;
|
|
private readonly SeasonProvider _seasonProvider;
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
public SeriesSearchJob(SeasonSearchJob seasonSearchJob,
|
|
SeasonProvider seasonProvider)
|
|
{
|
|
_seasonSearchJob = seasonSearchJob;
|
|
_seasonProvider = seasonProvider;
|
|
}
|
|
|
|
public string Name
|
|
{
|
|
get { return "Series Search"; }
|
|
}
|
|
|
|
public TimeSpan DefaultInterval
|
|
{
|
|
get { return TimeSpan.FromTicks(0); }
|
|
}
|
|
|
|
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
|
{
|
|
if (targetId <= 0)
|
|
throw new ArgumentOutOfRangeException("targetId");
|
|
|
|
logger.Debug("Getting seasons from database for series: {0}", targetId);
|
|
var seasons = _seasonProvider.GetSeasons(targetId).Where(s => s > 0);
|
|
|
|
foreach (var season in seasons)
|
|
{
|
|
if (!_seasonProvider.IsIgnored(targetId, season))
|
|
{
|
|
_seasonSearchJob.Start(notification, targetId, season);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |