account for unaired physical episodes

This commit is contained in:
Luke Pulverenti 2013-10-26 18:40:53 -04:00
parent 976523afa9
commit e7a1f52373
7 changed files with 53 additions and 10 deletions

View File

@ -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; }
}
/// <summary>
@ -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;
}

View File

@ -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; }
}
}
}

View File

@ -156,12 +156,17 @@ namespace MediaBrowser.Controller.Entities.TV
public bool IsUnaired
{
get { return LocationType == Model.Entities.LocationType.Virtual && Children.OfType<Episode>().All(i => i.IsUnaired); }
get { return Children.OfType<Episode>().All(i => i.IsUnaired); }
}
public bool IsMissingOrUnaired
public bool IsVirtualUnaired
{
get { return LocationType == Model.Entities.LocationType.Virtual && Children.OfType<Episode>().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<Episode>().All(i => i.IsVirtualUnaired || i.IsMissingEpisode); }
}
}
}

View File

@ -254,6 +254,8 @@ namespace MediaBrowser.Model.Querying
/// <value><c>null</c> if [is unaired episode] contains no value, <c>true</c> if [is unaired episode]; otherwise, <c>false</c>.</value>
public bool? IsUnaired { get; set; }
public bool? IsVirtualUnaired { get; set; }
/// <summary>
/// Gets or sets the exclude location types.
/// </summary>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.233</version>
<version>3.0.234</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.233" />
<dependency id="MediaBrowser.Common" version="3.0.234" />
<dependency id="NLog" version="2.1.0" />
<dependency id="ServiceStack.Text" version="3.9.58" />
<dependency id="SimpleInjector" version="2.3.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.233</version>
<version>3.0.234</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.233</version>
<version>3.0.234</version>
<title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.233" />
<dependency id="MediaBrowser.Common" version="3.0.234" />
</dependencies>
</metadata>
<files>