mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
More Season ignore work. Already ignored seasons will be ignored.
Fix: Season Ignore is handled separately from Episode Ignore.
This commit is contained in:
parent
969f8ae5e2
commit
aac42d4882
12 changed files with 171 additions and 47 deletions
46
NzbDrone.Core/Datastore/PetaPoco/EpisodeSeasonRelator.cs
Normal file
46
NzbDrone.Core/Datastore/PetaPoco/EpisodeSeasonRelator.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.PetaPoco
|
||||
{
|
||||
public class EpisodeSeasonRelator
|
||||
{
|
||||
public Season _current;
|
||||
public Season MapIt(Season season, Episode episode)
|
||||
{
|
||||
// Terminating call. Since we can return null from this function
|
||||
// we need to be ready for PetaPoco to callback later with null
|
||||
// parameters
|
||||
if (season == null)
|
||||
return _current;
|
||||
|
||||
// Is this the same season as the current one we're processing
|
||||
if (_current != null && _current.SeasonId == season.SeasonId)
|
||||
{
|
||||
// Yes, just add this post to the current author's collection of posts
|
||||
_current.Episodes.Add(episode);
|
||||
|
||||
// Return null to indicate we're not done with this author yet
|
||||
return null;
|
||||
}
|
||||
|
||||
// This is season different author to the current one, or this is the
|
||||
// first time through and we don't have an season yet
|
||||
|
||||
// Save the current author
|
||||
var prev = _current;
|
||||
|
||||
// Setup the new current season
|
||||
_current = season;
|
||||
_current.Episodes = new List<Episode>();
|
||||
_current.Episodes.Add(episode);
|
||||
|
||||
// Return the now populated previous season (or null if first time through)
|
||||
return prev;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue