mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
fixed episode parse issue
This commit is contained in:
parent
62b2cd510f
commit
d7732cab3b
@ -13,6 +13,7 @@ namespace NzbDrone.Core.Test
|
||||
public class ParserTest
|
||||
{
|
||||
[Test]
|
||||
[Row("Sonny.With.a.Chance.S02E15", 2,15)]
|
||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, 1)]
|
||||
[Row("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", 1, 3)]
|
||||
[Row("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", 1, 13)]
|
||||
@ -30,9 +31,8 @@ public class ParserTest
|
||||
public void episode_parse(string path, int season, int episode)
|
||||
{
|
||||
var result = Parser.ParseEpisodeInfo(path);
|
||||
Assert.Count(1, result);
|
||||
Assert.AreEqual(season, result[0].SeasonNumber);
|
||||
Assert.AreEqual(episode, result[0].EpisodeNumber);
|
||||
Assert.AreEqual(season, result.SeasonNumber);
|
||||
Assert.AreEqual(episode, result.Episodes[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -49,15 +49,15 @@ public void episode_parse(string path, int season, int episode)
|
||||
[Row("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.TV)]
|
||||
[Row("Sonny.With.a.Chance.S02E15.divx", QualityTypes.TV)]
|
||||
[Row("Sonny.With.a.Chance.S02E15", QualityTypes.Unknown)]
|
||||
[Row("S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)]
|
||||
[Row("S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)]
|
||||
[Row("S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720)]
|
||||
[Row("S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080)]
|
||||
[Row("S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)]
|
||||
[Row("Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)]
|
||||
[Row("Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)]
|
||||
[Row("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720)]
|
||||
[Row("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080)]
|
||||
[Row("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)]
|
||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.BDRip)]
|
||||
public void quality_parse(string path, object quality)
|
||||
{
|
||||
var result = Parser.ParseQuality(path);
|
||||
var result = Parser.ParseEpisodeInfo(path).Quality;
|
||||
Assert.AreEqual(quality, result);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
|
||||
namespace NzbDrone.Core.Model
|
||||
{
|
||||
@ -10,6 +11,8 @@ public class EpisodeParseResult
|
||||
internal List<int> Episodes { get; set; }
|
||||
internal int Year { get; set; }
|
||||
|
||||
public QualityTypes Quality { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Series:{0} Season:{1} Episode:{2}", SeriesTitle, SeasonNumber, String.Join(",", Episodes));
|
||||
|
@ -9,6 +9,8 @@ public class SeasonParseResult
|
||||
internal int SeasonNumber { get; set; }
|
||||
internal int Year { get; set; }
|
||||
|
||||
public QualityTypes Quality { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Series:{0} Season:{1}", SeriesTitle, SeasonNumber);
|
||||
|
@ -38,9 +38,7 @@ internal static EpisodeParseResult ParseEpisodeInfo(string title)
|
||||
{
|
||||
Logger.Trace("Parsing string '{0}'", title);
|
||||
|
||||
var result = new EpisodeParseResult();
|
||||
|
||||
foreach (var regex in ReportTitleRegex)
|
||||
foreach (var regex in ReportTitleRegex)
|
||||
{
|
||||
var match = regex.Matches(title);
|
||||
|
||||
@ -69,13 +67,15 @@ internal static EpisodeParseResult ParseEpisodeInfo(string title)
|
||||
|
||||
}
|
||||
|
||||
parsedEpisode.Quality = ParseQuality(title);
|
||||
|
||||
Logger.Trace("Episode Parsed. {0}", parsedEpisode);
|
||||
|
||||
break; //Break out of the for loop, we don't want to process every REGEX for each item otherwise we'll get duplicates
|
||||
return parsedEpisode;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -112,6 +112,7 @@ internal static SeasonParseResult ParseSeasonInfo(string title)
|
||||
};
|
||||
|
||||
|
||||
result.Quality = ParseQuality(title);
|
||||
|
||||
Logger.Trace("Season Parsed. {0}", result);
|
||||
return result;
|
||||
@ -163,7 +164,7 @@ internal static bool ParseProper(string title)
|
||||
return title.ToLower().Contains("proper");
|
||||
}
|
||||
|
||||
internal static QualityTypes ParseQuality(string name)
|
||||
private static QualityTypes ParseQuality(string name)
|
||||
{
|
||||
Logger.Trace("Trying to parse quality for {0}", name);
|
||||
|
||||
|
@ -269,8 +269,6 @@ private void QueueSeasonIfWanted(NzbInfoModel nzb, Indexer indexer)
|
||||
nzb.TitleFix = String.Empty;
|
||||
nzb.TitleFix = String.Format("{0} [{1}]", nzb.TitleFix, nzb.Quality); //Add Quality to the titleFix
|
||||
|
||||
//Check that we want this quality
|
||||
var quality = Parser.ParseQuality(nzb.Title);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
|
@ -108,7 +108,7 @@ public EpisodeFile ImportFile(Series series, string filePath)
|
||||
episodeFile.SeriesId = series.SeriesId;
|
||||
episodeFile.Path = Parser.NormalizePath(filePath);
|
||||
episodeFile.Size = size;
|
||||
episodeFile.Quality = Parser.ParseQuality(filePath);
|
||||
episodeFile.Quality = episodesInFile.Quality;
|
||||
episodeFile.Proper = Parser.ParseProper(filePath);
|
||||
var fileId = (int)_repository.Add(episodeFile);
|
||||
|
||||
|
@ -135,7 +135,7 @@ private void ProcessStandardItem(NzbInfoModel nzb, Indexer indexer, EpisodeParse
|
||||
Logger.Debug("Show is being watched: {0}", series.Title);
|
||||
|
||||
nzb.Proper = Parser.ParseProper(nzb.Title);
|
||||
nzb.Quality = Parser.ParseQuality(nzb.Title);
|
||||
nzb.Quality = episodeParseResults.Quality;
|
||||
|
||||
//Loop through the list of the episodeParseResults to ensure that all the episodes are needed
|
||||
foreach (var episode in episodeParseResults.Episodes)
|
||||
@ -221,7 +221,7 @@ private void ProcessFullSeasonItem(NzbInfoModel nzb, Indexer indexer, SeasonPars
|
||||
Logger.Debug("Show is being watched: {0}", series.Title);
|
||||
|
||||
nzb.Proper = Parser.ParseProper(nzb.Title);
|
||||
nzb.Quality = Parser.ParseQuality(nzb.Title);
|
||||
nzb.Quality = seasonParseResult.Quality;
|
||||
|
||||
if (!_seriesProvider.QualityWanted(series.SeriesId, nzb.Quality))
|
||||
{
|
||||
|
@ -38,8 +38,8 @@ Global
|
||||
{D12F7F2F-8A3C-415F-88FA-6DD061A84869}.Release|x86.Build.0 = Release|x86
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|x64.Build.0 = Debug|x64
|
||||
{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}.Debug|x86.ActiveCfg = Debug|x86
|
||||
@ -55,6 +55,7 @@ Global
|
||||
{43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{43BD3BBD-1531-4D8F-9C08-E1CD544AB2CD}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
@ -67,6 +68,7 @@ Global
|
||||
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
|
Loading…
Reference in New Issue
Block a user