mirror of
https://github.com/Radarr/Radarr
synced 2024-12-25 09:21:57 +00:00
Fixed: Scene Name not being stored properly during import if not linked to a download client item and filename is obfuscated
Fixes #5370 Fixes $5358 Fixes #5361
This commit is contained in:
parent
a04f375eb1
commit
460c86911c
3 changed files with 39 additions and 16 deletions
|
@ -171,28 +171,14 @@ public void should_remove_extension_from_nzb_title_for_scene_name(string extensi
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Series")]
|
||||
public void should_not_use_nzb_title_as_scene_name_if_full_season()
|
||||
{
|
||||
GivenNewDownload();
|
||||
_approvedDecisions.First().LocalMovie.Path = Path.Combine(_downloadClientItem.OutputPath.ToString(), "malcolm.in.the.middle.s02e23.dvdrip.xvid-ingot.mkv");
|
||||
_downloadClientItem.Title = "malcolm.in.the.middle.s02.dvdrip.xvid-ingot";
|
||||
|
||||
Subject.Import(new List<ImportDecision> { _approvedDecisions.First() }, true, _downloadClientItem);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<MovieFile>(c => c.SceneName == "malcolm.in.the.middle.s02e23.dvdrip.xvid-ingot")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Series")]
|
||||
public void should_use_file_name_as_scenename_only_if_it_looks_like_scenename()
|
||||
{
|
||||
GivenNewDownload();
|
||||
_approvedDecisions.First().LocalMovie.Path = Path.Combine(_downloadClientItem.OutputPath.ToString(), "malcolm.in.the.middle.s02e23.dvdrip.xvid-ingot.mkv");
|
||||
_approvedDecisions.First().LocalMovie.Path = Path.Combine(_downloadClientItem.OutputPath.ToString(), "movie.title.2018.dvdrip.xvid-ingot.mkv");
|
||||
|
||||
Subject.Import(new List<ImportDecision> { _approvedDecisions.First() }, true);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<MovieFile>(c => c.SceneName == "malcolm.in.the.middle.s02e23.dvdrip.xvid-ingot")));
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<MovieFile>(c => c.SceneName == "movie.title.2018.dvdrip.xvid-ingot")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -206,6 +192,36 @@ public void should_not_use_file_name_as_scenename_if_it_doesnt_looks_like_scenen
|
|||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<MovieFile>(c => c.SceneName == null)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_folder_name_as_scenename_only_if_it_looks_like_scenename()
|
||||
{
|
||||
GivenNewDownload();
|
||||
_approvedDecisions.First().LocalMovie.Path = Path.Combine(_downloadClientItem.OutputPath.ToString(), "aaaaa.mkv");
|
||||
_approvedDecisions.First().LocalMovie.FolderMovieInfo = new ParsedMovieInfo
|
||||
{
|
||||
ReleaseTitle = "movie.title.2018.dvdrip.xvid-ingot"
|
||||
};
|
||||
|
||||
Subject.Import(new List<ImportDecision> { _approvedDecisions.First() }, true);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<MovieFile>(c => c.SceneName == "movie.title.2018.dvdrip.xvid-ingot")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_use_folder_name_as_scenename_if_it_doesnt_looks_like_scenename()
|
||||
{
|
||||
GivenNewDownload();
|
||||
_approvedDecisions.First().LocalMovie.Path = Path.Combine(_downloadClientItem.OutputPath.ToString(), "aaaaa.mkv");
|
||||
_approvedDecisions.First().LocalMovie.FolderMovieInfo = new ParsedMovieInfo
|
||||
{
|
||||
ReleaseTitle = "aaaaa.mkv"
|
||||
};
|
||||
|
||||
Subject.Import(new List<ImportDecision> { _approvedDecisions.First() }, true);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<MovieFile>(c => c.SceneName == null)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_import_larger_files_first()
|
||||
{
|
||||
|
|
|
@ -231,6 +231,12 @@ private string GetSceneName(DownloadClientItem downloadClientItem, LocalMovie lo
|
|||
return sceneNameFile;
|
||||
}
|
||||
|
||||
var folderTitle = localMovie.FolderMovieInfo?.ReleaseTitle;
|
||||
if (folderTitle.IsNotNullOrWhiteSpace() && SceneChecker.IsSceneTitle(folderTitle))
|
||||
{
|
||||
return folderTitle;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,6 +268,7 @@ public void Execute(ManualImportCommand message)
|
|||
if (file.FolderName.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
localMovie.FolderMovieInfo = Parser.Parser.ParseMovieTitle(file.FolderName);
|
||||
localMovie.SceneSource = !existingFile;
|
||||
}
|
||||
|
||||
localMovie = _aggregationService.Augment(localMovie, trackedDownload?.DownloadItem, false);
|
||||
|
|
Loading…
Reference in a new issue