mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-10 13:02:47 +01:00
Remove _UNPACK_ and _FAILED_ from folder name before processing
This commit is contained in:
parent
483b39899e
commit
fa5dda8e2f
@ -141,6 +141,26 @@ public void should_delete_folder_if_files_were_imported()
|
|||||||
.Verify(v => v.DeleteFolder(It.IsAny<String>(), true), Times.Once());
|
.Verify(v => v.DeleteFolder(It.IsAny<String>(), true), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("_UNPACK_")]
|
||||||
|
[TestCase("_FAILED_")]
|
||||||
|
public void should_remove_unpack_from_folder_name(string prefix)
|
||||||
|
{
|
||||||
|
var folderName = "30.rock.s01e01.pilot.hdtv-lol";
|
||||||
|
var folders = new[] { String.Format(@"C:\Test\Unsorted\{0}{1}", prefix, folderName) };
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Setup(c => c.GetDirectories(It.IsAny<string>()))
|
||||||
|
.Returns(folders);
|
||||||
|
|
||||||
|
Subject.Execute(new DownloadedEpisodesScanCommand());
|
||||||
|
|
||||||
|
Mocker.GetMock<IParsingService>()
|
||||||
|
.Verify(v => v.GetSeries(folderName), Times.Once());
|
||||||
|
|
||||||
|
Mocker.GetMock<IParsingService>()
|
||||||
|
.Verify(v => v.GetSeries(It.Is<String>(s => s.StartsWith(prefix))), Times.Never());
|
||||||
|
}
|
||||||
|
|
||||||
private void VerifyNoImport()
|
private void VerifyNoImport()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IImportApprovedEpisodes>().Verify(c => c.Import(It.IsAny<List<ImportDecision>>(), true),
|
Mocker.GetMock<IImportApprovedEpisodes>().Verify(c => c.Import(It.IsAny<List<ImportDecision>>(), true),
|
||||||
|
@ -101,11 +101,12 @@ private void ProcessDownloadedEpisodesFolder()
|
|||||||
|
|
||||||
private List<ImportDecision> ProcessSubFolder(DirectoryInfo subfolderInfo)
|
private List<ImportDecision> ProcessSubFolder(DirectoryInfo subfolderInfo)
|
||||||
{
|
{
|
||||||
var series = _parsingService.GetSeries(subfolderInfo.Name);
|
var cleanedUpName = GetCleanedUpFolderName(subfolderInfo.Name);
|
||||||
|
var series = _parsingService.GetSeries(cleanedUpName);
|
||||||
|
|
||||||
if (series == null)
|
if (series == null)
|
||||||
{
|
{
|
||||||
_logger.Debug("Unknown Series {0}", subfolderInfo.Name);
|
_logger.Debug("Unknown Series {0}", cleanedUpName);
|
||||||
return new List<ImportDecision>();
|
return new List<ImportDecision>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +140,14 @@ private List<ImportDecision> ProcessFiles(IEnumerable<string> videoFiles, Series
|
|||||||
return _importApprovedEpisodes.Import(decisions, true);
|
return _importApprovedEpisodes.Import(decisions, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetCleanedUpFolderName(string folder)
|
||||||
|
{
|
||||||
|
folder = folder.Replace("_UNPACK_", "")
|
||||||
|
.Replace("_FAILED_", "");
|
||||||
|
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
public void Execute(DownloadedEpisodesScanCommand message)
|
public void Execute(DownloadedEpisodesScanCommand message)
|
||||||
{
|
{
|
||||||
ProcessDownloadedEpisodesFolder();
|
ProcessDownloadedEpisodesFolder();
|
||||||
|
Loading…
Reference in New Issue
Block a user