Add new series won't create a folder

EpisodeFile DB cleanup happens even when series folder is missing
pull/4/head
Mark McDowall 12 years ago
parent 895665c856
commit 40962aca1d

@ -44,14 +44,14 @@ namespace NzbDrone.Core.MediaFiles
private void Scan(Series series) private void Scan(Series series)
{ {
_messageAggregator.PublishCommand(new CleanMediaFileDb(series.Id));
if (!_diskProvider.FolderExists(series.Path)) 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; return;
} }
_messageAggregator.PublishCommand(new CleanMediaFileDb(series.Id));
var mediaFileList = GetVideoFiles(series.Path); var mediaFileList = GetVideoFiles(series.Path);
var decisions = _importDecisionMaker.GetImportDecisions(mediaFileList, series); var decisions = _importDecisionMaker.GetImportDecisions(mediaFileList, series);

@ -90,9 +90,7 @@ namespace NzbDrone.Core.Tv
var successCount = 0; var successCount = 0;
var failCount = 0; var failCount = 0;
var seriesEpisodes = _episodeService.GetEpisodeBySeries(series.Id); var seriesEpisodes = _episodeService.GetEpisodeBySeries(series.Id);
var seasons = _seasonRepository.GetSeasonBySeries(series.Id); var seasons = _seasonRepository.GetSeasonBySeries(series.Id);
var updateList = new List<Episode>(); var updateList = new List<Episode>();
@ -203,6 +201,7 @@ namespace NzbDrone.Core.Tv
/* private void DeleteEpisodesNotAvailableAnymore(Series series, IEnumerable<Episode> onlineEpisodes) /* private void DeleteEpisodesNotAvailableAnymore(Series series, IEnumerable<Episode> onlineEpisodes)
{ {
//Todo: This will not work as currently implemented - what are we trying to do here? //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; return;
_logger.Trace("Starting deletion of episodes that no longer exist in TVDB: {0}", series.Title.WithDefault(series.Id)); _logger.Trace("Starting deletion of episodes that no longer exist in TVDB: {0}", series.Title.WithDefault(series.Id));
foreach (var episode in onlineEpisodes) foreach (var episode in onlineEpisodes)

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

Loading…
Cancel
Save