consolidate slideout panels
This commit is contained in:
parent
81a90a49b3
commit
4e04d31c7d
|
@ -198,15 +198,15 @@ namespace MediaBrowser.Api
|
||||||
return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager));
|
return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IList<BaseItem> GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func<BaseItem,bool> filter)
|
protected IList<BaseItem> GetAllLibraryItems(string userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func<BaseItem,bool> filter)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(parentId))
|
if (!string.IsNullOrEmpty(parentId))
|
||||||
{
|
{
|
||||||
var folder = (Folder)libraryManager.GetItemById(new Guid(parentId));
|
var folder = (Folder)libraryManager.GetItemById(new Guid(parentId));
|
||||||
|
|
||||||
if (userId.HasValue)
|
if (!string.IsNullOrWhiteSpace(userId))
|
||||||
{
|
{
|
||||||
var user = userManager.GetUserById(userId.Value);
|
var user = userManager.GetUserById(userId);
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
|
@ -221,9 +221,9 @@ namespace MediaBrowser.Api
|
||||||
return folder
|
return folder
|
||||||
.GetRecursiveChildren(filter);
|
.GetRecursiveChildren(filter);
|
||||||
}
|
}
|
||||||
if (userId.HasValue)
|
if (!string.IsNullOrWhiteSpace(userId))
|
||||||
{
|
{
|
||||||
var user = userManager.GetUserById(userId.Value);
|
var user = userManager.GetUserById(userId);
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ namespace MediaBrowser.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
return userManager
|
return userManager
|
||||||
.GetUserById(userId.Value)
|
.GetUserById(userId)
|
||||||
.RootFolder
|
.RootFolder
|
||||||
.GetRecursiveChildren(user, filter)
|
.GetRecursiveChildren(user, filter)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.Api
|
||||||
public string DisplayPreferencesId { get; set; }
|
public string DisplayPreferencesId { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/DisplayPreferences/{Id}", "GET", Summary = "Gets a user's display preferences for an item")]
|
[Route("/DisplayPreferences/{Id}", "GET", Summary = "Gets a user's display preferences for an item")]
|
||||||
|
@ -37,7 +37,7 @@ namespace MediaBrowser.Api
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "Client", Description = "Client", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "Client", Description = "Client", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public string Client { get; set; }
|
public string Client { get; set; }
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid? UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -46,7 +46,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid? UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -106,7 +106,7 @@ namespace MediaBrowser.Api
|
||||||
.Cast<GameSystem>()
|
.Cast<GameSystem>()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId.Value);
|
var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
var result = gameSystems
|
var result = gameSystems
|
||||||
.Select(i => GetSummary(i, user))
|
.Select(i => GetSummary(i, user))
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace MediaBrowser.Api.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -102,7 +102,7 @@ namespace MediaBrowser.Api.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -127,7 +127,7 @@ namespace MediaBrowser.Api.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -159,7 +159,7 @@ namespace MediaBrowser.Api.Library
|
||||||
public class GetItemCounts : IReturn<ItemCounts>
|
public class GetItemCounts : IReturn<ItemCounts>
|
||||||
{
|
{
|
||||||
[ApiMember(Name = "UserId", Description = "Optional. Get counts from a specific user's library.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "Optional. Get counts from a specific user's library.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid? UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "IsFavorite", Description = "Optional. Get counts of favorite items", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "IsFavorite", Description = "Optional. Get counts of favorite items", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||||
public bool? IsFavorite { get; set; }
|
public bool? IsFavorite { get; set; }
|
||||||
|
@ -174,7 +174,7 @@ namespace MediaBrowser.Api.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -193,7 +193,7 @@ namespace MediaBrowser.Api.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string 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)]
|
[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; }
|
public string IncludeItemTypes { get; set; }
|
||||||
|
@ -412,7 +412,7 @@ namespace MediaBrowser.Api.Library
|
||||||
|
|
||||||
var baseItemDtos = new List<BaseItemDto>();
|
var baseItemDtos = new List<BaseItemDto>();
|
||||||
|
|
||||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
|
@ -483,15 +483,15 @@ namespace MediaBrowser.Api.Library
|
||||||
return ToOptimizedSerializedResultUsingCache(counts);
|
return ToOptimizedSerializedResultUsingCache(counts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool FilterItem(BaseItem item, GetItemCounts request, Guid? userId)
|
private bool FilterItem(BaseItem item, GetItemCounts request, string userId)
|
||||||
{
|
{
|
||||||
if (userId.HasValue)
|
if (!string.IsNullOrWhiteSpace(userId))
|
||||||
{
|
{
|
||||||
if (request.IsFavorite.HasValue)
|
if (request.IsFavorite.HasValue)
|
||||||
{
|
{
|
||||||
var val = request.IsFavorite.Value;
|
var val = request.IsFavorite.Value;
|
||||||
|
|
||||||
if (_userDataManager.GetUserData(userId.Value, item.GetUserDataKey()).IsFavorite != val)
|
if (_userDataManager.GetUserData(userId, item.GetUserDataKey()).IsFavorite != val)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -609,10 +609,10 @@ namespace MediaBrowser.Api.Library
|
||||||
|
|
||||||
private ThemeMediaResult GetThemeSongs(GetThemeSongs request)
|
private ThemeMediaResult GetThemeSongs(GetThemeSongs request)
|
||||||
{
|
{
|
||||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
var item = string.IsNullOrEmpty(request.Id)
|
var item = string.IsNullOrEmpty(request.Id)
|
||||||
? (request.UserId.HasValue
|
? (!string.IsNullOrWhiteSpace(request.UserId)
|
||||||
? user.RootFolder
|
? user.RootFolder
|
||||||
: (Folder)_libraryManager.RootFolder)
|
: (Folder)_libraryManager.RootFolder)
|
||||||
: _libraryManager.GetItemById(request.Id);
|
: _libraryManager.GetItemById(request.Id);
|
||||||
|
@ -652,10 +652,10 @@ namespace MediaBrowser.Api.Library
|
||||||
|
|
||||||
public ThemeMediaResult GetThemeVideos(GetThemeVideos request)
|
public ThemeMediaResult GetThemeVideos(GetThemeVideos request)
|
||||||
{
|
{
|
||||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
var item = string.IsNullOrEmpty(request.Id)
|
var item = string.IsNullOrEmpty(request.Id)
|
||||||
? (request.UserId.HasValue
|
? (!string.IsNullOrWhiteSpace(request.UserId)
|
||||||
? user.RootFolder
|
? user.RootFolder
|
||||||
: (Folder)_libraryManager.RootFolder)
|
: (Folder)_libraryManager.RootFolder)
|
||||||
: _libraryManager.GetItemById(request.Id);
|
: _libraryManager.GetItemById(request.Id);
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.Collections;
|
using MediaBrowser.Model.Collections;
|
||||||
using MediaBrowser.Model.Dto;
|
|
||||||
using MediaBrowser.Model.Querying;
|
|
||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -22,7 +20,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "ParentId", Description = "Optional - create the collection within a specific folder", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
[ApiMember(Name = "ParentId", Description = "Optional - create the collection within a specific folder", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
public Guid? ParentId { get; set; }
|
public string ParentId { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "Ids", Description = "Item Ids to add to the collection", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)]
|
[ApiMember(Name = "Ids", Description = "Item Ids to add to the collection", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)]
|
||||||
public string Ids { get; set; }
|
public string Ids { get; set; }
|
||||||
|
@ -35,7 +33,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
public string Ids { get; set; }
|
public string Ids { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid Id { get; set; }
|
public string Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Collections/{Id}/Items", "DELETE", Summary = "Removes items from a collection")]
|
[Route("/Collections/{Id}/Items", "DELETE", Summary = "Removes items from a collection")]
|
||||||
|
@ -45,7 +43,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
public string Ids { get; set; }
|
public string Ids { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
[ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
||||||
public Guid Id { get; set; }
|
public string Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authenticated]
|
[Authenticated]
|
||||||
|
@ -64,11 +62,13 @@ namespace MediaBrowser.Api.Movies
|
||||||
{
|
{
|
||||||
var userId = AuthorizationContext.GetAuthorizationInfo(Request).UserId;
|
var userId = AuthorizationContext.GetAuthorizationInfo(Request).UserId;
|
||||||
|
|
||||||
|
var parentId = string.IsNullOrWhiteSpace(request.ParentId) ? (Guid?)null : new Guid(request.ParentId);
|
||||||
|
|
||||||
var item = await _collectionManager.CreateCollection(new CollectionCreationOptions
|
var item = await _collectionManager.CreateCollection(new CollectionCreationOptions
|
||||||
{
|
{
|
||||||
IsLocked = request.IsLocked,
|
IsLocked = request.IsLocked,
|
||||||
Name = request.Name,
|
Name = request.Name,
|
||||||
ParentId = request.ParentId,
|
ParentId = parentId,
|
||||||
ItemIdList = (request.Ids ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => new Guid(i)).ToList(),
|
ItemIdList = (request.Ids ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => new Guid(i)).ToList(),
|
||||||
UserIds = new List<Guid> { new Guid(userId) }
|
UserIds = new List<Guid> { new Guid(userId) }
|
||||||
|
|
||||||
|
@ -86,14 +86,14 @@ namespace MediaBrowser.Api.Movies
|
||||||
|
|
||||||
public void Post(AddToCollection request)
|
public void Post(AddToCollection request)
|
||||||
{
|
{
|
||||||
var task = _collectionManager.AddToCollection(request.Id, request.Ids.Split(',').Select(i => new Guid(i)));
|
var task = _collectionManager.AddToCollection(new Guid(request.Id), request.Ids.Split(',').Select(i => new Guid(i)));
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(RemoveFromCollection request)
|
public void Delete(RemoveFromCollection request)
|
||||||
{
|
{
|
||||||
var task = _collectionManager.RemoveFromCollection(request.Id, request.Ids.Split(',').Select(i => new Guid(i)));
|
var task = _collectionManager.RemoveFromCollection(new Guid(request.Id), request.Ids.Split(',').Select(i => new Guid(i)));
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specify this to localize the search to a specific item or folder. Omit to use the root.
|
/// Specify this to localize the search to a specific item or folder. Omit to use the root.
|
||||||
|
@ -119,7 +119,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
|
|
||||||
public async Task<object> Get(GetMovieRecommendations request)
|
public async Task<object> Get(GetMovieRecommendations request)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId.Value);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
IEnumerable<BaseItem> movies = GetAllLibraryItems(request.UserId, _userManager, _libraryManager, request.ParentId, i => i is Movie);
|
IEnumerable<BaseItem> movies = GetAllLibraryItems(request.UserId, _userManager, _libraryManager, request.ParentId, i => i is Movie);
|
||||||
|
|
||||||
|
@ -167,10 +167,10 @@ namespace MediaBrowser.Api.Movies
|
||||||
|
|
||||||
private async Task<ItemsResult> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
private async Task<ItemsResult> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
||||||
{
|
{
|
||||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
var item = string.IsNullOrEmpty(request.Id) ?
|
var item = string.IsNullOrEmpty(request.Id) ?
|
||||||
(request.UserId.HasValue ? user.RootFolder :
|
(!string.IsNullOrWhiteSpace(request.UserId) ? user.RootFolder :
|
||||||
_libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id);
|
_libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
Func<BaseItem, bool> filter = i => i.Id != item.Id && includeInSearch(i);
|
Func<BaseItem, bool> filter = i => i.Id != item.Id && includeInSearch(i);
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||||
public Guid? UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -103,7 +103,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
|
|
||||||
public async Task<object> Get(Getrailers request)
|
public async Task<object> Get(Getrailers request)
|
||||||
{
|
{
|
||||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
var result = await GetAllTrailers(user).ConfigureAwait(false);
|
var result = await GetAllTrailers(user).ConfigureAwait(false);
|
||||||
|
|
||||||
IEnumerable<BaseItem> items = result.Items;
|
IEnumerable<BaseItem> items = result.Items;
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace MediaBrowser.Api.Music
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(request.Id);
|
var item = _libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
var user = _userManager.GetUserById(request.UserId.Value);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
var items = _musicManager.GetInstantMixFromItem(item, user);
|
var items = _musicManager.GetInstantMixFromItem(item, user);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ namespace MediaBrowser.Api.Music
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(request.Id);
|
var item = _libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
var user = _userManager.GetUserById(request.UserId.Value);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
var items = _musicManager.GetInstantMixFromItem(item, user);
|
var items = _musicManager.GetInstantMixFromItem(item, user);
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ namespace MediaBrowser.Api.Music
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(request.Id);
|
var item = _libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
var user = _userManager.GetUserById(request.UserId.Value);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
var items = _musicManager.GetInstantMixFromItem(item, user);
|
var items = _musicManager.GetInstantMixFromItem(item, user);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ namespace MediaBrowser.Api.Music
|
||||||
{
|
{
|
||||||
var album = _libraryManager.GetItemById(request.Id);
|
var album = _libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
var user = _userManager.GetUserById(request.UserId.Value);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
var items = _musicManager.GetInstantMixFromItem(album, user);
|
var items = _musicManager.GetInstantMixFromItem(album, user);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ namespace MediaBrowser.Api.Music
|
||||||
{
|
{
|
||||||
var playlist = (Playlist)_libraryManager.GetItemById(request.Id);
|
var playlist = (Playlist)_libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
var user = _userManager.GetUserById(request.UserId.Value);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
var items = _musicManager.GetInstantMixFromItem(playlist, user);
|
var items = _musicManager.GetInstantMixFromItem(playlist, user);
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ namespace MediaBrowser.Api.Music
|
||||||
|
|
||||||
public object Get(GetInstantMixFromMusicGenre request)
|
public object Get(GetInstantMixFromMusicGenre request)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId.Value);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
var items = _musicManager.GetInstantMixFromGenres(new[] { request.Name }, user);
|
var items = _musicManager.GetInstantMixFromGenres(new[] { request.Name }, user);
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ namespace MediaBrowser.Api.Music
|
||||||
|
|
||||||
public object Get(GetInstantMixFromArtist request)
|
public object Get(GetInstantMixFromArtist request)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId.Value);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
var items = _musicManager.GetInstantMixFromArtist(request.Name, user);
|
var items = _musicManager.GetInstantMixFromArtist(request.Name, user);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The id.</value>
|
/// <value>The id.</value>
|
||||||
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
||||||
public Guid Id { get; set; }
|
public string Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -57,7 +57,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The id.</value>
|
/// <value>The id.</value>
|
||||||
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||||
public Guid Id { get; set; }
|
public string Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -72,7 +72,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The id.</value>
|
/// <value>The id.</value>
|
||||||
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The raw Http Request Input Stream
|
/// The raw Http Request Input Stream
|
||||||
|
@ -239,7 +239,8 @@ namespace MediaBrowser.Api
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public object Get(GetPluginConfiguration request)
|
public object Get(GetPluginConfiguration request)
|
||||||
{
|
{
|
||||||
var plugin = _appHost.Plugins.First(p => p.Id == request.Id);
|
var guid = new Guid(request.Id);
|
||||||
|
var plugin = _appHost.Plugins.First(p => p.Id == guid);
|
||||||
|
|
||||||
var dateModified = plugin.ConfigurationDateLastModified;
|
var dateModified = plugin.ConfigurationDateLastModified;
|
||||||
|
|
||||||
|
@ -298,7 +299,8 @@ namespace MediaBrowser.Api
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public void Delete(UninstallPlugin request)
|
public void Delete(UninstallPlugin request)
|
||||||
{
|
{
|
||||||
var plugin = _appHost.Plugins.First(p => p.Id == request.Id);
|
var guid = new Guid(request.Id);
|
||||||
|
var plugin = _appHost.Plugins.First(p => p.Id == guid);
|
||||||
|
|
||||||
_installationManager.UninstallPlugin(plugin);
|
_installationManager.UninstallPlugin(plugin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using System;
|
using MediaBrowser.Api.UserLibrary;
|
||||||
using System.Linq;
|
|
||||||
using MediaBrowser.Api.UserLibrary;
|
|
||||||
using MediaBrowser.Controller.Net;
|
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Reports
|
namespace MediaBrowser.Api.Reports
|
||||||
{
|
{
|
||||||
|
@ -15,7 +14,7 @@ namespace MediaBrowser.Api.Reports
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||||
public Guid? UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Limit results to items containing a specific person
|
/// Limit results to items containing a specific person
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace MediaBrowser.Api.Reports
|
||||||
{
|
{
|
||||||
// Placeholder in case needed later
|
// Placeholder in case needed later
|
||||||
request.Recursive = true;
|
request.Recursive = true;
|
||||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
request.Fields = "MediaSources,DateCreated,Settings,Studios,SyncInfo,ItemCounts";
|
request.Fields = "MediaSources,DateCreated,Settings,Studios,SyncInfo,ItemCounts";
|
||||||
|
|
||||||
var parentItem = string.IsNullOrEmpty(request.ParentId) ?
|
var parentItem = string.IsNullOrEmpty(request.ParentId) ?
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace MediaBrowser.Api.Session
|
||||||
public class GetSessions : IReturn<List<SessionInfoDto>>
|
public class GetSessions : IReturn<List<SessionInfoDto>>
|
||||||
{
|
{
|
||||||
[ApiMember(Name = "ControllableByUserId", Description = "Optional. Filter by sessions that a given user is allowed to remote control.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "ControllableByUserId", Description = "Optional. Filter by sessions that a given user is allowed to remote control.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid? ControllableByUserId { get; set; }
|
public string ControllableByUserId { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "DeviceId", Description = "Optional. Filter by device id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "DeviceId", Description = "Optional. Filter by device id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public string DeviceId { get; set; }
|
public string DeviceId { get; set; }
|
||||||
|
@ -200,7 +200,7 @@ namespace MediaBrowser.Api.Session
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "UserId", Description = "UserId Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "UserId", Description = "UserId Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Sessions/{Id}/Users/{UserId}", "DELETE", Summary = "Removes an additional user from a session")]
|
[Route("/Sessions/{Id}/Users/{UserId}", "DELETE", Summary = "Removes an additional user from a session")]
|
||||||
|
@ -211,7 +211,7 @@ namespace MediaBrowser.Api.Session
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "UserId", Description = "UserId Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "UserId", Description = "UserId Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Sessions/Capabilities", "POST", Summary = "Updates capabilities for a device")]
|
[Route("/Sessions/Capabilities", "POST", Summary = "Updates capabilities for a device")]
|
||||||
|
@ -375,15 +375,15 @@ namespace MediaBrowser.Api.Session
|
||||||
result = result.Where(i => string.Equals(i.DeviceId, request.DeviceId, StringComparison.OrdinalIgnoreCase));
|
result = result.Where(i => string.Equals(i.DeviceId, request.DeviceId, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.ControllableByUserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.ControllableByUserId))
|
||||||
{
|
{
|
||||||
result = result.Where(i => i.SupportsMediaControl);
|
result = result.Where(i => i.SupportsMediaControl);
|
||||||
|
|
||||||
var user = _userManager.GetUserById(request.ControllableByUserId.Value);
|
var user = _userManager.GetUserById(request.ControllableByUserId);
|
||||||
|
|
||||||
if (!user.Policy.EnableRemoteControlOfOtherUsers)
|
if (!user.Policy.EnableRemoteControlOfOtherUsers)
|
||||||
{
|
{
|
||||||
result = result.Where(i => !i.UserId.HasValue || i.ContainsUser(request.ControllableByUserId.Value));
|
result = result.Where(i => !i.UserId.HasValue || i.ContainsUser(request.ControllableByUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user.Policy.EnableSharedDeviceControl)
|
if (!user.Policy.EnableSharedDeviceControl)
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum number of items to return
|
/// The maximum number of items to return
|
||||||
|
@ -70,10 +70,10 @@ namespace MediaBrowser.Api
|
||||||
/// <returns>ItemsResult.</returns>
|
/// <returns>ItemsResult.</returns>
|
||||||
internal static ItemsResult GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
internal static ItemsResult GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
||||||
{
|
{
|
||||||
var user = request.UserId.HasValue ? userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
var item = string.IsNullOrEmpty(request.Id) ?
|
var item = string.IsNullOrEmpty(request.Id) ?
|
||||||
(request.UserId.HasValue ? user.RootFolder :
|
(!string.IsNullOrWhiteSpace(request.UserId) ? user.RootFolder :
|
||||||
libraryManager.RootFolder) : libraryManager.GetItemById(request.Id);
|
libraryManager.RootFolder) : libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
Func<BaseItem, bool> filter = i => i.Id != item.Id && includeInSearch(i);
|
Func<BaseItem, bool> filter = i => i.Id != item.Id && includeInSearch(i);
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { 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.
|
||||||
|
@ -130,7 +130,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fields to return within the items, in addition to basic information
|
/// Fields to return within the items, in addition to basic information
|
||||||
|
@ -140,7 +140,7 @@ namespace MediaBrowser.Api
|
||||||
public string Fields { get; set; }
|
public string Fields { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "Id", Description = "The series id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "Id", Description = "The series id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "Season", Description = "Optional filter by season number.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "Season", Description = "Optional filter by season number.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public int? Season { get; set; }
|
public int? Season { get; set; }
|
||||||
|
@ -183,7 +183,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fields to return within the items, in addition to basic information
|
/// Fields to return within the items, in addition to basic information
|
||||||
|
@ -193,7 +193,7 @@ namespace MediaBrowser.Api
|
||||||
public string Fields { get; set; }
|
public string Fields { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "Id", Description = "The series id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "Id", Description = "The series id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public Guid Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "IsSpecialSeason", Description = "Optional. Filter by special season.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "IsSpecialSeason", Description = "Optional. Filter by special season.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||||
public bool? IsSpecialSeason { get; set; }
|
public bool? IsSpecialSeason { get; set; }
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -84,9 +84,9 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,9 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
BaseItem parentItem;
|
BaseItem parentItem;
|
||||||
List<BaseItem> libraryItems = null;
|
List<BaseItem> libraryItems = null;
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
user = UserManager.GetUserById(request.UserId.Value);
|
user = UserManager.GetUserById(request.UserId);
|
||||||
parentItem = string.IsNullOrEmpty(request.ParentId) ? user.RootFolder : LibraryManager.GetItemById(request.ParentId);
|
parentItem = string.IsNullOrEmpty(request.ParentId) ? user.RootFolder : LibraryManager.GetItemById(request.ParentId);
|
||||||
|
|
||||||
if (RequiresLibraryItems(request, dtoOptions))
|
if (RequiresLibraryItems(request, dtoOptions))
|
||||||
|
@ -92,7 +92,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
var folder = (Folder)parentItem;
|
var folder = (Folder)parentItem;
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
items = request.Recursive ?
|
items = request.Recursive ?
|
||||||
folder.GetRecursiveChildren(user, filter) :
|
folder.GetRecursiveChildren(user, filter) :
|
||||||
|
@ -388,7 +388,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "NameStartsWithOrGreater", Description = "Optional filter by items whose name is sorted equally or greater than a given input string.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "NameStartsWithOrGreater", Description = "Optional filter by items whose name is sorted equally or greater than a given input string.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public string NameStartsWithOrGreater { get; set; }
|
public string NameStartsWithOrGreater { get; set; }
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authenticated]
|
[Authenticated]
|
||||||
|
@ -71,9 +71,9 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -76,9 +76,9 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||||
public Guid? UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Limit results to items containing a specific person
|
/// Limit results to items containing a specific person
|
||||||
|
@ -325,7 +325,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
private async Task<ItemsResult> GetItems(GetItems request)
|
private async Task<ItemsResult> GetItems(GetItems request)
|
||||||
{
|
{
|
||||||
var parentItem = string.IsNullOrEmpty(request.ParentId) ? null : _libraryManager.GetItemById(request.ParentId);
|
var parentItem = string.IsNullOrEmpty(request.ParentId) ? null : _libraryManager.GetItemById(request.ParentId);
|
||||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
var result = await GetItemsToSerialize(request, user, parentItem).ConfigureAwait(false);
|
var result = await GetItemsToSerialize(request, user, parentItem).ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authenticated]
|
[Authenticated]
|
||||||
|
@ -71,9 +71,9 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -87,9 +87,9 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
[ApiMember(Name = "DatePlayed", Description = "The date the item was played (if any). Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
[ApiMember(Name = "DatePlayed", Description = "The date the item was played (if any). Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
|
||||||
public string DatePlayed { get; set; }
|
public string DatePlayed { get; set; }
|
||||||
|
@ -47,7 +47,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -90,7 +90,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -143,7 +143,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -198,7 +198,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -75,9 +75,9 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,7 @@ using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Library;
|
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using MoreLinq;
|
|
||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -28,7 +26,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[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 string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -49,7 +47,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[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 string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -63,7 +61,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[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 string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the item id.
|
/// Gets or sets the item id.
|
||||||
|
@ -84,7 +82,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -105,7 +103,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -126,7 +124,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -147,7 +145,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public Guid UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -175,7 +173,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[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 string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -196,7 +194,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
[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 string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -515,7 +513,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <param name="itemId">The item id.</param>
|
/// <param name="itemId">The item id.</param>
|
||||||
/// <param name="isFavorite">if set to <c>true</c> [is favorite].</param>
|
/// <param name="isFavorite">if set to <c>true</c> [is favorite].</param>
|
||||||
/// <returns>Task{UserItemDataDto}.</returns>
|
/// <returns>Task{UserItemDataDto}.</returns>
|
||||||
private async Task<UserItemDataDto> MarkFavorite(Guid userId, string itemId, bool isFavorite)
|
private async Task<UserItemDataDto> MarkFavorite(string userId, string itemId, bool isFavorite)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
|
@ -563,7 +561,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <param name="itemId">The item id.</param>
|
/// <param name="itemId">The item id.</param>
|
||||||
/// <param name="likes">if set to <c>true</c> [likes].</param>
|
/// <param name="likes">if set to <c>true</c> [likes].</param>
|
||||||
/// <returns>Task{UserItemDataDto}.</returns>
|
/// <returns>Task{UserItemDataDto}.</returns>
|
||||||
private async Task<UserItemDataDto> UpdateUserItemRating(Guid userId, string itemId, bool? likes)
|
private async Task<UserItemDataDto> UpdateUserItemRating(string userId, string itemId, bool? likes)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <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")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -75,9 +75,9 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
if (request.UserId.HasValue)
|
if (!string.IsNullOrWhiteSpace(request.UserId))
|
||||||
{
|
{
|
||||||
var user = UserManager.GetUserById(request.UserId.Value);
|
var user = UserManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
return DtoService.GetBaseItemDto(item, dtoOptions, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MediaBrowser.Api
|
||||||
public class GetAdditionalParts : IReturn<ItemsResult>
|
public class GetAdditionalParts : IReturn<ItemsResult>
|
||||||
{
|
{
|
||||||
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[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; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
|
@ -71,10 +71,10 @@ namespace MediaBrowser.Api
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public object Get(GetAdditionalParts request)
|
public object Get(GetAdditionalParts request)
|
||||||
{
|
{
|
||||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
var item = string.IsNullOrEmpty(request.Id)
|
var item = string.IsNullOrEmpty(request.Id)
|
||||||
? (request.UserId.HasValue
|
? (!string.IsNullOrWhiteSpace(request.UserId)
|
||||||
? user.RootFolder
|
? user.RootFolder
|
||||||
: _libraryManager.RootFolder)
|
: _libraryManager.RootFolder)
|
||||||
: _libraryManager.GetItemById(request.Id);
|
: _libraryManager.GetItemById(request.Id);
|
||||||
|
|
|
@ -29,6 +29,14 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
|
Task SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user data.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user id.</param>
|
||||||
|
/// <param name="key">The key.</param>
|
||||||
|
/// <returns>Task{UserItemData}.</returns>
|
||||||
|
UserItemData GetUserData(string userId, string key);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user data.
|
/// Gets the user data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.Persistence
|
||||||
/// <param name="client">The client.</param>
|
/// <param name="client">The client.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId, string client,
|
Task SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client,
|
||||||
CancellationToken cancellationToken);
|
CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -44,7 +44,7 @@ namespace MediaBrowser.Controller.Persistence
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="client">The client.</param>
|
/// <param name="client">The client.</param>
|
||||||
/// <returns>Task{DisplayPreferences}.</returns>
|
/// <returns>Task{DisplayPreferences}.</returns>
|
||||||
DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client);
|
DisplayPreferences GetDisplayPreferences(string displayPreferencesId, string userId, string client);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all display preferences for the given user.
|
/// Gets all display preferences for the given user.
|
||||||
|
|
|
@ -220,14 +220,14 @@ namespace MediaBrowser.Controller.Session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sessionId">The session identifier.</param>
|
/// <param name="sessionId">The session identifier.</param>
|
||||||
/// <param name="userId">The user identifier.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
void AddAdditionalUser(string sessionId, Guid userId);
|
void AddAdditionalUser(string sessionId, string userId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the additional user.
|
/// Removes the additional user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sessionId">The session identifier.</param>
|
/// <param name="sessionId">The session identifier.</param>
|
||||||
/// <param name="userId">The user identifier.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
void RemoveAdditionalUser(string sessionId, Guid userId);
|
void RemoveAdditionalUser(string sessionId, string userId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the now viewing item.
|
/// Reports the now viewing item.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using MediaBrowser.Common.Events;
|
||||||
using MediaBrowser.Common.Events;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
|
@ -10,6 +9,7 @@ using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -262,5 +262,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
return playedToCompletion;
|
return playedToCompletion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserItemData GetUserData(string userId, string key)
|
||||||
|
{
|
||||||
|
return GetUserData(new Guid(userId), key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -723,7 +723,7 @@
|
||||||
"MessageInvitationSentToNewUser": "An email has been sent to {0} inviting them to sign up with Emby.",
|
"MessageInvitationSentToNewUser": "An email has been sent to {0} inviting them to sign up with Emby.",
|
||||||
"HeaderConnectionFailure": "Connection Failure",
|
"HeaderConnectionFailure": "Connection Failure",
|
||||||
"MessageUnableToConnectToServer": "We're unable to connect to the selected server right now. Please ensure it is running and try again.",
|
"MessageUnableToConnectToServer": "We're unable to connect to the selected server right now. Please ensure it is running and try again.",
|
||||||
"ButtonSelectServer": "Select server",
|
"ButtonSelectServer": "Select Server",
|
||||||
"MessagePluginConfigurationRequiresLocalAccess": "To configure this plugin please sign in to your local server directly.",
|
"MessagePluginConfigurationRequiresLocalAccess": "To configure this plugin please sign in to your local server directly.",
|
||||||
"MessageLoggedOutParentalControl": "Access is currently restricted. Please try again later.",
|
"MessageLoggedOutParentalControl": "Access is currently restricted. Please try again later.",
|
||||||
"DefaultErrorMessage": "There was an error processing the request. Please try again later.",
|
"DefaultErrorMessage": "There was an error processing the request. Please try again later.",
|
||||||
|
@ -787,5 +787,8 @@
|
||||||
"MessagePleaseSignInLocalNetwork": "Before proceeding, please ensure that you're connected to your local network using a Wifi or LAN connection.",
|
"MessagePleaseSignInLocalNetwork": "Before proceeding, please ensure that you're connected to your local network using a Wifi or LAN connection.",
|
||||||
"ButtonUnlockWithPurchase": "Unlock with Purchase",
|
"ButtonUnlockWithPurchase": "Unlock with Purchase",
|
||||||
"MessageLiveTvGuideRequiresUnlock": "The Live TV Guide is currently limited to {0} channels. Click the unlock button to learn how to enjoy the full experience.",
|
"MessageLiveTvGuideRequiresUnlock": "The Live TV Guide is currently limited to {0} channels. Click the unlock button to learn how to enjoy the full experience.",
|
||||||
"OptionEnableFullscreen": "Enable Fullscreen"
|
"OptionEnableFullscreen": "Enable Fullscreen",
|
||||||
|
"ButtonServer": "Server",
|
||||||
|
"HeaderAdmin": "Admin",
|
||||||
|
"HeaderLibrary": "Library"
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,5 +309,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
_connection = null;
|
_connection = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return SaveDisplayPreferences(displayPreferences, new Guid(userId), client, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DisplayPreferences GetDisplayPreferences(string displayPreferencesId, string userId, string client)
|
||||||
|
{
|
||||||
|
return GetDisplayPreferences(displayPreferencesId, new Guid(userId), client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1203,22 +1203,22 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
/// <param name="userId">The user identifier.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
/// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
/// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
||||||
/// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception>
|
/// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception>
|
||||||
public void AddAdditionalUser(string sessionId, Guid userId)
|
public void AddAdditionalUser(string sessionId, string userId)
|
||||||
{
|
{
|
||||||
var session = GetSession(sessionId);
|
var session = GetSession(sessionId);
|
||||||
|
|
||||||
if (session.UserId.HasValue && session.UserId.Value == userId)
|
if (session.UserId.HasValue && session.UserId.Value == new Guid(userId))
|
||||||
{
|
{
|
||||||
throw new ArgumentException("The requested user is already the primary user of the session.");
|
throw new ArgumentException("The requested user is already the primary user of the session.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.AdditionalUsers.All(i => new Guid(i.UserId) != userId))
|
if (session.AdditionalUsers.All(i => new Guid(i.UserId) != new Guid(userId)))
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
session.AdditionalUsers.Add(new SessionUserInfo
|
session.AdditionalUsers.Add(new SessionUserInfo
|
||||||
{
|
{
|
||||||
UserId = userId.ToString("N"),
|
UserId = userId,
|
||||||
UserName = user.Name
|
UserName = user.Name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1231,16 +1231,16 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
/// <param name="userId">The user identifier.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
/// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
/// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
||||||
/// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception>
|
/// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception>
|
||||||
public void RemoveAdditionalUser(string sessionId, Guid userId)
|
public void RemoveAdditionalUser(string sessionId, string userId)
|
||||||
{
|
{
|
||||||
var session = GetSession(sessionId);
|
var session = GetSession(sessionId);
|
||||||
|
|
||||||
if (session.UserId.HasValue && session.UserId.Value == userId)
|
if (session.UserId.HasValue && session.UserId.Value == new Guid(userId))
|
||||||
{
|
{
|
||||||
throw new ArgumentException("The requested user is already the primary user of the session.");
|
throw new ArgumentException("The requested user is already the primary user of the session.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = session.AdditionalUsers.FirstOrDefault(i => new Guid(i.UserId) == userId);
|
var user = session.AdditionalUsers.FirstOrDefault(i => new Guid(i.UserId) == new Guid(userId));
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -234,9 +234,15 @@
|
||||||
<Content Include="dashboard-ui\thirdparty\cordova\android\androidcredentials.js">
|
<Content Include="dashboard-ui\thirdparty\cordova\android\androidcredentials.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\cordova\android\filesystem.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\thirdparty\cordova\android\iap.js">
|
<Content Include="dashboard-ui\thirdparty\cordova\android\iap.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\cordova\android\imagestore.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\thirdparty\cordova\android\immersive.js" />
|
<Content Include="dashboard-ui\thirdparty\cordova\android\immersive.js" />
|
||||||
<Content Include="dashboard-ui\thirdparty\cordova\chromecast.js">
|
<Content Include="dashboard-ui\thirdparty\cordova\chromecast.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
@ -247,6 +253,9 @@
|
||||||
<Content Include="dashboard-ui\thirdparty\cordova\externalplayer.js">
|
<Content Include="dashboard-ui\thirdparty\cordova\externalplayer.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\cordova\filesystem.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\thirdparty\cordova\generaldevice.js" />
|
<Content Include="dashboard-ui\thirdparty\cordova\generaldevice.js" />
|
||||||
<Content Include="dashboard-ui\thirdparty\cordova\iap.js">
|
<Content Include="dashboard-ui\thirdparty\cordova\iap.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
@ -1040,6 +1049,9 @@
|
||||||
<Content Include="dashboard-ui\thirdparty\fastclick.js">
|
<Content Include="dashboard-ui\thirdparty\fastclick.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\filesystem.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\thirdparty\fontawesome\css\font-awesome.css">
|
<Content Include="dashboard-ui\thirdparty\fontawesome\css\font-awesome.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user