Fixed: Parsing of article title leading to error loading Interactive Search

Fixes #3851
This commit is contained in:
Mark McDowall 2020-07-26 11:51:21 -07:00
parent 3033537236
commit 57335c6d3a
3 changed files with 30 additions and 20 deletions

View File

@ -92,7 +92,7 @@ namespace NzbDrone.Api.Indexers
return new ReleaseResource
{
Guid = releaseInfo.Guid,
Quality = parsedEpisodeInfo.Quality,
Quality = parsedEpisodeInfo?.Quality,
//QualityWeight
Age = releaseInfo.Age,
AgeHours = releaseInfo.AgeHours,
@ -100,16 +100,16 @@ namespace NzbDrone.Api.Indexers
Size = releaseInfo.Size,
IndexerId = releaseInfo.IndexerId,
Indexer = releaseInfo.Indexer,
ReleaseGroup = parsedEpisodeInfo.ReleaseGroup,
ReleaseHash = parsedEpisodeInfo.ReleaseHash,
ReleaseGroup = parsedEpisodeInfo?.ReleaseGroup,
ReleaseHash = parsedEpisodeInfo?.ReleaseHash,
Title = releaseInfo.Title,
FullSeason = parsedEpisodeInfo.FullSeason,
SeasonNumber = parsedEpisodeInfo.SeasonNumber,
Language = parsedEpisodeInfo.Language,
AirDate = parsedEpisodeInfo.AirDate,
SeriesTitle = parsedEpisodeInfo.SeriesTitle,
EpisodeNumbers = parsedEpisodeInfo.EpisodeNumbers,
AbsoluteEpisodeNumbers = parsedEpisodeInfo.AbsoluteEpisodeNumbers,
FullSeason = parsedEpisodeInfo?.FullSeason ?? false,
SeasonNumber = parsedEpisodeInfo?.SeasonNumber ?? 0,
Language = parsedEpisodeInfo?.Language,
AirDate = parsedEpisodeInfo?.AirDate,
SeriesTitle = parsedEpisodeInfo?.SeriesTitle,
EpisodeNumbers = parsedEpisodeInfo?.EpisodeNumbers,
AbsoluteEpisodeNumbers = parsedEpisodeInfo?.AbsoluteEpisodeNumbers,
Approved = model.Approved,
TemporarilyRejected = model.TemporarilyRejected,
Rejected = model.Rejected,
@ -129,10 +129,10 @@ namespace NzbDrone.Api.Indexers
Leechers = (torrentInfo.Peers.HasValue && torrentInfo.Seeders.HasValue) ? (torrentInfo.Peers.Value - torrentInfo.Seeders.Value) : (int?)null,
Protocol = releaseInfo.DownloadProtocol,
IsDaily = parsedEpisodeInfo.IsDaily,
IsAbsoluteNumbering = parsedEpisodeInfo.IsAbsoluteNumbering,
IsPossibleSpecialEpisode = parsedEpisodeInfo.IsPossibleSpecialEpisode,
Special = parsedEpisodeInfo.Special,
IsDaily = parsedEpisodeInfo?.IsDaily ?? false,
IsAbsoluteNumbering = parsedEpisodeInfo?.IsAbsoluteNumbering ?? false,
IsPossibleSpecialEpisode = parsedEpisodeInfo?.IsPossibleSpecialEpisode ?? false,
Special = parsedEpisodeInfo?.Special ?? false,
};
}

View File

@ -3,6 +3,7 @@ using NUnit.Framework;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ParserTests
{
@ -135,6 +136,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Survivorman.The.Lost.Pilots.Summer.HR.WS.PDTV.x264-DHD", false)]
[TestCase("Victoria S01E07 - Motor zmen (CZ)[TvRip][HEVC][720p]", false)]
[TestCase("flashpoint.S05E06.720p.HDTV.x264-FHD", false)]
[TestCase("Series.Title.1x01.ITA.720p.x264-RlsGrp [01/54] - \"series.title.1x01.ita.720p.x264-rlsgrp.nfo\"", false)]
public void should_parse_hdtv720p_quality(string title, bool proper)
{
ParseAndVerifyQuality(title, Quality.HDTV720p, proper);
@ -277,6 +279,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Battlestar.Galactica.S01E01.33.720p.HDDVD.x264-SiNNERS.mkv", false)]
[TestCase("The.Expanse.S01E07.RERIP.720p.BluRay.x264-DEMAND", true)]
[TestCase("Sans.Laisser.De.Traces.FRENCH.720p.BluRay.x264-FHD", false)]
[TestCase("Orphan.Black.1x01.Selezione.Naturale.ITA.720p.BDMux.x264-NovaRip", false)]
public void should_parse_bluray720p_quality(string title, bool proper)
{
ParseAndVerifyQuality(title, Quality.Bluray720p, proper);

View File

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Parser
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(QualityParser));
private static readonly Regex SourceRegex = new Regex(@"\b(?:
(?<bluray>BluRay|Blu-Ray|HD-?DVD|BD(?!$))|
(?<bluray>BluRay|Blu-Ray|HD-?DVD|BDMux|BD(?!$))|
(?<webdl>WEB[-_. ]DL|WEBDL|AmazonHD|iTunesHD|MaxdomeHD|NetflixU?HD|WebHD|[. ]WEB[. ](?:[xh]26[45]|DDP?5[. ]1)|[. ](?-i:WEB)$|\d+0p(?:[-. ]AMZN)?[-. ]WEB[-. ]|WEB-DLMux|\b\s\/\sWEB\s\/\s\b|AMZN[. ]WEB[. ])|
(?<webrip>WebRip|Web-Rip|WEBMux)|
(?<hdtv>HDTV)|
@ -341,12 +341,19 @@ namespace NzbDrone.Core.Parser
}
else
{
var quality = MediaFileExtensions.GetQualityForExtension(Path.GetExtension(name));
if (quality != Quality.Unknown)
try
{
result.SourceDetectionSource = QualityDetectionSource.Extension;
source = quality.Source;
var quality = MediaFileExtensions.GetQualityForExtension(Path.GetExtension(name));
if (quality != Quality.Unknown)
{
result.SourceDetectionSource = QualityDetectionSource.Extension;
source = quality.Source;
}
}
catch (ArgumentException ex)
{
Logger.Debug(ex, "Unable to parse quality from extension");
}
}