|
|
@ -214,6 +214,8 @@ namespace NzbDrone.Core.Providers
|
|
|
|
public virtual void CleanUp(IList<EpisodeFile> files)
|
|
|
|
public virtual void CleanUp(IList<EpisodeFile> files)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var episodeFile in files)
|
|
|
|
foreach (var episodeFile in files)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!_diskProvider.FileExists(episodeFile.Path))
|
|
|
|
if(!_diskProvider.FileExists(episodeFile.Path))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -222,14 +224,21 @@ namespace NzbDrone.Core.Providers
|
|
|
|
//Set the EpisodeFileId for each episode attached to this file to 0
|
|
|
|
//Set the EpisodeFileId for each episode attached to this file to 0
|
|
|
|
foreach(var episode in _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId))
|
|
|
|
foreach(var episode in _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
Logger.Trace("Setting EpisodeFileId for Episode: [{0}] to 0");
|
|
|
|
episode.EpisodeFileId = 0;
|
|
|
|
episode.EpisodeFileId = 0;
|
|
|
|
_episodeProvider.UpdateEpisode(episode);
|
|
|
|
_episodeProvider.UpdateEpisode(episode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Delete it from the DB
|
|
|
|
//Delete it from the DB
|
|
|
|
|
|
|
|
Logger.Trace("Removing EpisodeFile from DB.");
|
|
|
|
_mediaFileProvider.Delete(episodeFile.EpisodeFileId);
|
|
|
|
_mediaFileProvider.Delete(episodeFile.EpisodeFileId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Logger.WarnException(ex.Message, ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|