diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 4db7cf970..9c3ea7bf0 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -193,6 +193,9 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "IsUnaired", Description = "Optional filter by items that are unaired episodes or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool? IsUnaired { get; set; } + + [ApiMember(Name = "IsVirtualUnaired", Description = "Optional filter by items that are virtual unaired episodes or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] + public bool? IsVirtualUnaired { get; set; } } /// @@ -470,6 +473,20 @@ namespace MediaBrowser.Api.UserLibrary }); } + if (request.IsVirtualUnaired.HasValue) + { + var val = request.IsVirtualUnaired.Value; + items = items.Where(i => + { + var e = i as Episode; + if (e != null) + { + return e.IsVirtualUnaired == val; + } + return true; + }); + } + return items; } @@ -487,7 +504,7 @@ namespace MediaBrowser.Api.UserLibrary var e = i as Season; if (e != null) { - return !e.IsMissingOrUnaired; + return !e.IsMissingOrVirtualUnaired; } return true; }); @@ -522,6 +539,20 @@ namespace MediaBrowser.Api.UserLibrary }); } + if (request.IsVirtualUnaired.HasValue) + { + var val = request.IsVirtualUnaired.Value; + items = items.Where(i => + { + var e = i as Season; + if (e != null) + { + return e.IsVirtualUnaired == val; + } + return true; + }); + } + return items; } diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index e15a7d4d0..1176fca52 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -203,7 +203,12 @@ namespace MediaBrowser.Controller.Entities.TV public bool IsUnaired { - get { return LocationType == Model.Entities.LocationType.Virtual && PremiereDate.HasValue && PremiereDate.Value >= DateTime.UtcNow; } + get { return PremiereDate.HasValue && PremiereDate.Value >= DateTime.UtcNow; } + } + + public bool IsVirtualUnaired + { + get { return LocationType == Model.Entities.LocationType.Virtual && IsUnaired; } } } } diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 9a0959cad..5a53e8c0f 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -156,12 +156,17 @@ namespace MediaBrowser.Controller.Entities.TV public bool IsUnaired { - get { return LocationType == Model.Entities.LocationType.Virtual && Children.OfType().All(i => i.IsUnaired); } + get { return Children.OfType().All(i => i.IsUnaired); } } - public bool IsMissingOrUnaired + public bool IsVirtualUnaired { - get { return LocationType == Model.Entities.LocationType.Virtual && Children.OfType().All(i => i.IsUnaired || i.IsMissingEpisode); } + get { return LocationType == Model.Entities.LocationType.Virtual && IsUnaired; } + } + + public bool IsMissingOrVirtualUnaired + { + get { return LocationType == Model.Entities.LocationType.Virtual && Children.OfType().All(i => i.IsVirtualUnaired || i.IsMissingEpisode); } } } } diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs index ba51bc46d..f4a1d20d2 100644 --- a/MediaBrowser.Model/Querying/ItemQuery.cs +++ b/MediaBrowser.Model/Querying/ItemQuery.cs @@ -254,6 +254,8 @@ namespace MediaBrowser.Model.Querying /// null if [is unaired episode] contains no value, true if [is unaired episode]; otherwise, false. public bool? IsUnaired { get; set; } + public bool? IsVirtualUnaired { get; set; } + /// /// Gets or sets the exclude location types. /// diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 1446dbec2..b93286b12 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.233 + 3.0.234 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 6da43af68..6712fad0c 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.233 + 3.0.234 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index fab5c8093..c4704f9b3 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.233 + 3.0.234 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +