Blacklisting will trigger episode search

This commit is contained in:
Mark McDowall
2013-10-23 22:13:04 -07:00
parent 68e40bca29
commit 8520fe3e0c
12 changed files with 197 additions and 48 deletions

View File

@@ -20,6 +20,8 @@ namespace NzbDrone.Core.History
PagingSpec<History> Paged(PagingSpec<History> pagingSpec);
List<History> BetweenDates(DateTime startDate, DateTime endDate, HistoryEventType eventType);
List<History> Failed();
List<History> Grabbed();
History MostRecentForEpisode(int episodeId);
}
public class HistoryService : IHistoryService, IHandle<EpisodeGrabbedEvent>, IHandle<EpisodeImportedEvent>, IHandle<DownloadFailedEvent>
@@ -53,6 +55,16 @@ namespace NzbDrone.Core.History
return _historyRepository.Failed();
}
public List<History> Grabbed()
{
return _historyRepository.Grabbed();
}
public History MostRecentForEpisode(int episodeId)
{
return _historyRepository.MostRecentForEpisode(episodeId);
}
public void Purge()
{
_historyRepository.Purge();
@@ -122,20 +134,23 @@ namespace NzbDrone.Core.History
public void Handle(DownloadFailedEvent message)
{
var history = new History
foreach (var episodeId in message.EpisodeIds)
{
EventType = HistoryEventType.DownloadFailed,
Date = DateTime.UtcNow,
Quality = message.Quality,
SourceTitle = message.SourceTitle,
SeriesId = message.Series.Id,
EpisodeId = message.Episode.Id,
};
var history = new History
{
EventType = HistoryEventType.DownloadFailed,
Date = DateTime.UtcNow,
Quality = message.Quality,
SourceTitle = message.SourceTitle,
SeriesId = message.SeriesId,
EpisodeId = episodeId,
};
history.Data.Add("DownloadClient", message.DownloadClient);
history.Data.Add("DownloadClientId", message.DownloadClientId);
history.Data.Add("DownloadClient", message.DownloadClient);
history.Data.Add("DownloadClientId", message.DownloadClientId);
_historyRepository.Insert(history);
_historyRepository.Insert(history);
}
}
}
}