Skip to content

Commit

Permalink
Fixed: Remove website post fix before parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Qstick committed Oct 14, 2020
1 parent efcc9ab commit aaebbbf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/NzbDrone.Core/Parser/Parser.cs
Expand Up @@ -172,6 +172,10 @@ public static class Parser
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);

private static readonly RegexReplace WebsitePostfixRegex = new RegexReplace(@"\[\s*[-a-z]+(\.[a-z0-9]+)+\s*\]$",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);

private static readonly Regex AirDateRegex = new Regex(@"^(.*?)(?<!\d)((?<airyear>\d{4})[_.-](?<airmonth>[0-1][0-9])[_.-](?<airday>[0-3][0-9])|(?<airmonth>[0-1][0-9])[_.-](?<airday>[0-3][0-9])[_.-](?<airyear>\d{4}))(?!\d)",
RegexOptions.IgnoreCase | RegexOptions.Compiled);

Expand Down Expand Up @@ -254,6 +258,7 @@ public static ParsedTrackInfo ParseMusicTitle(string title)

// TODO: Quick fix stripping [url] - prefixes.
simpleTitle = WebsitePrefixRegex.Replace(simpleTitle);
simpleTitle = WebsitePostfixRegex.Replace(simpleTitle);

simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle);

Expand Down Expand Up @@ -338,6 +343,7 @@ public static ParsedAlbumInfo ParseAlbumTitleWithSearchCriteria(string title, Ar
var simpleTitle = SimpleTitleRegex.Replace(releaseTitle);

simpleTitle = WebsitePrefixRegex.Replace(simpleTitle);
simpleTitle = WebsitePostfixRegex.Replace(simpleTitle);

simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle);

Expand Down Expand Up @@ -413,6 +419,7 @@ public static ParsedAlbumInfo ParseAlbumTitle(string title)

// TODO: Quick fix stripping [url] - prefixes.
simpleTitle = WebsitePrefixRegex.Replace(simpleTitle);
simpleTitle = WebsitePostfixRegex.Replace(simpleTitle);

simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle);

Expand Down

0 comments on commit aaebbbf

Please sign in to comment.