aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-13 16:45:27 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-13 16:45:27 -0400
commitb07a1e67c26a595b906dccc135dfff62d9883e65 (patch)
tree1c1fc1aed561d7f5d3a99ee853940dda15b2f5a0
parentdc5fb2f4c2d0ab538821bf1d8d75b243a80d45e0 (diff)
Added episodes page
-rw-r--r--MediaBrowser.Api/UserLibrary/ItemsService.cs27
-rw-r--r--MediaBrowser.Model/Querying/ItemQuery.cs24
-rw-r--r--MediaBrowser.Model/Querying/ItemSortBy.cs1
-rw-r--r--MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj1
-rw-r--r--MediaBrowser.Server.Implementations/Sorting/SeriesSortNameComparer.cs57
-rw-r--r--MediaBrowser.WebDashboard/Api/DashboardService.cs2
-rw-r--r--MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj8
7 files changed, 112 insertions, 8 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index 84a058446..879df7e3c 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.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;
}
diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs
index 5a61d1c80..45af17b0f 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.cs
index 02307224f..deb0ce51d 100644
--- a/MediaBrowser.Model/Querying/ItemSortBy.cs
+++ b/MediaBrowser.Model/Querying/ItemSortBy.cs
@@ -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";
}
}
diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
index c92950d70..6be7487ad 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.cs
new file mode 100644
index 000000000..4efc3218b
--- /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.cs
index cea177661..0c88ff0c0 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.csproj
index b815ef617..c2c30928a 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>