improve theme song methods
This commit is contained in:
parent
5f75f9ce87
commit
191befa788
|
@ -161,7 +161,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="UpdateUserItemRating"/> is likes.
|
||||
/// Gets or sets a value indicating whether this <see cref="UpdateUserItemRating" /> is likes.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if likes; otherwise, <c>false</c>.</value>
|
||||
[ApiMember(Name = "Likes", Description = "Whether the user likes the item or not. true/false", IsRequired = true, DataType = "boolean", ParameterType = "query", Verb = "POST")]
|
||||
|
@ -212,6 +212,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class OnPlaybackStart
|
||||
/// </summary>
|
||||
[Route("/Users/{UserId}/PlayingItems/{Id}", "POST")]
|
||||
[Api(Description = "Reports that a user has begun playing an item")]
|
||||
public class OnPlaybackStart : IReturnVoid
|
||||
|
@ -231,6 +234,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class OnPlaybackProgress
|
||||
/// </summary>
|
||||
[Route("/Users/{UserId}/PlayingItems/{Id}/Progress", "POST")]
|
||||
[Api(Description = "Reports a user's playback progress")]
|
||||
public class OnPlaybackProgress : IReturnVoid
|
||||
|
@ -257,6 +263,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
public long? PositionTicks { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class OnPlaybackStopped
|
||||
/// </summary>
|
||||
[Route("/Users/{UserId}/PlayingItems/{Id}", "DELETE")]
|
||||
[Api(Description = "Reports that a user has stopped playing an item")]
|
||||
public class OnPlaybackStopped : IReturnVoid
|
||||
|
@ -282,7 +291,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
[ApiMember(Name = "PositionTicks", Description = "Optional. The position, in ticks, where playback stopped. 1 tick = 10000 ms", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "DELETE")]
|
||||
public long? PositionTicks { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Class GetLocalTrailers
|
||||
/// </summary>
|
||||
|
@ -305,9 +314,12 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class GetThemeSongs
|
||||
/// </summary>
|
||||
[Route("/Users/{UserId}/Items/{Id}/ThemeSongs", "GET")]
|
||||
[Api(Description = "Gets theme songs for an item")]
|
||||
public class GetThemeSongs : IReturn<List<BaseItemDto>>
|
||||
public class GetThemeSongs : IReturn<ThemeSongsResult>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the user id.
|
||||
|
@ -356,12 +368,21 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// The _user manager
|
||||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
/// <summary>
|
||||
/// The _user data repository
|
||||
/// </summary>
|
||||
private readonly IUserDataRepository _userDataRepository;
|
||||
/// <summary>
|
||||
/// The _library manager
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UserLibraryService" /> class.
|
||||
/// </summary>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="userDataRepository">The user data repository.</param>
|
||||
/// <exception cref="System.ArgumentNullException">jsonSerializer</exception>
|
||||
public UserLibraryService(IUserManager userManager, ILibraryManager libraryManager, IUserDataRepository userDataRepository)
|
||||
: base()
|
||||
|
@ -431,9 +452,16 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
|
||||
var dtoBuilder = new DtoBuilder(Logger, _libraryManager, _userDataRepository);
|
||||
|
||||
var items = item.ThemeSongs.Select(i => dtoBuilder.GetBaseItemDto(i, user, fields)).AsParallel().Select(t => t.Result).ToList();
|
||||
var items = item.ThemeSongs.Select(i => dtoBuilder.GetBaseItemDto(i, user, fields)).AsParallel().Select(t => t.Result).ToArray();
|
||||
|
||||
return ToOptimizedResult(items);
|
||||
var result = new ThemeSongsResult
|
||||
{
|
||||
Items = items,
|
||||
TotalRecordCount = items.Length,
|
||||
OwnerId = DtoBuilder.GetClientItemId(item)
|
||||
};
|
||||
|
||||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -457,6 +485,11 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public object Get(GetRootFolder request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
|
@ -472,7 +505,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
|
||||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified request.
|
||||
/// </summary>
|
||||
|
@ -523,7 +556,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
var item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id);
|
||||
|
||||
var key = item.GetUserDataKey();
|
||||
|
||||
|
||||
// Get the user data for this item
|
||||
var data = _userDataRepository.GetUserData(user.Id, key).Result;
|
||||
|
||||
|
@ -546,7 +579,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
var item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id);
|
||||
|
||||
var key = item.GetUserDataKey();
|
||||
|
||||
|
||||
// Get the user data for this item
|
||||
var data = _userDataRepository.GetUserData(user.Id, key).Result;
|
||||
|
||||
|
@ -568,7 +601,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
var item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id);
|
||||
|
||||
var key = item.GetUserDataKey();
|
||||
|
||||
|
||||
// Get the user data for this item
|
||||
var data = _userDataRepository.GetUserData(user.Id, key).Result;
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
<Compile Include="Net\NetworkShare.cs" />
|
||||
<Compile Include="Net\NetworkShareType.cs" />
|
||||
<Compile Include="Querying\PersonsQuery.cs" />
|
||||
<Compile Include="Querying\ThemeSongsResult.cs" />
|
||||
<Compile Include="Serialization\IJsonSerializer.cs" />
|
||||
<Compile Include="Serialization\IXmlSerializer.cs" />
|
||||
<Compile Include="Updates\CheckForUpdateResult.cs" />
|
||||
|
|
16
MediaBrowser.Model/Querying/ThemeSongsResult.cs
Normal file
16
MediaBrowser.Model/Querying/ThemeSongsResult.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Querying
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ThemeSongsResult
|
||||
/// </summary>
|
||||
public class ThemeSongsResult : ItemsResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the owner id.
|
||||
/// </summary>
|
||||
/// <value>The owner id.</value>
|
||||
public string OwnerId { get; set; }
|
||||
}
|
||||
}
|
|
@ -18,7 +18,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
/// </summary>
|
||||
private static readonly List<string> IgnoreFolders = new List<string>
|
||||
{
|
||||
"trailers",
|
||||
"metadata",
|
||||
"certificate",
|
||||
"backup",
|
||||
|
@ -55,6 +54,16 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (string.Equals(filename, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (string.Equals(filename, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user