Removed ParseSeasonInfo.

ParseEpisodeInfo will mark a report as a full season if no episodes are found, but was matched.
Fixed tests that were affected by REGEX changes.
pull/7/merge
Mark McDowall 13 years ago
parent 7a11dfd348
commit 07a4c94032

@ -23,10 +23,10 @@ namespace NzbDrone.Core.Test
public class IndexerTests : TestBase
{
[TestCase("nzbsorg.xml", 0)]
[TestCase("nzbsrus.xml", 6)]
[TestCase("nzbsorg.xml", 2)]
[TestCase("nzbsrus.xml", 9)]
[TestCase("newzbin.xml", 1)]
[TestCase("nzbmatrix.xml", 1)]
[TestCase("nzbmatrix.xml", 2)]
public void parse_feed_xml(string fileName, int warns)
{
var mocker = new AutoMoqer();

@ -320,24 +320,19 @@ namespace NzbDrone.Core.Test
Parser.NormalizePath(null);
}
[TestCase("Hawaii Five 0 S01E19 720p WEB DL DD5 1 H 264 NT", "Hawaii Five", 1)]
[TestCase("Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4)]
[TestCase("S03E09 WS PDTV XviD FUtV", "", 3)]
[TestCase("5x10 WS PDTV XviD FUtV", "", 5)]
[TestCase("Hawaii Five 0 S01 720p WEB DL DD5 1 H 264 NT", "Hawaii Five", 1)]
[TestCase("30 Rock S03 WS PDTV XviD FUtV", "30 Rock", 3)]
[TestCase("The Office Season 4 WS PDTV XviD FUtV", "The Office", 4)]
[TestCase("Eureka Season 1 720p WEB DL DD 5 1 h264 TjHD", "Eureka", 1)]
[TestCase("The Office Season4 WS PDTV XviD FUtV", "The Office", 4)]
[TestCase("Eureka S 01 720p WEB DL DD 5 1 h264 TjHD", "Eureka", 1)]
public void parse_season_info(string postTitle, string seriesName, int seasonNumber)
{
var result = Parser.ParseSeasonInfo(postTitle);
var result = Parser.ParseTitle(postTitle);
result.SeriesTitle.Should().Be(Parser.NormalizeTitle(seriesName));
result.CleanTitle.Should().Be(Parser.NormalizeTitle(seriesName));
result.SeasonNumber.Should().Be(seasonNumber);
}
[Test]
public void parse_season_info_null()
{
var result = Parser.ParseSeasonInfo("This is not a valid post");
result.Should().BeNull();
result.FullSeason.Should().BeTrue();
}
}
}

@ -28,6 +28,8 @@ namespace NzbDrone.Core.Model
public String Indexer { get; set; }
public bool FullSeason { get; set; }
public override string ToString()
{
if (AirDate != null && EpisodeNumbers == null)

@ -162,49 +162,6 @@ namespace NzbDrone.Core
return null;
}
/// <summary>
/// Parses a post title into season it contains
/// </summary>
/// <param name = "title">Title of the report</param>
/// <returns>Season information contained in the post</returns>
internal static SeasonParseResult ParseSeasonInfo(string title)
{
Logger.Trace("Parsing string '{0}'", title);
foreach (var regex in ReportTitleRegex)
{
var match = regex.Matches(title);
if (match.Count != 0)
{
var seriesName = NormalizeTitle(match[0].Groups["title"].Value);
int year;
Int32.TryParse(match[0].Groups["year"].Value, out year);
if (year < 1900 || year > DateTime.Now.Year + 1)
{
year = 0;
}
var seasonNumber = Convert.ToInt32(match[0].Groups["season"].Value);
var result = new SeasonParseResult
{
SeriesTitle = seriesName,
SeasonNumber = seasonNumber,
Year = year,
Quality = ParseQuality(title)
};
Logger.Trace("Season Parsed. {0}", result);
return result;
}
}
return null; //Return null
}
/// <summary>
/// Parses a post title to find the series that relates to it
/// </summary>

Loading…
Cancel
Save