Added housekeeping to cleanup orphaned episodes and history items

This commit is contained in:
Mark McDowall 2013-09-17 22:28:05 -07:00
commit 07b68b17ee
14 changed files with 286 additions and 2 deletions

View file

@ -18,6 +18,7 @@ namespace NzbDrone.Core.History
void Trim();
QualityModel GetBestQualityInHistory(int episodeId);
PagingSpec<History> Paged(PagingSpec<History> pagingSpec);
void CleanupOrphaned();
}
public class HistoryService : IHistoryService, IHandle<EpisodeGrabbedEvent>, IHandle<EpisodeImportedEvent>
@ -41,6 +42,12 @@ namespace NzbDrone.Core.History
return _historyRepository.GetPaged(pagingSpec);
}
public void CleanupOrphaned()
{
_historyRepository.CleanupOrphanedBySeries();
_historyRepository.CleanupOrphanedByEpisode();
}
public void Purge()
{
_historyRepository.Purge();