diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.cs
index 68b3fc9c84..799b9d7567 100644
--- a/MediaBrowser.Api/GamesService.cs
+++ b/MediaBrowser.Api/GamesService.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller.Dto;
+using System.Globalization;
+using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
@@ -35,6 +36,21 @@ namespace MediaBrowser.Api
public Guid? UserId { get; set; }
}
+ ///
+ /// Class GetGameSystemSummaries
+ ///
+ [Route("/Games/PlayerIndex", "GET")]
+ [Api(Description = "Gets an index of players (1-x) and the number of games listed under each")]
+ public class GetPlayerIndex : IReturn>
+ {
+ ///
+ /// Gets or sets the user id.
+ ///
+ /// The user id.
+ [ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public Guid? UserId { get; set; }
+ }
+
///
/// Class GamesService
///
@@ -100,6 +116,27 @@ namespace MediaBrowser.Api
return ToOptimizedResult(result);
}
+ private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
+
+ public object Get(GetPlayerIndex request)
+ {
+ var games = GetAllLibraryItems(request.UserId, _userManager, _libraryManager)
+ .OfType()
+ .ToList();
+
+ var lookup = games
+ .ToLookup(i => i.PlayersSupported ?? -1)
+ .OrderBy(i => i.Key)
+ .Select(i => new ItemIndex
+ {
+ ItemCount = i.Count(),
+ Name = i.Key == -1 ? string.Empty : i.Key.ToString(UsCulture)
+ })
+ .ToList();
+
+ return ToOptimizedResult(lookup);
+ }
+
///
/// Gets the summary.
///
diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs
index 0f15124a5f..16952dabdf 100644
--- a/MediaBrowser.Api/LibraryService.cs
+++ b/MediaBrowser.Api/LibraryService.cs
@@ -10,7 +10,9 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using ServiceStack.ServiceHost;
using System;
+using System.Collections;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
@@ -175,6 +177,21 @@ namespace MediaBrowser.Api
public string Id { get; set; }
}
+ [Route("/Items/YearIndex", "GET")]
+ [Api(Description = "Gets a year index based on an item query.")]
+ public class GetYearIndex : IReturn>
+ {
+ ///
+ /// Gets or sets the user id.
+ ///
+ /// The user id.
+ [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public Guid? UserId { get; set; }
+
+ [ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
+ public string IncludeItemTypes { get; set; }
+ }
+
///
/// Class LibraryService
///
@@ -564,5 +581,30 @@ namespace MediaBrowser.Api
OwnerId = _dtoService.GetDtoId(item)
};
}
+
+ private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
+
+ public object Get(GetYearIndex request)
+ {
+ IEnumerable items = GetAllLibraryItems(request.UserId, _userManager, _libraryManager);
+
+ if (!string.IsNullOrEmpty(request.IncludeItemTypes))
+ {
+ var vals = request.IncludeItemTypes.Split(',');
+ items = items.Where(f => vals.Contains(f.GetType().Name, StringComparer.OrdinalIgnoreCase));
+ }
+
+ var lookup = items
+ .ToLookup(i => i.ProductionYear ?? -1)
+ .OrderBy(i => i.Key)
+ .Select(i => new ItemIndex
+ {
+ ItemCount = i.Count(),
+ Name = i.Key == -1 ? string.Empty : i.Key.ToString(UsCulture)
+ })
+ .ToList();
+
+ return ToOptimizedResult(lookup);
+ }
}
}
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 6491b2527c..93b26e3877 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -286,8 +286,8 @@ namespace MediaBrowser.Api.Playback
if (request.Height.HasValue)
{
return isH264Output ?
- string.Format(" -vf \"scale={0}:trunc(oh/a/2)*2{1}\"", request.Height.Value, assSubtitleParam) :
- string.Format(" -vf \"scale=-1{1}:{0}\"", request.Height.Value, assSubtitleParam);
+ string.Format(" -vf \"scale=trunc(oh*a*2)/2:{0}{1}\"", request.Height.Value, assSubtitleParam) :
+ string.Format(" -vf \"scale=-1:{0}{1}\"", request.Height.Value, assSubtitleParam);
}
// If a max width was requested
@@ -302,8 +302,8 @@ namespace MediaBrowser.Api.Playback
if (request.MaxHeight.HasValue && (!request.MaxWidth.HasValue || state.VideoStream == null))
{
return isH264Output ?
- string.Format(" -vf \"scale=min(ih\\,{0}):trunc(oh/a/2)*2{1}\"", request.MaxHeight.Value, assSubtitleParam) :
- string.Format(" -vf \"scale=min(ih\\,{0}):-1{1}\"", request.MaxHeight.Value, assSubtitleParam);
+ string.Format(" -vf \"scale=trunc(oh*a*2)/2:min(ih\\,{0}){1}\"", request.MaxHeight.Value, assSubtitleParam) :
+ string.Format(" -vf \"scale=-1:min(ih\\,{0}){1}\"", request.MaxHeight.Value, assSubtitleParam);
}
if (state.VideoStream == null)
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index f4976bba30..6a89926584 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -167,7 +167,10 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "MinPlayers", Description = "Optional filter by minimum number of game players.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? MinPlayers { get; set; }
-
+
+ [ApiMember(Name = "MaxPlayers", Description = "Optional filter by maximum number of game players.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
+ public int? MaxPlayers { 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; }
@@ -692,6 +695,25 @@ namespace MediaBrowser.Api.UserLibrary
});
}
+ if (request.MaxPlayers.HasValue)
+ {
+ var filterValue = request.MaxPlayers.Value;
+
+ items = items.Where(i =>
+ {
+ var game = i as Game;
+
+ if (game != null)
+ {
+ var players = game.PlayersSupported ?? 1;
+
+ return players <= filterValue;
+ }
+
+ return false;
+ });
+ }
+
if (request.HasSpecialFeature.HasValue)
{
var filterValue = request.HasSpecialFeature.Value;
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
index 5631104c4e..9c77b8627e 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
@@ -214,6 +214,7 @@ namespace MediaBrowser.Common.Implementations
{
try
{
+ // Increase the max http request limit
ServicePointManager.DefaultConnectionLimit = Math.Min(48, ServicePointManager.DefaultConnectionLimit);
}
catch (Exception ex)
diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
index 907433a809..926c680b8d 100644
--- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
+++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
@@ -113,6 +113,9 @@
Dto\ItemCounts.cs
+
+ Dto\ItemIndex.cs
+
Dto\StreamOptions.cs
diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
index 076778d33b..8d7ad5721f 100644
--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
@@ -97,6 +97,9 @@
Dto\ItemCounts.cs
+
+ Dto\ItemIndex.cs
+
Dto\StreamOptions.cs
diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs
index a428236308..bb395cd6a4 100644
--- a/MediaBrowser.Model/ApiClient/IApiClient.cs
+++ b/MediaBrowser.Model/ApiClient/IApiClient.cs
@@ -58,6 +58,23 @@ namespace MediaBrowser.Model.ApiClient
Task GetAsync(string url, CancellationToken cancellationToken)
where T : class;
+ ///
+ /// Gets the index of the game players.
+ ///
+ /// The user id.
+ /// The cancellation token.
+ /// Task{List{ItemIndex}}.
+ Task> GetGamePlayerIndex(string userId, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the index of the year.
+ ///
+ /// The user id.
+ /// The include item types.
+ /// The cancellation token.
+ /// Task{List{ItemIndex}}.
+ Task> GetYearIndex(string userId, string[] includeItemTypes, CancellationToken cancellationToken);
+
///
/// Gets the critic reviews.
///
diff --git a/MediaBrowser.Model/Dto/ItemIndex.cs b/MediaBrowser.Model/Dto/ItemIndex.cs
new file mode 100644
index 0000000000..96cef622b2
--- /dev/null
+++ b/MediaBrowser.Model/Dto/ItemIndex.cs
@@ -0,0 +1,21 @@
+
+namespace MediaBrowser.Model.Dto
+{
+ ///
+ /// Class ItemIndex
+ ///
+ public class ItemIndex
+ {
+ ///
+ /// Gets or sets the name.
+ ///
+ /// The name.
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the item count.
+ ///
+ /// The item count.
+ public int ItemCount { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index ccb6221112..adb05149a7 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -56,6 +56,7 @@
+
diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs
index 20eac55e81..db0cc4928f 100644
--- a/MediaBrowser.Model/Querying/ItemQuery.cs
+++ b/MediaBrowser.Model/Querying/ItemQuery.cs
@@ -212,6 +212,12 @@ namespace MediaBrowser.Model.Querying
/// The min players.
public int? MinPlayers { get; set; }
+ ///
+ /// Gets or sets the max players.
+ ///
+ /// The max players.
+ public int? MaxPlayers { get; set; }
+
///
/// Gets or sets the name starts with or greater.
///
diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec
index 7cad1c7cfa..92c8f2c054 100644
--- a/Nuget/MediaBrowser.Common.Internal.nuspec
+++ b/Nuget/MediaBrowser.Common.Internal.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common.Internal
- 3.0.220
+ 3.0.221
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 ffb5153f47..3baf5d96fc 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common
- 3.0.220
+ 3.0.221
MediaBrowser.Common
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index a81bb7ebf6..147850f29e 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Server.Core
- 3.0.220
+ 3.0.221
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
-
+