added people pages
This commit is contained in:
parent
c3e3b68bb2
commit
8fe7dfd4ce
|
@ -64,9 +64,8 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
items = FilterItems(request, items, user);
|
items = FilterItems(request, items, user);
|
||||||
|
|
||||||
items = ItemsService.ApplySortOrder(request, items, user, LibraryManager);
|
var extractedItems = GetAllItems(request, items, user);
|
||||||
|
var ibnItemsArray = SortItems(request, extractedItems).ToArray();
|
||||||
var ibnItemsArray = GetAllItems(request, items, user).ToArray();
|
|
||||||
|
|
||||||
IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> ibnItems = ibnItemsArray;
|
IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> ibnItems = ibnItemsArray;
|
||||||
|
|
||||||
|
@ -100,6 +99,29 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sorts the items.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The request.</param>
|
||||||
|
/// <param name="items">The items.</param>
|
||||||
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
|
private IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> SortItems(GetItemsByName request, IEnumerable<Tuple<string, Func<IEnumerable<BaseItem>>>> items)
|
||||||
|
{
|
||||||
|
if (string.Equals(request.SortBy, "SortName", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (request.SortOrder.HasValue && request.SortOrder.Value == Model.Entities.SortOrder.Descending)
|
||||||
|
{
|
||||||
|
items = items.OrderByDescending(i => i.Item1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
items = items.OrderBy(i => i.Item1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Filters the items.
|
/// Filters the items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -181,5 +203,11 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GetItemsByName : BaseItemsRequest, IReturn<ItemsResult>
|
public class GetItemsByName : BaseItemsRequest, IReturn<ItemsResult>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// What to sort the results by
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The sort by.</value>
|
||||||
|
[ApiMember(Name = "SortBy", Description = "Optional. Options: SortName", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||||
|
public string SortBy { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||||
public Guid UserId { get; set; }
|
public Guid UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// What to sort the results by
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The sort by.</value>
|
|
||||||
[ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, CommunityRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
||||||
public string SortBy { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skips over a given number of items within the results. Use for paging.
|
/// Skips over a given number of items within the results. Use for paging.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -117,21 +110,5 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
return val.Split(',').Select(v => (ItemFields)Enum.Parse(typeof(ItemFields), v, true));
|
return val.Split(',').Select(v => (ItemFields)Enum.Parse(typeof(ItemFields), v, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the order by.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>IEnumerable{ItemSortBy}.</returns>
|
|
||||||
public IEnumerable<string> GetOrderBy()
|
|
||||||
{
|
|
||||||
var val = SortBy;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(val))
|
|
||||||
{
|
|
||||||
return new string[] { };
|
|
||||||
}
|
|
||||||
|
|
||||||
return val.Split(',');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,13 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
[ApiMember(Name = "Person", Description = "Optional. If specified, results will be filtered to include only those containing the specified person.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "Person", Description = "Optional. If specified, results will be filtered to include only those containing the specified person.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public string Person { get; set; }
|
public string Person { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// What to sort the results by
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The sort by.</value>
|
||||||
|
[ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, CommunityRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||||
|
public string SortBy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If the Person filter is used, this can also be used to restrict to a specific person type
|
/// If the Person filter is used, this can also be used to restrict to a specific person type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -114,6 +121,22 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <value>The air days.</value>
|
/// <value>The air days.</value>
|
||||||
[ApiMember(Name = "AirDays", Description = "Optional filter by Series Air Days. Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
[ApiMember(Name = "AirDays", Description = "Optional filter by Series Air Days. Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||||
public string AirDays { get; set; }
|
public string AirDays { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the order by.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>IEnumerable{ItemSortBy}.</returns>
|
||||||
|
public IEnumerable<string> GetOrderBy()
|
||||||
|
{
|
||||||
|
var val = SortBy;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(val))
|
||||||
|
{
|
||||||
|
return new string[] { };
|
||||||
|
}
|
||||||
|
|
||||||
|
return val.Split(',');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -238,7 +261,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
internal static IEnumerable<BaseItem> ApplySortOrder(BaseItemsRequest request, IEnumerable<BaseItem> items, User user, ILibraryManager libraryManager)
|
internal static IEnumerable<BaseItem> ApplySortOrder(GetItems request, IEnumerable<BaseItem> items, User user, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
var orderBy = request.GetOrderBy().ToArray();
|
var orderBy = request.GetOrderBy().ToArray();
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
"supporterkeypage.js",
|
"supporterkeypage.js",
|
||||||
"supporterpage.js",
|
"supporterpage.js",
|
||||||
"tvgenres.js",
|
"tvgenres.js",
|
||||||
|
"tvpeople.js",
|
||||||
"tvseries.js",
|
"tvseries.js",
|
||||||
"tvrecommended.js",
|
"tvrecommended.js",
|
||||||
"tvshows.js",
|
"tvshows.js",
|
||||||
|
|
|
@ -1552,6 +1552,29 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets people from an item
|
||||||
|
*/
|
||||||
|
self.getPeople = function (userId, options) {
|
||||||
|
|
||||||
|
if (!userId) {
|
||||||
|
throw new Error("null userId");
|
||||||
|
}
|
||||||
|
|
||||||
|
var parentId = options.parentId || "root";
|
||||||
|
|
||||||
|
// Don't put these on the query string
|
||||||
|
delete options.parentId;
|
||||||
|
|
||||||
|
var url = self.getUrl("Users/" + userId + "/Items/" + parentId + "/Persons", options);
|
||||||
|
|
||||||
|
return self.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: "json"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets studios from an item
|
Gets studios from an item
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -275,6 +275,9 @@
|
||||||
<Content Include="dashboard-ui\scripts\tvgenres.js">
|
<Content Include="dashboard-ui\scripts\tvgenres.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\scripts\tvpeople.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\tvrecommended.js">
|
<Content Include="dashboard-ui\scripts\tvrecommended.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -302,6 +305,9 @@
|
||||||
<Content Include="dashboard-ui\tvgenres.html">
|
<Content Include="dashboard-ui\tvgenres.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\tvpeople.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\tvrecommended.html">
|
<Content Include="dashboard-ui\tvrecommended.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.72" targetFramework="net45" />
|
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.73" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Common" version="3.9.43" targetFramework="net45" />
|
<package id="ServiceStack.Common" version="3.9.43" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Text" version="3.9.43" targetFramework="net45" />
|
<package id="ServiceStack.Text" version="3.9.43" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
Reference in New Issue
Block a user