mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: Issue where daily episodes/full season releases would break sab queue check.
This commit is contained in:
parent
9c5efdb3b4
commit
feb4ef969e
@ -113,6 +113,48 @@
|
||||
"unpackopts":"3",
|
||||
"verbosity":""
|
||||
},
|
||||
{
|
||||
"avg_age":"580d",
|
||||
"cat":"tv",
|
||||
"eta":"01:45 PM Mon 23 Jan",
|
||||
"filename":"The Dailyshow - 2011-12-01 - My Episode Title [Bluray720p] [Proper]",
|
||||
"index":1,
|
||||
"mb":"419.23",
|
||||
"mbleft":"419.23",
|
||||
"missing":0,
|
||||
"msgid":5657628,
|
||||
"nzo_id":"SABnzbd_nzo_dgrzts",
|
||||
"percentage":"0",
|
||||
"priority":"Normal",
|
||||
"script":"None",
|
||||
"size":"419 MB",
|
||||
"sizeleft":"419 MB",
|
||||
"status":"Queued",
|
||||
"timeleft":"86:01:55",
|
||||
"unpackopts":"3",
|
||||
"verbosity":""
|
||||
},
|
||||
{
|
||||
"avg_age":"580d",
|
||||
"cat":"tv",
|
||||
"eta":"01:45 PM Mon 23 Jan",
|
||||
"filename":"My Name is earl - Season 5 [Bluray720p]",
|
||||
"index":1,
|
||||
"mb":"419.23",
|
||||
"mbleft":"419.23",
|
||||
"missing":0,
|
||||
"msgid":5657628,
|
||||
"nzo_id":"SABnzbd_nzo_dgrzts",
|
||||
"percentage":"0",
|
||||
"priority":"Normal",
|
||||
"script":"None",
|
||||
"size":"419 MB",
|
||||
"sizeleft":"419 MB",
|
||||
"status":"Queued",
|
||||
"timeleft":"86:01:55",
|
||||
"unpackopts":"3",
|
||||
"verbosity":""
|
||||
},
|
||||
{
|
||||
"status":"Paused",
|
||||
"index":1,
|
||||
|
@ -94,7 +94,7 @@ public void GetQueue_should_return_a_list_with_items_when_the_queue_has_items()
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().GetQueue();
|
||||
|
||||
result.Should().HaveCount(4);
|
||||
result.Should().HaveCount(6);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -117,10 +117,47 @@ public void is_in_queue_should_find_if_exact_episode_is_in_queue()
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[TestCase(2, new[] { 5 }, "30 Rock", QualityTypes.Bluray1080p, true, Description = "Same Series, Diffrent Season, Episode")]
|
||||
[TestCase(1, new[] { 6 }, "30 Rock", QualityTypes.Bluray1080p, true, Description = "Same series, diffrent episodes")]
|
||||
[TestCase(1, new[] { 6, 7, 8 }, "30 Rock", QualityTypes.Bluray1080p, true, Description = "Same series, diffrent episodes")]
|
||||
[TestCase(1, new[] { 6 }, "Some other show", QualityTypes.Bluray1080p, true, Description = "Diffrent series, same season, episdoe")]
|
||||
[Test]
|
||||
public void is_in_queue_should_find_if_exact_daily_episode_is_in_queue()
|
||||
{
|
||||
WithFullQueue();
|
||||
|
||||
var parseResult = new EpisodeParseResult
|
||||
{
|
||||
Quality = new Quality { QualityType = QualityTypes.Bluray720p, Proper = false },
|
||||
AirDate = new DateTime(2011, 12, 01),
|
||||
Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), IsDaily = true },
|
||||
};
|
||||
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void is_in_queue_should_find_if_exact_full_season_release_is_in_queue()
|
||||
{
|
||||
WithFullQueue();
|
||||
|
||||
|
||||
var parseResult = new EpisodeParseResult
|
||||
{
|
||||
Quality = new Quality { QualityType = QualityTypes.Bluray720p, Proper = false },
|
||||
FullSeason = true,
|
||||
SeasonNumber = 5,
|
||||
Series = new Series { Title = "My Name is earl", CleanTitle = Parser.NormalizeTitle("My Name is earl") },
|
||||
};
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[TestCase(2, new[] { 5 }, "30 Rock", QualityTypes.Bluray1080p, true, Description = "Same Series, Different Season, Episode")]
|
||||
[TestCase(1, new[] { 6 }, "30 Rock", QualityTypes.Bluray1080p, true, Description = "Same series, different episodes")]
|
||||
[TestCase(1, new[] { 6, 7, 8 }, "30 Rock", QualityTypes.Bluray1080p, true, Description = "Same series, different episodes")]
|
||||
[TestCase(1, new[] { 6 }, "Some other show", QualityTypes.Bluray1080p, true, Description = "Different series, same season, episode")]
|
||||
[TestCase(1, new[] { 5 }, "Rock", QualityTypes.Bluray1080p, true, Description = "Similar series, same season, episodes")]
|
||||
[TestCase(1, new[] { 5 }, "30 Rock", QualityTypes.Bluray720p, false, Description = "Same series, higher quality")]
|
||||
[TestCase(1, new[] { 5 }, "30 Rock", QualityTypes.HDTV, true, Description = "Same series, higher quality")]
|
||||
@ -134,7 +171,7 @@ public void IsInQueue_should_not_find_diffrent_episode_queue(int season, int[] e
|
||||
EpisodeNumbers = new List<int>(episodes),
|
||||
SeasonNumber = season,
|
||||
Quality = new Quality { QualityType = qualityType, Proper = proper },
|
||||
Series = new Series { Title = title },
|
||||
Series = new Series { Title = title, CleanTitle = Parser.NormalizeTitle(title) },
|
||||
};
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
|
||||
@ -143,10 +180,10 @@ public void IsInQueue_should_not_find_diffrent_episode_queue(int season, int[] e
|
||||
}
|
||||
|
||||
[TestCase(1, new[] { 5 }, "30 Rock", QualityTypes.SDTV, false, Description = "Same Series, lower quality")]
|
||||
[TestCase(1, new[] { 5 }, "30 rocK", QualityTypes.SDTV, false, Description = "Same Series, diffrent casing")]
|
||||
[TestCase(1, new[] { 5 }, "30 rocK", QualityTypes.SDTV, false, Description = "Same Series, different casing")]
|
||||
[TestCase(1, new[] { 5 }, "30 RocK", QualityTypes.HDTV, false, Description = "Same Series, same quality")]
|
||||
[TestCase(1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV, false, Description = "Same Series, same quality, one diffrent episode")]
|
||||
[TestCase(1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV, false, Description = "Same Series, same quality, one diffrent episode")]
|
||||
[TestCase(1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV, false, Description = "Same Series, same quality, one different episode")]
|
||||
[TestCase(1, new[] { 5, 6 }, "30 RocK", QualityTypes.HDTV, false, Description = "Same Series, same quality, one different episode")]
|
||||
[TestCase(4, new[] { 8 }, "Parks and Recreation", QualityTypes.WEBDL, false, Description = "Same Series, same quality")]
|
||||
public void IsInQueue_should_find_same_or_lower_quality_episode_queue(int season, int[] episodes, string title, QualityTypes qualityType, bool proper)
|
||||
{
|
||||
|
@ -77,10 +77,24 @@ public virtual bool IsInQueue(EpisodeParseResult newParseResult)
|
||||
{
|
||||
var queue = GetQueue().Where(c => c.ParseResult != null);
|
||||
|
||||
return queue.Any(sabQueueItem => String.Equals(sabQueueItem.ParseResult.CleanTitle, newParseResult.Series.CleanTitle, StringComparison.InvariantCultureIgnoreCase) &&
|
||||
sabQueueItem.ParseResult.EpisodeNumbers.Any(e => newParseResult.EpisodeNumbers.Contains(e)) &&
|
||||
sabQueueItem.ParseResult.SeasonNumber == newParseResult.SeasonNumber &&
|
||||
sabQueueItem.ParseResult.Quality >= newParseResult.Quality);
|
||||
var matchigTitle = queue.Where(q => String.Equals(q.ParseResult.CleanTitle, newParseResult.Series.CleanTitle, StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
var matchingTitleWithQuality = matchigTitle.Where(q => q.ParseResult.Quality >= newParseResult.Quality);
|
||||
|
||||
|
||||
if (newParseResult.Series.IsDaily)
|
||||
{
|
||||
return matchingTitleWithQuality.Any(q => q.ParseResult.AirDate.Value.Date == newParseResult.AirDate.Value.Date);
|
||||
}
|
||||
|
||||
var matchingSeason = matchingTitleWithQuality.Where(q => q.ParseResult.SeasonNumber == newParseResult.SeasonNumber);
|
||||
|
||||
if (newParseResult.FullSeason)
|
||||
{
|
||||
return matchingSeason.Any();
|
||||
}
|
||||
|
||||
return matchingSeason.Any(q => q.ParseResult.EpisodeNumbers != null && q.ParseResult.EpisodeNumbers.Any(e => newParseResult.EpisodeNumbers.Contains(e)));
|
||||
}
|
||||
|
||||
public virtual List<SabQueueItem> GetQueue(int start = 0, int limit = 0)
|
||||
|
Loading…
Reference in New Issue
Block a user