Added method to delete orphaned episodeFiles and also cleanup episodes that have invalid episodeFiles.

Cleanup will run aforementioned methods before doing cleanup.
This commit is contained in:
Mark McDowall 2011-06-20 18:49:16 -07:00
commit 68b7ba9209
3 changed files with 65 additions and 1 deletions

View file

@ -196,7 +196,9 @@ namespace NzbDrone.Core.Providers
/// <param name = "files">list of files to verify</param>
public virtual void CleanUp(List<EpisodeFile> files)
{
//TODO: remove orphaned files. in files table but not linked to from episode table.
_mediaFileProvider.CleanEpisodesWithNonExistantFiles();
_mediaFileProvider.DeleteOrphanedEpisodeFiles();
foreach (var episodeFile in files)
{
if (!_diskProvider.FileExists(episodeFile.Path))