mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
Fixed an issue with parsing full path instead of filename on import
This should fix Card #61
This commit is contained in:
parent
bb42bb30aa
commit
87731d56bf
2 changed files with 17 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
@ -59,7 +60,7 @@ public void Setup()
|
||||||
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(false);
|
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(false);
|
||||||
_fail3.Setup(c => c.RejectionReason).Returns("_fail3");
|
_fail3.Setup(c => c.RejectionReason).Returns("_fail3");
|
||||||
|
|
||||||
_videoFiles = new List<String> { "The.Office.S03E115.DVDRip.XviD-OSiTV" };
|
_videoFiles = new List<String> { @"C:\Test\Unsorted\The.Office.S03E115.DVDRip.XviD-OSiTV.avi" };
|
||||||
_series = new Series();
|
_series = new Series();
|
||||||
_localEpisode = new LocalEpisode { Series = _series, Path = @"C:\Test\Unsorted\The.Office.S03E115.DVDRip.XviD-OSiTV.avi" };
|
_localEpisode = new LocalEpisode { Series = _series, Path = @"C:\Test\Unsorted\The.Office.S03E115.DVDRip.XviD-OSiTV.avi" };
|
||||||
|
|
||||||
|
@ -88,7 +89,6 @@ public void should_call_all_specifications()
|
||||||
_pass3.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
_pass3.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_rejected_if_single_specs_fail()
|
public void should_return_rejected_if_single_specs_fail()
|
||||||
{
|
{
|
||||||
|
@ -150,6 +150,18 @@ public void failed_parse_shouldnt_blowup_the_process()
|
||||||
|
|
||||||
ExceptionVerification.ExpectedErrors(3);
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
@ -42,7 +43,8 @@ private IEnumerable<ImportDecision> GetDecisions(IEnumerable<String> videoFiles,
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var parsedEpisode = _parsingService.GetEpisodes(file, series);
|
var fileWithoutExtension = Path.GetFileNameWithoutExtension(file);
|
||||||
|
var parsedEpisode = _parsingService.GetEpisodes(Path.GetFileNameWithoutExtension(file), series);
|
||||||
|
|
||||||
if (parsedEpisode != null)
|
if (parsedEpisode != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue