updated nuget + subtitle changes
This commit is contained in:
parent
3fbf08b882
commit
863f123f3c
|
@ -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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class GetGameSystemSummaries
|
||||
/// </summary>
|
||||
[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<List<ItemIndex>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the user id.
|
||||
/// </summary>
|
||||
/// <value>The user id.</value>
|
||||
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class GamesService
|
||||
/// </summary>
|
||||
|
@ -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<Game>()
|
||||
.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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the summary.
|
||||
/// </summary>
|
||||
|
|
|
@ -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<List<ItemIndex>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the user id.
|
||||
/// </summary>
|
||||
/// <value>The user id.</value>
|
||||
[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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class LibraryService
|
||||
/// </summary>
|
||||
|
@ -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<BaseItem> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -113,6 +113,9 @@
|
|||
<Compile Include="..\MediaBrowser.Model\Dto\ItemCounts.cs">
|
||||
<Link>Dto\ItemCounts.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Dto\ItemIndex.cs">
|
||||
<Link>Dto\ItemIndex.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Dto\StreamOptions.cs">
|
||||
<Link>Dto\StreamOptions.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -97,6 +97,9 @@
|
|||
<Compile Include="..\MediaBrowser.Model\Dto\ItemCounts.cs">
|
||||
<Link>Dto\ItemCounts.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Dto\ItemIndex.cs">
|
||||
<Link>Dto\ItemIndex.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Dto\StreamOptions.cs">
|
||||
<Link>Dto\StreamOptions.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -58,6 +58,23 @@ namespace MediaBrowser.Model.ApiClient
|
|||
Task<T> GetAsync<T>(string url, CancellationToken cancellationToken)
|
||||
where T : class;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the game players.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{List{ItemIndex}}.</returns>
|
||||
Task<List<ItemIndex>> GetGamePlayerIndex(string userId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the year.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <param name="includeItemTypes">The include item types.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{List{ItemIndex}}.</returns>
|
||||
Task<List<ItemIndex>> GetYearIndex(string userId, string[] includeItemTypes, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the critic reviews.
|
||||
/// </summary>
|
||||
|
|
21
MediaBrowser.Model/Dto/ItemIndex.cs
Normal file
21
MediaBrowser.Model/Dto/ItemIndex.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
namespace MediaBrowser.Model.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ItemIndex
|
||||
/// </summary>
|
||||
public class ItemIndex
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the item count.
|
||||
/// </summary>
|
||||
/// <value>The item count.</value>
|
||||
public int ItemCount { get; set; }
|
||||
}
|
||||
}
|
|
@ -56,6 +56,7 @@
|
|||
<Compile Include="Dto\ImageInfo.cs" />
|
||||
<Compile Include="Dto\ItemByNameCounts.cs" />
|
||||
<Compile Include="Dto\ItemCounts.cs" />
|
||||
<Compile Include="Dto\ItemIndex.cs" />
|
||||
<Compile Include="Dto\StudioDto.cs" />
|
||||
<Compile Include="Entities\CollectionType.cs" />
|
||||
<Compile Include="Entities\ItemReview.cs" />
|
||||
|
|
|
@ -212,6 +212,12 @@ namespace MediaBrowser.Model.Querying
|
|||
/// <value>The min players.</value>
|
||||
public int? MinPlayers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the max players.
|
||||
/// </summary>
|
||||
/// <value>The max players.</value>
|
||||
public int? MaxPlayers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name starts with or greater.
|
||||
/// </summary>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.220</version>
|
||||
<version>3.0.221</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.220" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.221" />
|
||||
<dependency id="NLog" version="2.0.1.2" />
|
||||
<dependency id="ServiceStack.Text" version="3.9.58" />
|
||||
<dependency id="SimpleInjector" version="2.3.2" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.220</version>
|
||||
<version>3.0.221</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.220</version>
|
||||
<version>3.0.221</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.220" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.221" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user