mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Removed the whole lenient parsing and lenient mapping functionality
This commit is contained in:

committed by
Qstick

parent
5f5391db47
commit
51de8f16fb
@@ -14,7 +14,6 @@ namespace NzbDrone.Api.Config
|
|||||||
public int AvailabilityDelay { get; set; }
|
public int AvailabilityDelay { get; set; }
|
||||||
public bool AllowHardcodedSubs { get; set; }
|
public bool AllowHardcodedSubs { get; set; }
|
||||||
public string WhitelistedHardcodedSubs { get; set; }
|
public string WhitelistedHardcodedSubs { get; set; }
|
||||||
public ParsingLeniencyType ParsingLeniency { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IndexerConfigResourceMapper
|
public static class IndexerConfigResourceMapper
|
||||||
@@ -31,7 +30,6 @@ namespace NzbDrone.Api.Config
|
|||||||
AvailabilityDelay = model.AvailabilityDelay,
|
AvailabilityDelay = model.AvailabilityDelay,
|
||||||
AllowHardcodedSubs = model.AllowHardcodedSubs,
|
AllowHardcodedSubs = model.AllowHardcodedSubs,
|
||||||
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
|
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
|
||||||
ParsingLeniency = model.ParsingLeniency,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.Framework
|
|||||||
Mocker.GetMock<IParsingService>().Setup(c => c.ParseMovieInfo(It.IsAny<string>(), It.IsAny<System.Collections.Generic.List<object>>()))
|
Mocker.GetMock<IParsingService>().Setup(c => c.ParseMovieInfo(It.IsAny<string>(), It.IsAny<System.Collections.Generic.List<object>>()))
|
||||||
.Returns<string, System.Collections.Generic.List<object>>((title, helpers) =>
|
.Returns<string, System.Collections.Generic.List<object>>((title, helpers) =>
|
||||||
{
|
{
|
||||||
var result = Parser.Parser.ParseMovieTitle(title, false);
|
var result = Parser.Parser.ParseMovieTitle(title);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
result.Quality = QualityParser.ParseQuality(title);
|
result.Quality = QualityParser.ParseQuality(title);
|
||||||
|
@@ -64,7 +64,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
[TestCase("www.Torrenting.org - Revenge.2008.720p.X264-DIMENSION", "Revenge")]
|
[TestCase("www.Torrenting.org - Revenge.2008.720p.X264-DIMENSION", "Revenge")]
|
||||||
public void should_parse_movie_title(string postTitle, string title)
|
public void should_parse_movie_title(string postTitle, string title)
|
||||||
{
|
{
|
||||||
Parser.Parser.ParseMovieTitle(postTitle, true).MovieTitle.Should().Be(title);
|
Parser.Parser.ParseMovieTitle(postTitle).MovieTitle.Should().Be(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("Avatar.Aufbruch.nach.Pandora.Extended.2009.German.DTS.720p.BluRay.x264-SoW", "Avatar Aufbruch nach Pandora", "Extended", 2009)]
|
[TestCase("Avatar.Aufbruch.nach.Pandora.Extended.2009.German.DTS.720p.BluRay.x264-SoW", "Avatar Aufbruch nach Pandora", "Extended", 2009)]
|
||||||
@@ -80,43 +80,22 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
[TestCase("Life.Partners.2014.German.DL.PAL.DVDR-ETM", "Life Partners", "", 2014)]
|
[TestCase("Life.Partners.2014.German.DL.PAL.DVDR-ETM", "Life Partners", "", 2014)]
|
||||||
[TestCase("Joe.Dreck.2.EXTENDED.EDITION.2015.German.DL.PAL.DVDR-ETM", "Joe Dreck 2", "EXTENDED EDITION", 2015)]
|
[TestCase("Joe.Dreck.2.EXTENDED.EDITION.2015.German.DL.PAL.DVDR-ETM", "Joe Dreck 2", "EXTENDED EDITION", 2015)]
|
||||||
[TestCase("Rango.EXTENDED.2011.HDRip.AC3.German.XviD-POE", "Rango", "EXTENDED", 2011)]
|
[TestCase("Rango.EXTENDED.2011.HDRip.AC3.German.XviD-POE", "Rango", "EXTENDED", 2011)]
|
||||||
[TestCase("Suicide.Squad.2016.EXTENDED.German.DL.AC3.BDRip.x264-hqc", "Suicide Squad", "EXTENDED", 2016)] //edition after year
|
|
||||||
public void should_parse_german_movie(string postTitle, string title, string edition, int year)
|
|
||||||
{
|
|
||||||
ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle, false);
|
|
||||||
using (new AssertionScope())
|
|
||||||
{
|
|
||||||
movie.MovieTitle.Should().Be(title);
|
|
||||||
movie.Edition.Should().Be(edition);
|
|
||||||
movie.Year.Should().Be(year);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCase("Avatar.Aufbruch.nach.Pandora.Extended.2009.German.DTS.720p.BluRay.x264-SoW", "Avatar Aufbruch nach Pandora", "Extended", 2009)]
|
//Special cases (see comment to the right)
|
||||||
[TestCase("Drop.Zone.1994.German.AC3D.DL.720p.BluRay.x264-KLASSiGERHD", "Drop Zone", "", 1994)]
|
|
||||||
[TestCase("Kick.Ass.2.2013.German.DTS.DL.720p.BluRay.x264-Pate", "Kick Ass 2", "", 2013)]
|
|
||||||
[TestCase("Paradise.Hills.2019.German.DL.AC3.Dubbed.1080p.BluRay.x264-muhHD", "Paradise Hills", "", 2019)]
|
|
||||||
[TestCase("96.Hours.Taken.3.EXTENDED.2014.German.DL.1080p.BluRay.x264-ENCOUNTERS", "96 Hours Taken 3", "EXTENDED", 2014)]
|
|
||||||
[TestCase("World.War.Z.EXTENDED.CUT.2013.German.DL.1080p.BluRay.x264-HQX", "World War Z", "EXTENDED CUT", 2013)]
|
|
||||||
[TestCase("Sin.City.2005.RECUT.EXTENDED.German.DL.1080p.BluRay.x264-DETAiLS", "Sin City", "RECUT EXTENDED", 2005)]
|
|
||||||
[TestCase("Die.Klasse.von.1999.1990.German.720p.HDTV.x264-NORETAiL", "Die Klasse von 1999", "", 1990)] //year in the title
|
|
||||||
[TestCase("2.Tage.in.L.A.1996.GERMAN.DL.720p.WEB.H264-SOV", "2 Tage in L.A.", "", 1996)]
|
|
||||||
[TestCase("8.2019.GERMAN.720p.BluRay.x264-UNiVERSUM", "8", "", 2019)]
|
|
||||||
[TestCase("Life.Partners.2014.German.DL.PAL.DVDR-ETM", "Life Partners", "", 2014)]
|
|
||||||
[TestCase("Joe.Dreck.2.EXTENDED.EDITION.2015.German.DL.PAL.DVDR-ETM", "Joe Dreck 2", "EXTENDED EDITION", 2015)]
|
|
||||||
[TestCase("Rango.EXTENDED.2011.HDRip.AC3.German.XviD-POE", "Rango", "EXTENDED", 2011)]
|
|
||||||
[TestCase("Suicide.Squad.2016.EXTENDED.German.DL.AC3.BDRip.x264-hqc", "Suicide Squad", "EXTENDED", 2016)] //edition after year
|
[TestCase("Suicide.Squad.2016.EXTENDED.German.DL.AC3.BDRip.x264-hqc", "Suicide Squad", "EXTENDED", 2016)] //edition after year
|
||||||
|
[TestCase("Knight.and.Day.2010.Extended.Cut.German.DTS.DL.720p.BluRay.x264-HDS", "Knight and Day", "Extended Cut", 2010)] //edition after year
|
||||||
|
[TestCase("Der.Soldat.James.German.Bluray.FuckYou.Pso.Why.cant.you.follow.scene.rules.1998", "Der Soldat James", "", 1998)] //year at the end
|
||||||
[TestCase("Der.Hobbit.Eine.Unerwartete.Reise.Extended.German.720p.BluRay.x264-EXQUiSiTE", "Der Hobbit Eine Unerwartete Reise", "Extended", 0)] //no year
|
[TestCase("Der.Hobbit.Eine.Unerwartete.Reise.Extended.German.720p.BluRay.x264-EXQUiSiTE", "Der Hobbit Eine Unerwartete Reise", "Extended", 0)] //no year
|
||||||
|
[TestCase("Wolverine.Weg.des.Kriegers.EXTENDED.German.720p.BluRay.x264-EXQUiSiTE", "Wolverine Weg des Kriegers", "EXTENDED", 0)] //no year
|
||||||
[TestCase("Die.Unfassbaren.Now.You.See.Me.EXTENDED.German.DTS.720p.BluRay.x264-RHD", "Die Unfassbaren Now You See Me", "EXTENDED", 0)] //no year
|
[TestCase("Die.Unfassbaren.Now.You.See.Me.EXTENDED.German.DTS.720p.BluRay.x264-RHD", "Die Unfassbaren Now You See Me", "EXTENDED", 0)] //no year
|
||||||
[TestCase("Der.Soldat.James.German.Bluray.FuckYou.Pso.Why.cant.you.follow.scene.rules.1998", "Der Soldat James", "", 1998)]
|
[TestCase("Die Unfassbaren Now You See Me EXTENDED German DTS 720p BluRay x264-RHD", "Die Unfassbaren Now You See Me", "EXTENDED", 0)] //no year & without dots
|
||||||
[TestCase("Passengers.German.DL.AC3.Dubbed..BluRay.x264-PsO", "Passengers", "", 0)] //no year
|
[TestCase("Passengers.German.DL.AC3.Dubbed..BluRay.x264-PsO", "Passengers", "", 0)] //no year
|
||||||
[TestCase("Das.A.Team.Der.Film.Extended.Cut.German.720p.BluRay.x264-ANCIENT", "Das A Team Der Film", "Extended Cut", 0)] //no year
|
[TestCase("Das.A.Team.Der.Film.Extended.Cut.German.720p.BluRay.x264-ANCIENT", "Das A Team Der Film", "Extended Cut", 0)] //no year
|
||||||
[TestCase("Cars.2.German.DL.720p.BluRay.x264-EmpireHD", "Cars 2", "", 0)] //no year
|
[TestCase("Cars.2.German.DL.720p.BluRay.x264-EmpireHD", "Cars 2", "", 0)] //no year
|
||||||
[TestCase("Der.Film.deines.Lebens.German.2011.PAL.DVDR-ETM", "Der Film deines Lebens", "", 2011)] //year at wrong position
|
[TestCase("Der.Film.deines.Lebens.German.2011.PAL.DVDR-ETM", "Der Film deines Lebens", "", 2011)] //year at wrong position
|
||||||
public void should_parse_german_movie_lenient(string postTitle, string title, string edition, int year)
|
public void should_parse_german_movie(string postTitle, string title, string edition, int year)
|
||||||
{
|
{
|
||||||
ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle, true);
|
ParsedMovieInfo movie = Parser.Parser.ParseMovieTitle(postTitle);
|
||||||
using (new AssertionScope())
|
using (new AssertionScope())
|
||||||
{
|
{
|
||||||
movie.MovieTitle.Should().Be(title);
|
movie.MovieTitle.Should().Be(title);
|
||||||
@@ -128,7 +107,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
[TestCase("(1995) Ghost in the Shell", "Ghost in the Shell")]
|
[TestCase("(1995) Ghost in the Shell", "Ghost in the Shell")]
|
||||||
public void should_parse_movie_folder_name(string postTitle, string title)
|
public void should_parse_movie_folder_name(string postTitle, string title)
|
||||||
{
|
{
|
||||||
Parser.Parser.ParseMovieTitle(postTitle, true, true).MovieTitle.Should().Be(title);
|
Parser.Parser.ParseMovieTitle(postTitle, true).MovieTitle.Should().Be(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("1941.1979.EXTENDED.720p.BluRay.X264-AMIABLE", 1979)]
|
[TestCase("1941.1979.EXTENDED.720p.BluRay.X264-AMIABLE", 1979)]
|
||||||
@@ -137,7 +116,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
[TestCase("Leaving Jeruselem by Railway (1897) [DVD].mp4", 1897)]
|
[TestCase("Leaving Jeruselem by Railway (1897) [DVD].mp4", 1897)]
|
||||||
public void should_parse_movie_year(string postTitle, int year)
|
public void should_parse_movie_year(string postTitle, int year)
|
||||||
{
|
{
|
||||||
Parser.Parser.ParseMovieTitle(postTitle, false).Year.Should().Be(year);
|
Parser.Parser.ParseMovieTitle(postTitle).Year.Should().Be(year);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("Prometheus 2012 Directors Cut", "Directors Cut")]
|
[TestCase("Prometheus 2012 Directors Cut", "Directors Cut")]
|
||||||
@@ -180,7 +159,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||||||
[TestCase("Loving.Pablo.2018.TS.FRENCH.MD.x264-DROGUERiE", "")]
|
[TestCase("Loving.Pablo.2018.TS.FRENCH.MD.x264-DROGUERiE", "")]
|
||||||
public void should_parse_edition(string postTitle, string edition)
|
public void should_parse_edition(string postTitle, string edition)
|
||||||
{
|
{
|
||||||
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
|
var parsed = Parser.Parser.ParseMovieTitle(postTitle);
|
||||||
parsed.Edition.Should().Be(edition);
|
parsed.Edition.Should().Be(edition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
|
|||||||
Subject.GetMovie(title);
|
Subject.GetMovie(title);
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
.Verify(s => s.FindByTitle(Parser.Parser.ParseMovieTitle(title, false, false).MovieTitle), Times.Once());
|
.Verify(s => s.FindByTitle(Parser.Parser.ParseMovieTitle(title, false).MovieTitle), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*[Test]
|
/*[Test]
|
||||||
|
@@ -190,12 +190,6 @@ namespace NzbDrone.Core.Configuration
|
|||||||
set { SetValue("WhitelistedHardcodedSubs", value); }
|
set { SetValue("WhitelistedHardcodedSubs", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParsingLeniencyType ParsingLeniency
|
|
||||||
{
|
|
||||||
get { return GetValueEnum<ParsingLeniencyType>("ParsingLeniency", ParsingLeniencyType.Strict); }
|
|
||||||
set { SetValue("ParsingLeniency", value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool RemoveCompletedDownloads
|
public bool RemoveCompletedDownloads
|
||||||
{
|
{
|
||||||
get { return GetValueBoolean("RemoveCompletedDownloads", false); }
|
get { return GetValueBoolean("RemoveCompletedDownloads", false); }
|
||||||
|
@@ -61,7 +61,6 @@ namespace NzbDrone.Core.Configuration
|
|||||||
|
|
||||||
bool AllowHardcodedSubs { get; set; }
|
bool AllowHardcodedSubs { get; set; }
|
||||||
string WhitelistedHardcodedSubs { get; set; }
|
string WhitelistedHardcodedSubs { get; set; }
|
||||||
ParsingLeniencyType ParsingLeniency { get; set; }
|
|
||||||
|
|
||||||
int NetImportSyncInterval { get; set; }
|
int NetImportSyncInterval { get; set; }
|
||||||
string ListSyncLevel { get; set; }
|
string ListSyncLevel { get; set; }
|
||||||
|
@@ -27,7 +27,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
|||||||
var id = seriesReader.GetInt32(0);
|
var id = seriesReader.GetInt32(0);
|
||||||
var relativePath = seriesReader.GetString(1);
|
var relativePath = seriesReader.GetString(1);
|
||||||
|
|
||||||
var result = Parser.Parser.ParseMovieTitle(relativePath, false);
|
var result = Parser.Parser.ParseMovieTitle(relativePath);
|
||||||
|
|
||||||
var edition = "";
|
var edition = "";
|
||||||
|
|
||||||
|
@@ -89,12 +89,7 @@ namespace NzbDrone.Core.DecisionEngine
|
|||||||
Quality = new QualityModel(),
|
Quality = new QualityModel(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_configService.ParsingLeniency == ParsingLeniencyType.MappingLenient)
|
if (result == null)
|
||||||
{
|
|
||||||
result = _parsingService.Map(parsedMovieInfo, report.ImdbId.ToString(), searchCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result == null || result.MappingResultType != MappingResultType.SuccessLenientMapping)
|
|
||||||
{
|
{
|
||||||
result = new MappingResult { MappingResultType = MappingResultType.NotParsable };
|
result = new MappingResult { MappingResultType = MappingResultType.NotParsable };
|
||||||
result.Movie = null; //To ensure we have a remote movie, else null exception on next line!
|
result.Movie = null; //To ensure we have a remote movie, else null exception on next line!
|
||||||
@@ -113,7 +108,7 @@ namespace NzbDrone.Core.DecisionEngine
|
|||||||
remoteMovie.Release = report;
|
remoteMovie.Release = report;
|
||||||
remoteMovie.MappingResult = result.MappingResultType;
|
remoteMovie.MappingResult = result.MappingResultType;
|
||||||
|
|
||||||
if (result.MappingResultType != MappingResultType.Success && result.MappingResultType != MappingResultType.SuccessLenientMapping)
|
if (result.MappingResultType != MappingResultType.Success)
|
||||||
{
|
{
|
||||||
var rejection = result.ToRejection();
|
var rejection = result.ToRejection();
|
||||||
decision = new DownloadDecision(remoteMovie, rejection);
|
decision = new DownloadDecision(remoteMovie, rejection);
|
||||||
|
@@ -27,13 +27,13 @@ namespace NzbDrone.Core.DecisionEngine
|
|||||||
|
|
||||||
public List<DownloadDecision> PrioritizeDecisionsForMovies(List<DownloadDecision> decisions)
|
public List<DownloadDecision> PrioritizeDecisionsForMovies(List<DownloadDecision> decisions)
|
||||||
{
|
{
|
||||||
return decisions.Where(c => c.RemoteMovie.MappingResult == MappingResultType.Success || c.RemoteMovie.MappingResult == MappingResultType.SuccessLenientMapping)
|
return decisions.Where(c => c.RemoteMovie.MappingResult == MappingResultType.Success)
|
||||||
.GroupBy(c => c.RemoteMovie.Movie.Id, (movieId, downloadDecisions) =>
|
.GroupBy(c => c.RemoteMovie.Movie.Id, (movieId, downloadDecisions) =>
|
||||||
{
|
{
|
||||||
return downloadDecisions.OrderByDescending(decision => decision, new DownloadDecisionComparer(_configService, _delayProfileService, _qualityDefinitionService));
|
return downloadDecisions.OrderByDescending(decision => decision, new DownloadDecisionComparer(_configService, _delayProfileService, _qualityDefinitionService));
|
||||||
})
|
})
|
||||||
.SelectMany(c => c)
|
.SelectMany(c => c)
|
||||||
.Union(decisions.Where(c => c.RemoteMovie.MappingResult != MappingResultType.Success || c.RemoteMovie.MappingResult != MappingResultType.SuccessLenientMapping))
|
.Union(decisions.Where(c => c.RemoteMovie.MappingResult != MappingResultType.Success))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -70,7 +70,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
|||||||
RelativePath = movie.Path.GetRelativePath(path)
|
RelativePath = movie.Path.GetRelativePath(path)
|
||||||
};
|
};
|
||||||
|
|
||||||
var parseResult = Parser.Parser.ParseMovieTitle(filename, false);
|
var parseResult = Parser.Parser.ParseMovieTitle(filename);
|
||||||
|
|
||||||
if (parseResult != null)
|
if (parseResult != null)
|
||||||
{
|
{
|
||||||
|
@@ -72,7 +72,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Wdtv
|
|||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parseResult = Parser.Parser.ParseMovieTitle(filename, false);
|
var parseResult = Parser.Parser.ParseMovieTitle(filename);
|
||||||
|
|
||||||
if (parseResult != null)
|
if (parseResult != null)
|
||||||
{
|
{
|
||||||
|
@@ -93,7 +93,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
|||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parseResult = Parser.Parser.ParseMovieTitle(filename, false);
|
var parseResult = Parser.Parser.ParseMovieTitle(filename);
|
||||||
|
|
||||||
if (parseResult != null &&
|
if (parseResult != null &&
|
||||||
Path.GetExtension(filename).Equals(".nfo", StringComparison.OrdinalIgnoreCase) &&
|
Path.GetExtension(filename).Equals(".nfo", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
@@ -123,7 +123,7 @@ namespace NzbDrone.Core.MediaFiles
|
|||||||
foreach (var videoFile in videoFiles)
|
foreach (var videoFile in videoFiles)
|
||||||
{
|
{
|
||||||
var movieParseResult =
|
var movieParseResult =
|
||||||
Parser.Parser.ParseMovieTitle(Path.GetFileName(videoFile), _config.ParsingLeniency > 0);
|
Parser.Parser.ParseMovieTitle(Path.GetFileName(videoFile));
|
||||||
|
|
||||||
if (movieParseResult == null)
|
if (movieParseResult == null)
|
||||||
{
|
{
|
||||||
|
@@ -214,7 +214,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
|
|||||||
{
|
{
|
||||||
var title = Parser.Parser.RemoveFileExtension(downloadClientItem.Title);
|
var title = Parser.Parser.RemoveFileExtension(downloadClientItem.Title);
|
||||||
|
|
||||||
var parsedTitle = Parser.Parser.ParseMovieTitle(title, false);
|
var parsedTitle = Parser.Parser.ParseMovieTitle(title);
|
||||||
|
|
||||||
if (parsedTitle != null)
|
if (parsedTitle != null)
|
||||||
{
|
{
|
||||||
|
@@ -67,7 +67,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
|
|||||||
|
|
||||||
if (downloadClientItem != null)
|
if (downloadClientItem != null)
|
||||||
{
|
{
|
||||||
downloadClientItemInfo = Parser.Parser.ParseMovieTitle(downloadClientItem.Title, false);
|
downloadClientItemInfo = Parser.Parser.ParseMovieTitle(downloadClientItem.Title);
|
||||||
downloadClientItemInfo = _parsingService.EnhanceMovieInfo(downloadClientItemInfo);
|
downloadClientItemInfo = _parsingService.EnhanceMovieInfo(downloadClientItemInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
|
|||||||
{
|
{
|
||||||
ImportDecision decision = null;
|
ImportDecision decision = null;
|
||||||
|
|
||||||
var fileMovieInfo = Parser.Parser.ParseMoviePath(localMovie.Path, false);
|
var fileMovieInfo = Parser.Parser.ParseMoviePath(localMovie.Path);
|
||||||
|
|
||||||
if (fileMovieInfo != null)
|
if (fileMovieInfo != null)
|
||||||
{
|
{
|
||||||
|
@@ -129,7 +129,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
|
|||||||
return processedFiles.Concat(processedFolders).Where(i => i != null).ToList();
|
return processedFiles.Concat(processedFolders).Where(i => i != null).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
var folderInfo = Parser.Parser.ParseMovieTitle(directoryInfo.Name, false);
|
var folderInfo = Parser.Parser.ParseMovieTitle(directoryInfo.Name);
|
||||||
var movieFiles = _diskScanService.GetVideoFiles(baseFolder).ToList();
|
var movieFiles = _diskScanService.GetVideoFiles(baseFolder).ToList();
|
||||||
var decisions = _importDecisionMaker.GetImportDecisions(movieFiles, movie, downloadClientItem, folderInfo, SceneSource(movie, baseFolder), filterExistingFiles);
|
var decisions = _importDecisionMaker.GetImportDecisions(movieFiles, movie, downloadClientItem, folderInfo, SceneSource(movie, baseFolder), filterExistingFiles);
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
|
|||||||
|
|
||||||
if (movie == null)
|
if (movie == null)
|
||||||
{
|
{
|
||||||
var relativeParseInfo = Parser.Parser.ParseMoviePath(relativeFile, false);
|
var relativeParseInfo = Parser.Parser.ParseMoviePath(relativeFile);
|
||||||
|
|
||||||
if (relativeParseInfo != null)
|
if (relativeParseInfo != null)
|
||||||
{
|
{
|
||||||
@@ -241,7 +241,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
|
|||||||
|
|
||||||
var file = message.Files[i];
|
var file = message.Files[i];
|
||||||
var movie = _movieService.GetMovie(file.MovieId);
|
var movie = _movieService.GetMovie(file.MovieId);
|
||||||
var fileMovieInfo = Parser.Parser.ParseMoviePath(file.Path, false) ?? new ParsedMovieInfo();
|
var fileMovieInfo = Parser.Parser.ParseMoviePath(file.Path) ?? new ParsedMovieInfo();
|
||||||
var existingFile = movie.Path.IsParentPath(file.Path);
|
var existingFile = movie.Path.IsParentPath(file.Path);
|
||||||
TrackedDownload trackedDownload = null;
|
TrackedDownload trackedDownload = null;
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
|
|||||||
|
|
||||||
if (file.FolderName.IsNotNullOrWhiteSpace())
|
if (file.FolderName.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
localMovie.FolderMovieInfo = Parser.Parser.ParseMovieTitle(file.FolderName, false);
|
localMovie.FolderMovieInfo = Parser.Parser.ParseMovieTitle(file.FolderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
localMovie = _aggregationService.Augment(localMovie, false);
|
localMovie = _aggregationService.Augment(localMovie, false);
|
||||||
|
@@ -290,7 +290,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|||||||
|
|
||||||
lowerTitle = lowerTitle.Replace(".", "");
|
lowerTitle = lowerTitle.Replace(".", "");
|
||||||
|
|
||||||
var parserResult = Parser.Parser.ParseMovieTitle(title, true, true);
|
var parserResult = Parser.Parser.ParseMovieTitle(title, true);
|
||||||
|
|
||||||
var yearTerm = "";
|
var yearTerm = "";
|
||||||
|
|
||||||
|
@@ -142,7 +142,7 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
|||||||
}
|
}
|
||||||
|
|
||||||
releaseInfo.Title = title;
|
releaseInfo.Title = title;
|
||||||
var result = Parser.Parser.ParseMovieTitle(title, false); //Depreciated anyways
|
var result = Parser.Parser.ParseMovieTitle(title); //Depreciated anyways
|
||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
|
@@ -14,7 +14,7 @@ namespace NzbDrone.Core.Organizer
|
|||||||
public ValidationFailure ValidateMovieFilename(SampleResult sampleResult)
|
public ValidationFailure ValidateMovieFilename(SampleResult sampleResult)
|
||||||
{
|
{
|
||||||
var validationFailure = new ValidationFailure("MovieFormat", ERROR_MESSAGE);
|
var validationFailure = new ValidationFailure("MovieFormat", ERROR_MESSAGE);
|
||||||
var parsedMovieInfo = Parser.Parser.ParseMovieTitle(sampleResult.FileName, false); //We are not lenient when testing naming schemes
|
var parsedMovieInfo = Parser.Parser.ParseMovieTitle(sampleResult.FileName);
|
||||||
|
|
||||||
if (parsedMovieInfo == null)
|
if (parsedMovieInfo == null)
|
||||||
{
|
{
|
||||||
|
@@ -22,6 +22,9 @@ namespace NzbDrone.Core.Parser
|
|||||||
|
|
||||||
private static readonly Regex[] ReportMovieTitleRegex = new[]
|
private static readonly Regex[] ReportMovieTitleRegex = new[]
|
||||||
{
|
{
|
||||||
|
//Some german or french tracker formats (missing year, ...) (Only applies to german and French/TrueFrench releases) - see ParserFixture for examples and tests
|
||||||
|
new Regex(@"^(?<title>(?![(\[]).+?)((\W|_))(" + ReportEditionRegex + @".{1,3})?(?:(?<!(19|20)\d{2}.*?)(German|French|TrueFrench))(.+?)(?=((19|20)\d{2}|$))(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+))?(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
|
||||||
//Special, Despecialized, etc. Edition Movies, e.g: Mission.Impossible.3.Special.Edition.2011
|
//Special, Despecialized, etc. Edition Movies, e.g: Mission.Impossible.3.Special.Edition.2011
|
||||||
new Regex(@"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*" + ReportEditionRegex + @".{1,3}(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)",
|
new Regex(@"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*" + ReportEditionRegex + @".{1,3}(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
@@ -49,16 +52,6 @@ namespace NzbDrone.Core.Parser
|
|||||||
new Regex(@"^(?:(?:[-_\W](?<![)!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?<title>.+?)?$")
|
new Regex(@"^(?:(?:[-_\W](?<![)!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?<title>.+?)?$")
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Regex[] ReportMovieTitleLenientRegexBefore = new[]
|
|
||||||
{
|
|
||||||
//Some german or french tracker formats
|
|
||||||
new Regex(@"^(?<title>(?![(\[]).+?)((\W|_))(" + ReportEditionRegex + @".{1,3})?(?:(?<!(19|20)\d{2}.*?)(German|French|TrueFrench))(.+?)(?=((19|20)\d{2}|$))(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+))?(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
|
||||||
};
|
|
||||||
|
|
||||||
private static readonly Regex[] ReportMovieTitleLenientRegexAfter = new Regex[]
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
private static readonly Regex[] RejectHashedReleasesRegex = new Regex[]
|
private static readonly Regex[] RejectHashedReleasesRegex = new Regex[]
|
||||||
{
|
{
|
||||||
// Generic match for md5 and mixed-case hashes.
|
// Generic match for md5 and mixed-case hashes.
|
||||||
@@ -147,28 +140,28 @@ namespace NzbDrone.Core.Parser
|
|||||||
{ "ü", "ue" },
|
{ "ü", "ue" },
|
||||||
};
|
};
|
||||||
|
|
||||||
public static ParsedMovieInfo ParseMoviePath(string path, bool isLenient)
|
public static ParsedMovieInfo ParseMoviePath(string path)
|
||||||
{
|
{
|
||||||
var fileInfo = new FileInfo(path);
|
var fileInfo = new FileInfo(path);
|
||||||
|
|
||||||
var result = ParseMovieTitle(fileInfo.Name, isLenient, true);
|
var result = ParseMovieTitle(fileInfo.Name, true);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
Logger.Debug("Attempting to parse movie info using directory and file names. {0}", fileInfo.Directory.Name);
|
Logger.Debug("Attempting to parse movie info using directory and file names. {0}", fileInfo.Directory.Name);
|
||||||
result = ParseMovieTitle(fileInfo.Directory.Name + " " + fileInfo.Name, isLenient);
|
result = ParseMovieTitle(fileInfo.Directory.Name + " " + fileInfo.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
Logger.Debug("Attempting to parse movie info using directory name. {0}", fileInfo.Directory.Name);
|
Logger.Debug("Attempting to parse movie info using directory name. {0}", fileInfo.Directory.Name);
|
||||||
result = ParseMovieTitle(fileInfo.Directory.Name + fileInfo.Extension, isLenient);
|
result = ParseMovieTitle(fileInfo.Directory.Name + fileInfo.Extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ParsedMovieInfo ParseMovieTitle(string title, bool isLenient, bool isDir = false)
|
public static ParsedMovieInfo ParseMovieTitle(string title, bool isDir = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -218,13 +211,6 @@ namespace NzbDrone.Core.Parser
|
|||||||
allRegexes.AddRange(ReportMovieTitleFolderRegex);
|
allRegexes.AddRange(ReportMovieTitleFolderRegex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLenient)
|
|
||||||
{
|
|
||||||
allRegexes.InsertRange(0, ReportMovieTitleLenientRegexBefore);
|
|
||||||
|
|
||||||
allRegexes.AddRange(ReportMovieTitleLenientRegexAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var regex in allRegexes)
|
foreach (var regex in allRegexes)
|
||||||
{
|
{
|
||||||
var match = regex.Matches(simpleTitle);
|
var match = regex.Matches(simpleTitle);
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
namespace NzbDrone.Core.Parser
|
|
||||||
{
|
|
||||||
public enum ParsingLeniencyType
|
|
||||||
{
|
|
||||||
Strict = 0,
|
|
||||||
ParsingLenient = 1,
|
|
||||||
MappingLenient = 2,
|
|
||||||
}
|
|
||||||
}
|
|
@@ -51,7 +51,7 @@ namespace NzbDrone.Core.Parser
|
|||||||
|
|
||||||
public ParsedMovieInfo ParseMovieInfo(string title, List<object> helpers)
|
public ParsedMovieInfo ParseMovieInfo(string title, List<object> helpers)
|
||||||
{
|
{
|
||||||
var result = Parser.ParseMovieTitle(title, _config.ParsingLeniency > 0);
|
var result = Parser.ParseMovieTitle(title);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ namespace NzbDrone.Core.Parser
|
|||||||
|
|
||||||
public ParsedMovieInfo ParseMinimalMovieInfo(string file, bool isDir = false)
|
public ParsedMovieInfo ParseMinimalMovieInfo(string file, bool isDir = false)
|
||||||
{
|
{
|
||||||
return Parser.ParseMovieTitle(file, _config.ParsingLeniency > 0, isDir);
|
return Parser.ParseMovieTitle(file, isDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParsedMovieInfo ParseMinimalPathMovieInfo(string path)
|
public ParsedMovieInfo ParseMinimalPathMovieInfo(string path)
|
||||||
@@ -114,7 +114,7 @@ namespace NzbDrone.Core.Parser
|
|||||||
|
|
||||||
public Movie GetMovie(string title)
|
public Movie GetMovie(string title)
|
||||||
{
|
{
|
||||||
var parsedMovieInfo = Parser.ParseMovieTitle(title, _config.ParsingLeniency > 0);
|
var parsedMovieInfo = Parser.ParseMovieTitle(title);
|
||||||
|
|
||||||
if (parsedMovieInfo == null)
|
if (parsedMovieInfo == null)
|
||||||
{
|
{
|
||||||
@@ -220,16 +220,6 @@ namespace NzbDrone.Core.Parser
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config.ParsingLeniency == ParsingLeniencyType.MappingLenient)
|
|
||||||
{
|
|
||||||
movieByTitleAndOrYear = _movieService.FindByTitleInexact(parsedMovieInfo.MovieTitle, parsedMovieInfo.Year);
|
|
||||||
if (isNotNull(movieByTitleAndOrYear))
|
|
||||||
{
|
|
||||||
result = new MappingResult { Movie = movieByTitleAndOrYear, MappingResultType = MappingResultType.SuccessLenientMapping };
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = new MappingResult { Movie = movieByTitleAndOrYear, MappingResultType = MappingResultType.TitleNotFound };
|
result = new MappingResult { Movie = movieByTitleAndOrYear, MappingResultType = MappingResultType.TitleNotFound };
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -241,16 +231,6 @@ namespace NzbDrone.Core.Parser
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config.ParsingLeniency == ParsingLeniencyType.MappingLenient)
|
|
||||||
{
|
|
||||||
movieByTitleAndOrYear = _movieService.FindByTitleInexact(parsedMovieInfo.MovieTitle, null);
|
|
||||||
if (isNotNull(movieByTitleAndOrYear))
|
|
||||||
{
|
|
||||||
result = new MappingResult { Movie = movieByTitleAndOrYear, MappingResultType = MappingResultType.SuccessLenientMapping };
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = new MappingResult { Movie = movieByTitleAndOrYear, MappingResultType = MappingResultType.TitleNotFound };
|
result = new MappingResult { Movie = movieByTitleAndOrYear, MappingResultType = MappingResultType.TitleNotFound };
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -307,29 +287,6 @@ namespace NzbDrone.Core.Parser
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config.ParsingLeniency == ParsingLeniencyType.MappingLenient)
|
|
||||||
{
|
|
||||||
if (searchCriteria.Movie.CleanTitle.Contains(cleanTitle) ||
|
|
||||||
cleanTitle.Contains(searchCriteria.Movie.CleanTitle))
|
|
||||||
{
|
|
||||||
possibleMovie = searchCriteria.Movie;
|
|
||||||
if ((parsedMovieInfo.Year > 1800 && parsedMovieInfo.Year == possibleMovie.Year) || possibleMovie.SecondaryYear == parsedMovieInfo.Year)
|
|
||||||
{
|
|
||||||
result = new MappingResult { Movie = possibleMovie, MappingResultType = MappingResultType.SuccessLenientMapping };
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parsedMovieInfo.Year < 1800)
|
|
||||||
{
|
|
||||||
result = new MappingResult { Movie = possibleMovie, MappingResultType = MappingResultType.SuccessLenientMapping };
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = new MappingResult { Movie = possibleMovie, MappingResultType = MappingResultType.WrongYear };
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = new MappingResult { Movie = searchCriteria.Movie, MappingResultType = MappingResultType.WrongTitle };
|
result = new MappingResult { Movie = searchCriteria.Movie, MappingResultType = MappingResultType.WrongTitle };
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -346,8 +303,6 @@ namespace NzbDrone.Core.Parser
|
|||||||
{
|
{
|
||||||
case MappingResultType.Success:
|
case MappingResultType.Success:
|
||||||
return $"Successfully mapped release name {ReleaseName} to movie {Movie}";
|
return $"Successfully mapped release name {ReleaseName} to movie {Movie}";
|
||||||
case MappingResultType.SuccessLenientMapping:
|
|
||||||
return $"Successfully mapped parts of the release name {ReleaseName} to movie {Movie}";
|
|
||||||
case MappingResultType.NotParsable:
|
case MappingResultType.NotParsable:
|
||||||
return $"Failed to find movie title in release name {ReleaseName}";
|
return $"Failed to find movie title in release name {ReleaseName}";
|
||||||
case MappingResultType.TitleNotFound:
|
case MappingResultType.TitleNotFound:
|
||||||
@@ -400,7 +355,6 @@ namespace NzbDrone.Core.Parser
|
|||||||
switch (MappingResultType)
|
switch (MappingResultType)
|
||||||
{
|
{
|
||||||
case MappingResultType.Success:
|
case MappingResultType.Success:
|
||||||
case MappingResultType.SuccessLenientMapping:
|
|
||||||
return null;
|
return null;
|
||||||
default:
|
default:
|
||||||
return new Rejection(Message);
|
return new Rejection(Message);
|
||||||
@@ -412,7 +366,6 @@ namespace NzbDrone.Core.Parser
|
|||||||
{
|
{
|
||||||
Unknown = -1,
|
Unknown = -1,
|
||||||
Success = 0,
|
Success = 0,
|
||||||
SuccessLenientMapping = 1,
|
|
||||||
WrongYear = 2,
|
WrongYear = 2,
|
||||||
WrongTitle = 3,
|
WrongTitle = 3,
|
||||||
TitleNotFound = 4,
|
TitleNotFound = 4,
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parsedTitle = Parser.ParseMovieTitle(title, false); //We are not lenient when it comes to scene checking!
|
var parsedTitle = Parser.ParseMovieTitle(title);
|
||||||
|
|
||||||
if (parsedTitle == null ||
|
if (parsedTitle == null ||
|
||||||
parsedTitle.ReleaseGroup == null ||
|
parsedTitle.ReleaseGroup == null ||
|
||||||
|
@@ -14,7 +14,6 @@ namespace Radarr.Api.V3.Config
|
|||||||
public int AvailabilityDelay { get; set; }
|
public int AvailabilityDelay { get; set; }
|
||||||
public bool AllowHardcodedSubs { get; set; }
|
public bool AllowHardcodedSubs { get; set; }
|
||||||
public string WhitelistedHardcodedSubs { get; set; }
|
public string WhitelistedHardcodedSubs { get; set; }
|
||||||
public ParsingLeniencyType ParsingLeniency { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IndexerConfigResourceMapper
|
public static class IndexerConfigResourceMapper
|
||||||
@@ -31,7 +30,6 @@ namespace Radarr.Api.V3.Config
|
|||||||
AvailabilityDelay = model.AvailabilityDelay,
|
AvailabilityDelay = model.AvailabilityDelay,
|
||||||
AllowHardcodedSubs = model.AllowHardcodedSubs,
|
AllowHardcodedSubs = model.AllowHardcodedSubs,
|
||||||
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
|
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
|
||||||
ParsingLeniency = model.ParsingLeniency,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user