aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-06-08 01:24:25 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-06-08 01:24:25 -0400
commite2ffb0ba255b8744d1638378aaa33d3d1f66b671 (patch)
treebee4aaab310a3744a0c8a84228661540e23f294d /MediaBrowser.Controller/Entities
parent2538889943c19439f9f87f1daeee6c5ecfcfa244 (diff)
stub out channel mapping
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/TV/Series.cs54
1 files changed, 19 insertions, 35 deletions
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 459b6dfb6..2f2968db8 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -402,47 +402,31 @@ namespace MediaBrowser.Controller.Entities.TV
public static IEnumerable<Episode> FilterEpisodesBySeason(IEnumerable<Episode> episodes, Season parentSeason, bool includeSpecials)
{
var seasonNumber = parentSeason.IndexNumber;
- if (!includeSpecials || (seasonNumber.HasValue && seasonNumber.Value == 0))
- {
- var seasonPresentationKey = parentSeason.PresentationUniqueKey;
+ var seasonPresentationKey = parentSeason.PresentationUniqueKey;
- return episodes.Where(i =>
- {
- if ((i.ParentIndexNumber ?? -1) == seasonNumber)
- {
- return true;
- }
- if (!i.ParentIndexNumber.HasValue)
- {
- var season = i.Season;
- return season != null && string.Equals(season.PresentationUniqueKey, seasonPresentationKey, StringComparison.OrdinalIgnoreCase);
- }
-
- return false;
- });
- }
- else
- {
- var seasonPresentationKey = parentSeason.PresentationUniqueKey;
+ var supportSpecialsInSeason = includeSpecials && seasonNumber.HasValue && seasonNumber.Value != 0;
- return episodes.Where(episode =>
+ return episodes.Where(episode =>
+ {
+ var currentSeasonNumber = supportSpecialsInSeason ? episode.AiredSeasonNumber : episode.ParentIndexNumber;
+ if (currentSeasonNumber.HasValue && seasonNumber.HasValue && currentSeasonNumber.Value == seasonNumber.Value)
{
- var currentSeasonNumber = episode.AiredSeasonNumber;
+ return true;
+ }
- if (currentSeasonNumber.HasValue && seasonNumber.HasValue && currentSeasonNumber.Value == seasonNumber.Value)
- {
- return true;
- }
+ if (!currentSeasonNumber.HasValue && !seasonNumber.HasValue && parentSeason.LocationType == LocationType.Virtual)
+ {
+ return true;
+ }
- if (!episode.ParentIndexNumber.HasValue)
- {
- var season = episode.Season;
- return season != null && string.Equals(season.PresentationUniqueKey, seasonPresentationKey, StringComparison.OrdinalIgnoreCase);
- }
+ if (!episode.ParentIndexNumber.HasValue)
+ {
+ var season = episode.Season;
+ return season != null && string.Equals(season.PresentationUniqueKey, seasonPresentationKey, StringComparison.OrdinalIgnoreCase);
+ }
- return false;
- });
- }
+ return false;
+ });
}
protected override bool GetBlockUnratedValue(UserPolicy config)