diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs index a7d57ab7a..7efd8eb71 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs @@ -32,8 +32,6 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [SetUp] public void Setup() { - ParseMovieTitle(); - _pass1 = new Mock(); _pass2 = new Mock(); _pass3 = new Mock(); diff --git a/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixture.cs index 4bf161c96..3cae416c9 100644 --- a/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixture.cs @@ -58,8 +58,6 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads .Setup(s => s.Map(It.Is(i => i.PrimaryMovieTitle == "A Movie"), It.IsAny(), null)) .Returns(remoteMovie); - ParseMovieTitle(); - var client = new DownloadClientDefinition() { Id = 1, @@ -110,8 +108,6 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads .Setup(s => s.FindByDownloadId(It.IsAny())) .Returns(new List()); - ParseMovieTitle(); - var client = new DownloadClientDefinition() { Id = 1, @@ -169,8 +165,6 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads .Setup(s => s.FindByDownloadId(It.IsAny())) .Returns(new List()); - ParseMovieTitle(); - var client = new DownloadClientDefinition() { Id = 1, diff --git a/src/NzbDrone.Core.Test/Framework/CoreTest.cs b/src/NzbDrone.Core.Test/Framework/CoreTest.cs index 8c2454c85..61a8ce230 100644 --- a/src/NzbDrone.Core.Test/Framework/CoreTest.cs +++ b/src/NzbDrone.Core.Test/Framework/CoreTest.cs @@ -31,28 +31,6 @@ namespace NzbDrone.Core.Test.Framework Mocker.SetConstant(new HttpClient(Array.Empty(), Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), TestLogger)); Mocker.SetConstant(new RadarrCloudRequestBuilder()); } - - // Used for tests that rely on parsing working correctly. - protected void UseRealParsingService() - { - // Mocker.SetConstant(new ParsingService(Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), TestLogger)); - } - - // Used for tests that rely on parsing working correctly. Does some minimal parsing using the old static methods. - protected void ParseMovieTitle() - { - Mocker.GetMock().Setup(c => c.ParseMovieInfo(It.IsAny(), It.IsAny>())) - .Returns>((title, helpers) => - { - var result = Parser.Parser.ParseMovieTitle(title); - if (result != null) - { - result.Quality = QualityParser.ParseQuality(title); - } - - return result; - }); - } } public abstract class CoreTest : CoreTest diff --git a/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs index b121fb88e..abffdf3a4 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs @@ -30,9 +30,6 @@ namespace NzbDrone.Core.Test.MediaFiles [SetUp] public void Setup() { - ParseMovieTitle(); - - // UseRealParsingService(); Mocker.GetMock().Setup(c => c.GetVideoFiles(It.IsAny(), It.IsAny())) .Returns(_videoFiles); diff --git a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs index b7cf62ce2..f0d07c989 100644 --- a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs +++ b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs @@ -76,7 +76,7 @@ namespace NzbDrone.Core.DecisionEngine try { - var parsedMovieInfo = _parsingService.ParseMovieInfo(report.Title, new List { report }); + var parsedMovieInfo = Parser.Parser.ParseMovieTitle(report.Title); if (parsedMovieInfo != null && !parsedMovieInfo.PrimaryMovieTitle.IsNullOrWhiteSpace()) { diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs index a883d8ed7..00111cfe5 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs @@ -118,7 +118,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads var grabbedHistoryItem = historyItems.FirstOrDefault(h => h.EventType == MovieHistoryEventType.Grabbed); // TODO: Create release info from history and use that here, so we don't loose indexer flags! - var parsedMovieInfo = _parsingService.ParseMovieInfo(trackedDownload.DownloadItem.Title, new List { grabbedHistoryItem }); + var parsedMovieInfo = Parser.Parser.ParseMovieTitle(trackedDownload.DownloadItem.Title); if (parsedMovieInfo != null) { diff --git a/src/NzbDrone.Core/MediaFiles/DownloadedMovieImportService.cs b/src/NzbDrone.Core/MediaFiles/DownloadedMovieImportService.cs index 42fc5bf6b..28493220e 100644 --- a/src/NzbDrone.Core/MediaFiles/DownloadedMovieImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/DownloadedMovieImportService.cs @@ -193,7 +193,7 @@ namespace NzbDrone.Core.MediaFiles var cleanedUpName = GetCleanedUpFolderName(directoryInfo.Name); var historyItems = _historyService.FindByDownloadId(downloadClientItem?.DownloadId ?? ""); var firstHistoryItem = historyItems?.OrderByDescending(h => h.Date).FirstOrDefault(); - var folderInfo = _parsingService.ParseMovieInfo(cleanedUpName, new List { firstHistoryItem }); + var folderInfo = Parser.Parser.ParseMovieTitle(cleanedUpName); if (folderInfo != null) { diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index ac49d234f..a75e5a475 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -15,8 +15,6 @@ namespace NzbDrone.Core.Parser Movie GetMovie(string title); RemoteMovie Map(ParsedMovieInfo parsedMovieInfo, string imdbId, SearchCriteriaBase searchCriteria = null); RemoteMovie Map(ParsedMovieInfo parsedMovieInfo, int movieId); - ParsedMovieInfo ParseMovieInfo(string title, List helpers); - ParsedMovieInfo ParseMinimalMovieInfo(string path, bool isDir = false); ParsedMovieInfo ParseMinimalPathMovieInfo(string path); } @@ -39,39 +37,22 @@ namespace NzbDrone.Core.Parser } } - public ParsedMovieInfo ParseMovieInfo(string title, List helpers) - { - var result = Parser.ParseMovieTitle(title); - - if (result == null) - { - return null; - } - - return result; - } - - public ParsedMovieInfo ParseMinimalMovieInfo(string file, bool isDir = false) - { - return Parser.ParseMovieTitle(file, isDir); - } - public ParsedMovieInfo ParseMinimalPathMovieInfo(string path) { var fileInfo = new FileInfo(path); - var result = ParseMinimalMovieInfo(fileInfo.Name, true); + var result = Parser.ParseMovieTitle(fileInfo.Name, true); if (result == null) { _logger.Debug("Attempting to parse movie info using directory and file names. {0}", fileInfo.Directory.Name); - result = ParseMinimalMovieInfo(fileInfo.Directory.Name + " " + fileInfo.Name); + result = Parser.ParseMovieTitle(fileInfo.Directory.Name + " " + fileInfo.Name); } if (result == null) { _logger.Debug("Attempting to parse movie info using directory name. {0}", fileInfo.Directory.Name); - result = ParseMinimalMovieInfo(fileInfo.Directory.Name + fileInfo.Extension); + result = Parser.ParseMovieTitle(fileInfo.Directory.Name + fileInfo.Extension); } return result; diff --git a/src/Radarr.Api.V3/Parse/ParseController.cs b/src/Radarr.Api.V3/Parse/ParseController.cs index cb983023d..19543cbb5 100644 --- a/src/Radarr.Api.V3/Parse/ParseController.cs +++ b/src/Radarr.Api.V3/Parse/ParseController.cs @@ -33,7 +33,7 @@ namespace Radarr.Api.V3.Parse return null; } - var parsedMovieInfo = _parsingService.ParseMovieInfo(title, new List()); + var parsedMovieInfo = Parser.ParseMovieTitle(title); if (parsedMovieInfo == null) {