mirror of
https://github.com/Radarr/Radarr
synced 2025-02-15 11:05:30 +00:00
Moved filename only piece to Parser.
Added .mp4 to media file extensions. .mp4 will be treated as TV quality.
This commit is contained in:
parent
5e0427f927
commit
d4ef96f97b
2 changed files with 5 additions and 12 deletions
|
@ -26,14 +26,6 @@ public static class Parser
|
|||
RegexOptions.IgnoreCase | RegexOptions.Compiled) //Supports Season only releases
|
||||
};
|
||||
|
||||
private static readonly Regex[] SeasonReportTitleRegex = new[]
|
||||
{
|
||||
new Regex(
|
||||
@"(?<title>.+?)?\W?(?<year>\d{4}?)?\W(?:S|Season)?\W?(?<season>\d+)(?!\\)",
|
||||
RegexOptions.IgnoreCase |
|
||||
RegexOptions.Compiled),
|
||||
};
|
||||
|
||||
private static readonly Regex NormalizeRegex = new Regex(@"((^|\W)(a|an|the|and|or|of)($|\W))|\W|\b(?!(?:19\d{2}|20\d{2}))\d+\b",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
|
@ -50,7 +42,8 @@ internal static EpisodeParseResult ParseEpisodeInfo(string title)
|
|||
{
|
||||
var simpleTitle = Regex.Replace(title, @"480[i|p]|720[i|p]|1080[i|p]|[x|h]264", String.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
var match = regex.Matches(simpleTitle);
|
||||
//Use only the filename, not the entire path
|
||||
var match = regex.Matches(new FileInfo(simpleTitle).Name);
|
||||
|
||||
if (match.Count != 0)
|
||||
{
|
||||
|
@ -250,6 +243,7 @@ internal static QualityTypes ParseQuality(string name)
|
|||
case ".avi":
|
||||
case ".xvid":
|
||||
case ".wmv":
|
||||
case ".mp4":
|
||||
{
|
||||
result = QualityTypes.TV;
|
||||
break;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace NzbDrone.Core.Providers
|
|||
public class MediaFileProvider
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private static readonly string[] MediaExtentions = new[] { "*.mkv", "*.avi", "*.wmv" };
|
||||
private static readonly string[] MediaExtentions = new[] { "*.mkv", "*.avi", "*.wmv", "*.mp4" };
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
private readonly IRepository _repository;
|
||||
|
@ -82,8 +82,7 @@ public EpisodeFile ImportFile(Series series, string filePath)
|
|||
|
||||
if (!_repository.Exists<EpisodeFile>(e => e.Path == Parser.NormalizePath(filePath)))
|
||||
{
|
||||
//Use only the filename, not the entire path
|
||||
var parseResult = Parser.ParseEpisodeInfo(new FileInfo(filePath).Name);
|
||||
var parseResult = Parser.ParseEpisodeInfo(filePath);
|
||||
|
||||
if (parseResult == null)
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue