mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Fixed an issue when trying to import files
This commit is contained in:
parent
389201a9eb
commit
e8238fb03a
@ -150,18 +150,5 @@ public void failed_parse_shouldnt_blowup_the_process()
|
||||
|
||||
ExceptionVerification.ExpectedErrors(3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_filename_without_extension_when_getting_episodes_from_ParsingService()
|
||||
{
|
||||
var expectedFilename = Path.GetFileNameWithoutExtension(_videoFiles.First());
|
||||
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
|
||||
Subject.GetImportDecisions(_videoFiles, _series);
|
||||
|
||||
Mocker.GetMock<IParsingService>().Verify(v => v.GetEpisodes(expectedFilename, _series), Times.Once());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -77,7 +77,7 @@ public List<ImportDecision> Import(List<ImportDecision> decisions, bool newDownl
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.WarnException("Couldn't add report to download queue. " + localEpisode, e);
|
||||
_logger.WarnException("Couldn't import episode " + localEpisode, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,7 @@ private IEnumerable<ImportDecision> GetDecisions(IEnumerable<String> videoFiles,
|
||||
|
||||
try
|
||||
{
|
||||
var fileWithoutExtension = Path.GetFileNameWithoutExtension(file);
|
||||
var parsedEpisode = _parsingService.GetEpisodes(Path.GetFileNameWithoutExtension(file), series);
|
||||
var parsedEpisode = _parsingService.GetEpisodes(file, series);
|
||||
|
||||
if (parsedEpisode != null)
|
||||
{
|
||||
|
@ -17,5 +17,10 @@ public class LocalEpisode
|
||||
public QualityModel Quality { get; set; }
|
||||
|
||||
public int SeasonNumber { get { return Episodes.Select(c => c.SeasonNumber).Distinct().Single(); } }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Path;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
@ -8,7 +9,7 @@ namespace NzbDrone.Core.Parser
|
||||
{
|
||||
public interface IParsingService
|
||||
{
|
||||
LocalEpisode GetEpisodes(string fileName, Series series);
|
||||
LocalEpisode GetEpisodes(string filename, Series series);
|
||||
Series GetSeries(string title);
|
||||
RemoteEpisode Map(ParsedEpisodeInfo parsedEpisodeInfo);
|
||||
}
|
||||
@ -26,9 +27,9 @@ public ParsingService(IEpisodeService episodeService, ISeriesService seriesServi
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public LocalEpisode GetEpisodes(string fileName, Series series)
|
||||
public LocalEpisode GetEpisodes(string filename, Series series)
|
||||
{
|
||||
var parsedEpisodeInfo = Parser.ParseTitle(fileName);
|
||||
var parsedEpisodeInfo = Parser.ParsePath(filename);
|
||||
|
||||
if (parsedEpisodeInfo == null)
|
||||
{
|
||||
@ -47,7 +48,7 @@ public LocalEpisode GetEpisodes(string fileName, Series series)
|
||||
Series = series,
|
||||
Quality = parsedEpisodeInfo.Quality,
|
||||
Episodes = episodes,
|
||||
Path = fileName,
|
||||
Path = filename,
|
||||
ParsedEpisodeInfo = parsedEpisodeInfo
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user