Converted jobs to dynamic

This commit is contained in:
Mark McDowall 2012-09-10 12:04:17 -07:00
commit a4dde81ceb
42 changed files with 166 additions and 170 deletions

View file

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Jobs
{
@ -30,19 +32,19 @@ namespace NzbDrone.Core.Jobs
get { return TimeSpan.FromTicks(0); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
public void Start(ProgressNotification notification, dynamic options)
{
if (targetId <= 0)
throw new ArgumentOutOfRangeException("targetId");
if (options == null || options.SeriesId <= 0)
throw new ArgumentException("options.SeriesId");
logger.Debug("Getting seasons from database for series: {0}", targetId);
var seasons = _seasonProvider.GetSeasons(targetId).Where(s => s > 0);
logger.Debug("Getting seasons from database for series: {0}", options.SeriesId);
IList<int> seasons = _seasonProvider.GetSeasons(options.SeriesId);
foreach (var season in seasons)
foreach (var season in seasons.Where(s => s > 0))
{
if (!_seasonProvider.IsIgnored(targetId, season))
if (!_seasonProvider.IsIgnored(options.SeriesId, season))
{
_seasonSearchJob.Start(notification, targetId, season);
_seasonSearchJob.Start(notification, new { SeriesId = options.SeriesId, SeasonNumber = season });
}
}
}