The Free Software Media System - Server Backend & API
Added episodes page
Luke Pulverentib07a1e67c26a
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.csindex 84a0584469..879df7e3ce 100644--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs@@ -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.UserLibraryitems = 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;}diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.csindex 5a61d1c80b..45af17b0f2 100644--- a/MediaBrowser.Model/Querying/ItemQuery.cs+++ b/MediaBrowser.Model/Querying/ItemQuery.cs@@ -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; }+ /// <summary>+ /// 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.+ /// Initializes a new instance of the <see cref="ItemQuery" /> class./// </summary>public ItemQuery(){diff --git a/MediaBrowser.Model/Querying/ItemSortBy.cs b/MediaBrowser.Model/Querying/ItemSortBy.csindex 02307224f9..deb0ce51dd 100644--- a/MediaBrowser.Model/Querying/ItemSortBy.cs+++ b/MediaBrowser.Model/Querying/ItemSortBy.cs@@ -81,5 +81,6 @@ namespace MediaBrowser.Model.Queryingpublic const string SongCount = "SongCount";public const string AlbumCount = "AlbumCount";public const string MusicVideoCount = "MusicVideoCount";+ public const string SeriesSortName = "SeriesSortName";}}diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csprojindex c92950d702..6be7487ad7 100644--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj@@ -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" />diff --git a/MediaBrowser.Server.Implementations/Sorting/SeriesSortNameComparer.cs b/MediaBrowser.Server.Implementations/Sorting/SeriesSortNameComparer.csnew file mode 100644index 0000000000..4efc3218b2--- /dev/null+++ b/MediaBrowser.Server.Implementations/Sorting/SeriesSortNameComparer.cs@@ -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; }+ }+ }+}diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.csindex cea1776610..0c88ff0c0d 100644--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs@@ -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",diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csprojindex b815ef617a..c2c30928a3 100644--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj@@ -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>