1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-23 00:03:05 +00:00

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 @@ public DiskScanService(IDiskProvider diskProvider,
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);

View file

@ -90,9 +90,7 @@ private void RefreshEpisodeInfo(Series series, IEnumerable<Episode> remoteEpisod
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 @@ private void RefreshEpisodeInfo(Series series, IEnumerable<Episode> remoteEpisod
/* 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)

View file

@ -37,16 +37,18 @@ public class SeriesService : ISeriesService
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 @@ public bool IsMonitored(int id)
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 @@ public Series AddSeries(Series newSeries)
{ {
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);