Fixed manual import of unknown episodes.
This commit is contained in:
parent
af060d73cc
commit
429298c68c
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
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;
|
||||
|
||||
_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);
|
||||
|
|
|
@ -790,7 +790,6 @@
|
|||
<Compile Include="Organizer\NamingConfig.cs" />
|
||||
<Compile Include="Organizer\NamingConfigService.cs" />
|
||||
<Compile Include="Organizer\SampleResult.cs" />
|
||||
<Compile Include="Parser\EpisodeNotFoundException.cs" />
|
||||
<Compile Include="Parser\InvalidDateException.cs" />
|
||||
<Compile Include="Parser\Language.cs" />
|
||||
<Compile Include="Parser\Model\LocalEpisode.cs" />
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue