Added episodes page

This commit is contained in:
Luke Pulverenti 2013-09-13 16:45:27 -04:00
parent dc5fb2f4c2
commit b07a1e67c2
7 changed files with 113 additions and 9 deletions

View File

@ -164,6 +164,9 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "MinIndexNumber", Description = "Optional filter by minimum index number.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? MinIndexNumber { get; set; }
[ApiMember(Name = "ParentIndexNumber", Description = "Optional filter by parent index number.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ParentIndexNumber { get; set; }
[ApiMember(Name = "HasParentalRating", Description = "Optional filter by items that have or do not have a parental rating", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? HasParentalRating { get; set; }
@ -733,6 +736,30 @@ namespace MediaBrowser.Api.UserLibrary
items = items.OfType<Video>().Where(i => i.IsHd == request.IsHD.Value);
}
if (request.ParentIndexNumber.HasValue)
{
var filterValue = request.ParentIndexNumber.Value;
items = items.Where(i =>
{
var episode = i as Episode;
if (episode != null)
{
return episode.ParentIndexNumber.HasValue && episode.ParentIndexNumber.Value == filterValue;
}
var song = i as Audio;
if (song != null)
{
return song.ParentIndexNumber.HasValue && song.ParentIndexNumber.Value == filterValue;
}
return true;
});
}
return items;
}

View File

@ -43,7 +43,7 @@ namespace MediaBrowser.Model.Querying
/// </summary>
/// <value>The artists.</value>
public string[] Artists { get; set; }
/// <summary>
/// The sort order to return results with
/// </summary>
@ -176,14 +176,32 @@ namespace MediaBrowser.Model.Querying
/// <value>The max official rating.</value>
public string MaxOfficialRating { get; set; }
/// <summary>
/// Gets or sets the min index number.
/// </summary>
/// <value>The min index number.</value>
public int? MinIndexNumber { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has parental rating.
/// </summary>
/// <value><c>null</c> if [has parental rating] contains no value, <c>true</c> if [has parental rating]; otherwise, <c>false</c>.</value>
public bool? HasParentalRating { get; set; }
public bool? IsHD { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ItemQuery"/> class.
/// Gets or sets a value indicating whether this instance is HD.
/// </summary>
/// <value><c>null</c> if [is HD] contains no value, <c>true</c> if [is HD]; otherwise, <c>false</c>.</value>
public bool? IsHD { get; set; }
/// <summary>
/// Gets or sets the parent index number.
/// </summary>
/// <value>The parent index number.</value>
public int? ParentIndexNumber { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ItemQuery" /> class.
/// </summary>
public ItemQuery()
{

View File

@ -81,5 +81,6 @@ namespace MediaBrowser.Model.Querying
public const string SongCount = "SongCount";
public const string AlbumCount = "AlbumCount";
public const string MusicVideoCount = "MusicVideoCount";
public const string SeriesSortName = "SeriesSortName";
}
}

View File

@ -202,6 +202,7 @@
<Compile Include="Sorting\RevenueComparer.cs" />
<Compile Include="Sorting\RuntimeComparer.cs" />
<Compile Include="Sorting\SeriesCountComparer.cs" />
<Compile Include="Sorting\SeriesSortNameComparer.cs" />
<Compile Include="Sorting\SongCountComparer.cs" />
<Compile Include="Sorting\SortNameComparer.cs" />
<Compile Include="Persistence\SqliteDisplayPreferencesRepository.cs" />

View File

@ -0,0 +1,57 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
namespace MediaBrowser.Server.Implementations.Sorting
{
class SeriesSortNameComparer : IBaseItemComparer
{
/// <summary>
/// Compares the specified x.
/// </summary>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
}
private string GetValue(BaseItem item)
{
Series series = null;
var season = item as Season;
if (season != null)
{
series = season.Series;
}
var episode = item as Episode;
if (episode != null)
{
series = episode.Series;
}
if (series == null)
{
series = item as Series;
}
return series != null ? series.SortName : null;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get { return ItemSortBy.SeriesSortName; }
}
}
}

View File

@ -457,7 +457,6 @@ namespace MediaBrowser.WebDashboard.Api
"edititempeople.js",
"edititemimages.js",
"edituserpage.js",
"favoritetv.js",
"gamesrecommendedpage.js",
"gamesystemspage.js",
"gamespage.js",
@ -498,6 +497,7 @@ namespace MediaBrowser.WebDashboard.Api
"songs.js",
"supporterkeypage.js",
"supporterpage.js",
"episodes.js",
"tvgenres.js",
"tvnextup.js",
"tvpeople.js",

View File

@ -300,7 +300,7 @@
<Content Include="dashboard-ui\edititemmetadata.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\favoritetv.html">
<Content Include="dashboard-ui\episodes.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\gamegenres.html">
@ -318,6 +318,9 @@
<Content Include="dashboard-ui\gamesystems.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\episodes.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\wizardsettings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -396,9 +399,6 @@
<Content Include="dashboard-ui\scripts\edititemmetadata.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\favoritetv.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\itemgallery.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>