mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-20 21:55:03 -04:00
Quality parsing improvements
Fixed: Parsing quality in filename from other applications Fixed: Parsing WEB.DL as WEB-DL
This commit is contained in:
@@ -14,12 +14,12 @@ namespace NzbDrone.Core.Parser
|
||||
|
||||
private static readonly Regex SourceRegex = new Regex(@"\b(?:
|
||||
(?<bluray>BluRay)|
|
||||
(?<webdl>WEB-DL|WEBDL|WEB\sDL|WEB\-DL|WebRip)|
|
||||
(?<webdl>WEB[-_. ]DL|WEBDL|WebRip)|
|
||||
(?<hdtv>HDTV)|
|
||||
(?<bdrip>BDRiP)|
|
||||
(?<brrip>BRRip)|
|
||||
(?<dvd>DVD|DVDRip|NTSC|PAL|xvidvd)|
|
||||
(?<dsr>WS\sDSR|WS_DSR|WS\.DSR|DSR)|
|
||||
(?<dsr>WS[-_. ]DSR|DSR)|
|
||||
(?<pdtv>PDTV)|
|
||||
(?<sdtv>SDTV)
|
||||
)\b",
|
||||
@@ -37,6 +37,8 @@ namespace NzbDrone.Core.Parser
|
||||
private static readonly Regex CodecRegex = new Regex(@"\b(?:(?<x264>x264)|(?<h264>h264)|(?<xvidhd>XvidHD)|(?<xvid>Xvid)|(?<divx>divx))\b",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private static readonly Regex OtherSourceRegex = new Regex(@"(?<hdtv>HD[-_. ]TV)|(?<sdtv>SD[-_. ]TV)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public static QualityModel ParseQuality(string name)
|
||||
{
|
||||
Logger.Debug("Trying to parse quality for {0}", name);
|
||||
@@ -191,6 +193,13 @@ namespace NzbDrone.Core.Parser
|
||||
result.Quality = Quality.Bluray1080p;
|
||||
}
|
||||
|
||||
var otherSourceMatch = OtherSourceMatch(normalizedName);
|
||||
|
||||
if (otherSourceMatch != Quality.Unknown)
|
||||
{
|
||||
result.Quality = otherSourceMatch;
|
||||
}
|
||||
|
||||
//Based on extension
|
||||
if (result.Quality == Quality.Unknown && !name.ContainsInvalidPathChars())
|
||||
{
|
||||
@@ -220,6 +229,17 @@ namespace NzbDrone.Core.Parser
|
||||
|
||||
return Resolution.Unknown;
|
||||
}
|
||||
|
||||
private static Quality OtherSourceMatch(string name)
|
||||
{
|
||||
var match = OtherSourceRegex.Match(name);
|
||||
|
||||
if (!match.Success) return Quality.Unknown;
|
||||
if (match.Groups["sdtv"].Success) return Quality.SDTV;
|
||||
if (match.Groups["hdtv"].Success) return Quality.HDTV720p;
|
||||
|
||||
return Quality.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Resolution
|
||||
|
||||
Reference in New Issue
Block a user