Add new series won't create a folder

EpisodeFile DB cleanup happens even when series folder is missing
This commit is contained in:
Mark McDowall 2013-07-11 18:47:22 -07:00
parent 895665c856
commit 40962aca1d
3 changed files with 9 additions and 12 deletions

View File

@ -44,14 +44,14 @@ namespace NzbDrone.Core.MediaFiles
private void Scan(Series series)
{
_messageAggregator.PublishCommand(new CleanMediaFileDb(series.Id));
if (!_diskProvider.FolderExists(series.Path))
{
Logger.Warn("Series folder doesn't exist: {0}", series.Path);
Logger.Trace("Series folder doesn't exist: {0}", series.Path);
return;
}
_messageAggregator.PublishCommand(new CleanMediaFileDb(series.Id));
var mediaFileList = GetVideoFiles(series.Path);
var decisions = _importDecisionMaker.GetImportDecisions(mediaFileList, series);

View File

@ -90,9 +90,7 @@ namespace NzbDrone.Core.Tv
var successCount = 0;
var failCount = 0;
var seriesEpisodes = _episodeService.GetEpisodeBySeries(series.Id);
var seasons = _seasonRepository.GetSeasonBySeries(series.Id);
var updateList = new List<Episode>();
@ -203,6 +201,7 @@ namespace NzbDrone.Core.Tv
/* private void DeleteEpisodesNotAvailableAnymore(Series series, IEnumerable<Episode> onlineEpisodes)
{
//Todo: This will not work as currently implemented - what are we trying to do here?
* //We were trying to remove episodes that were once on tvdb but were removed, for whatever reason, instead of polluting our DB with them.
return;
_logger.Trace("Starting deletion of episodes that no longer exist in TVDB: {0}", series.Title.WithDefault(series.Id));
foreach (var episode in onlineEpisodes)

View File

@ -37,16 +37,18 @@ namespace NzbDrone.Core.Tv
private readonly IConfigService _configService;
private readonly IMessageAggregator _messageAggregator;
private readonly ISceneMappingService _sceneMappingService;
private readonly IDiskProvider _diskProvider;
private readonly Logger _logger;
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService, IMessageAggregator messageAggregator, ISceneMappingService sceneMappingService, IDiskProvider diskProvider, Logger logger)
public SeriesService(ISeriesRepository seriesRepository,
IConfigService configServiceService,
IMessageAggregator messageAggregator,
ISceneMappingService sceneMappingService,
Logger logger)
{
_seriesRepository = seriesRepository;
_configService = configServiceService;
_messageAggregator = messageAggregator;
_sceneMappingService = sceneMappingService;
_diskProvider = diskProvider;
_logger = logger;
}
@ -55,8 +57,6 @@ namespace NzbDrone.Core.Tv
return _seriesRepository.Get(id).Monitored;
}
public Series GetSeries(int seriesId)
{
return _seriesRepository.Get(seriesId);
@ -70,8 +70,6 @@ namespace NzbDrone.Core.Tv
{
var folderName = FileNameBuilder.CleanFilename(newSeries.Title);
newSeries.Path = Path.Combine(newSeries.RootFolderPath, folderName);
_diskProvider.CreateFolder(newSeries.Path);
}
_logger.Info("Adding Series {0} Path: [{1}]", newSeries, newSeries.Path);