added commands.

they can be triggered using the api

api/command/
This commit is contained in:
Keivan Beigi 2013-04-26 19:03:34 -07:00
commit 182192e0ba
31 changed files with 265 additions and 74 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Linq;
using NLog;
using NzbDrone.Common.Messaging;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
@ -11,7 +12,7 @@ namespace NzbDrone.Core.Indexers
void Sync();
}
public class RssSyncService : IRssSyncService
public class RssSyncService : IRssSyncService, IExecute<RssSyncCommand>
{
private readonly IFetchAndParseRss _rssFetcherAndParser;
private readonly IMakeDownloadDecision _downloadDecisionMaker;
@ -36,7 +37,7 @@ namespace NzbDrone.Core.Indexers
//TODO: this will download multiple of same episode if they show up in RSS. need to
//proposal: maybe get download decision one by one, that way
var qualifiedReports = decisions
.Where(c => c.Approved)
.Select(c => c.Episode)
@ -60,5 +61,10 @@ namespace NzbDrone.Core.Indexers
_logger.Info("RSS Sync Completed. Reports found: {0}, Fetches attempted: {1}", reports.Count, qualifiedReports.Count());
}
public void Execute(RssSyncCommand message)
{
Sync();
}
}
}