mirror of https://github.com/lidarr/Lidarr
Fixed an issue when trying to import files
This commit is contained in:
parent
389201a9eb
commit
e8238fb03a
|
@ -150,18 +150,5 @@ namespace NzbDrone.Core.Test.MediaFileTests.EpisodeImportTests
|
|||
|
||||
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 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
|||
}
|
||||
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 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
|||
|
||||
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 @@ namespace NzbDrone.Core.Parser.Model
|
|||
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 @@ namespace NzbDrone.Core.Parser
|
|||
_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 @@ namespace NzbDrone.Core.Parser
|
|||
Series = series,
|
||||
Quality = parsedEpisodeInfo.Quality,
|
||||
Episodes = episodes,
|
||||
Path = fileName,
|
||||
Path = filename,
|
||||
ParsedEpisodeInfo = parsedEpisodeInfo
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue