diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs index 871ec8c1a..005ac2a24 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs @@ -91,7 +91,14 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport localEpisode.MediaInfo = _videoFileInfoReader.GetMediaInfo(file); } - decision = GetDecision(localEpisode); + if (localEpisode.Episodes.Empty()) + { + decision = new ImportDecision(localEpisode, new Rejection("Unable to find episodes")); + } + else + { + decision = GetDecision(localEpisode); + } } else @@ -102,13 +109,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport decision = new ImportDecision(localEpisode, new Rejection("Unable to parse file")); } } - catch (EpisodeNotFoundException e) - { - var localEpisode = new LocalEpisode(); - localEpisode.Path = file; - - decision = new ImportDecision(localEpisode, new Rejection(e.Message)); - } catch (Exception e) { _logger.ErrorException("Couldn't import file. " + file, e); diff --git a/src/NzbDrone.Core/Metadata/ExistingMetadataService.cs b/src/NzbDrone.Core/Metadata/ExistingMetadataService.cs index e89b35be6..fb48ae442 100644 --- a/src/NzbDrone.Core/Metadata/ExistingMetadataService.cs +++ b/src/NzbDrone.Core/Metadata/ExistingMetadataService.cs @@ -59,30 +59,27 @@ namespace NzbDrone.Core.Metadata if (metadata.Type == MetadataType.EpisodeImage || metadata.Type == MetadataType.EpisodeMetadata) { - try - { - var localEpisode = _parsingService.GetLocalEpisode(possibleMetadataFile, message.Series); - - if (localEpisode == null) - { - _logger.Debug("Unable to parse meta data file: {0}", possibleMetadataFile); - break; - } - - if (localEpisode.Episodes.DistinctBy(e => e.EpisodeFileId).Count() > 1) - { - _logger.Debug("Metadata file: {0} does not match existing files.", possibleMetadataFile); - break; - } - - metadata.EpisodeFileId = localEpisode.Episodes.First().EpisodeFileId; + var localEpisode = _parsingService.GetLocalEpisode(possibleMetadataFile, message.Series); + if (localEpisode == null) + { + _logger.Debug("Unable to parse meta data file: {0}", possibleMetadataFile); + break; } - catch (EpisodeNotFoundException e) + + if (localEpisode.Episodes.Empty()) { _logger.Debug("Cannot find related episodes for: {0}", possibleMetadataFile); - continue; + break; } + + if (localEpisode.Episodes.DistinctBy(e => e.EpisodeFileId).Count() > 1) + { + _logger.Debug("Metadata file: {0} does not match existing files.", possibleMetadataFile); + break; + } + + metadata.EpisodeFileId = localEpisode.Episodes.First().EpisodeFileId; } metadataFiles.Add(metadata); diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 2ab763458..e09d61b9e 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -790,7 +790,6 @@ - diff --git a/src/NzbDrone.Core/Parser/EpisodeNotFoundException.cs b/src/NzbDrone.Core/Parser/EpisodeNotFoundException.cs deleted file mode 100644 index 8f04af3e1..000000000 --- a/src/NzbDrone.Core/Parser/EpisodeNotFoundException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using NzbDrone.Common.Exceptions; - -namespace NzbDrone.Core.Parser -{ - public class EpisodeNotFoundException : NzbDroneException - { - public EpisodeNotFoundException(string message, params object[] args) : base(message, args) - { - } - } -} diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index 47c42032a..0610d37f7 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -57,7 +57,7 @@ namespace NzbDrone.Core.Parser else { - parsedEpisodeInfo = Parser.ParsePath(filename); + parsedEpisodeInfo = Parser.ParsePath(filename); } if (parsedEpisodeInfo == null || parsedEpisodeInfo.IsPossibleSpecialEpisode) @@ -78,12 +78,6 @@ namespace NzbDrone.Core.Parser var episodes = GetEpisodes(parsedEpisodeInfo, series, sceneSource); - if (episodes.Empty()) - { - _logger.Debug("No matching episodes found for: {0}", parsedEpisodeInfo); - throw new EpisodeNotFoundException("Unable to find episodes for file: {0}", parsedEpisodeInfo); - } - return new LocalEpisode { Series = series,