Merge pull request #2848 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-08-27 20:38:31 -04:00 committed by GitHub
commit 2cce1a8caf
18 changed files with 87 additions and 99 deletions

View File

@ -386,6 +386,9 @@ namespace Emby.Dlna.PlayTo
case PlaystateCommand.Unpause: case PlaystateCommand.Unpause:
return _device.SetPlay(); return _device.SetPlay();
case PlaystateCommand.PlayPause:
return _device.IsPaused ? _device.SetPlay() : _device.SetPause();
case PlaystateCommand.Seek: case PlaystateCommand.Seek:
{ {
return Seek(command.SeekPositionTicks ?? 0); return Seek(command.SeekPositionTicks ?? 0);

View File

@ -182,8 +182,7 @@ namespace Emby.Server.Implementations.Channels
{ {
}; };
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user) var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
.ConfigureAwait(false));
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -567,7 +566,7 @@ namespace Emby.Server.Implementations.Channels
Fields = query.Fields Fields = query.Fields
}; };
var returnItems = (await _dtoService.GetBaseItemDtos(items, dtoOptions, user).ConfigureAwait(false)); var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user);
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -832,8 +831,7 @@ namespace Emby.Server.Implementations.Channels
Fields = query.Fields Fields = query.Fields
}; };
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user) var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
.ConfigureAwait(false));
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -984,8 +982,7 @@ namespace Emby.Server.Implementations.Channels
Fields = query.Fields Fields = query.Fields
}; };
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user) var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
.ConfigureAwait(false));
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {

View File

@ -87,17 +87,17 @@ namespace Emby.Server.Implementations.Dto
return GetBaseItemDto(item, options, user, owner); return GetBaseItemDto(item, options, user, owner);
} }
public Task<BaseItemDto[]> GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null) public BaseItemDto[] GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)
{ {
return GetBaseItemDtos(items, items.Count, options, user, owner); return GetBaseItemDtos(items, items.Count, options, user, owner);
} }
public Task<BaseItemDto[]> GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null) public BaseItemDto[] GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null)
{ {
return GetBaseItemDtos(items, items.Length, options, user, owner); return GetBaseItemDtos(items, items.Length, options, user, owner);
} }
public async Task<BaseItemDto[]> GetBaseItemDtos(IEnumerable<BaseItem> items, int itemCount, DtoOptions options, User user = null, BaseItem owner = null) public BaseItemDto[] GetBaseItemDtos(IEnumerable<BaseItem> items, int itemCount, DtoOptions options, User user = null, BaseItem owner = null)
{ {
if (items == null) if (items == null)
{ {
@ -157,12 +157,13 @@ namespace Emby.Server.Implementations.Dto
if (programTuples.Count > 0) if (programTuples.Count > 0)
{ {
await _livetvManager().AddInfoToProgramDto(programTuples, options.Fields, user).ConfigureAwait(false); var task = _livetvManager().AddInfoToProgramDto(programTuples, options.Fields, user);
Task.WaitAll(task);
} }
if (channelTuples.Count > 0) if (channelTuples.Count > 0)
{ {
await _livetvManager().AddChannelInfo(channelTuples, options, user).ConfigureAwait(false); _livetvManager().AddChannelInfo(channelTuples, options, user);
} }
return returnItems; return returnItems;
@ -177,8 +178,7 @@ namespace Emby.Server.Implementations.Dto
if (tvChannel != null) if (tvChannel != null)
{ {
var list = new List<Tuple<BaseItemDto, LiveTvChannel>> { new Tuple<BaseItemDto, LiveTvChannel>(dto, tvChannel) }; var list = new List<Tuple<BaseItemDto, LiveTvChannel>> { new Tuple<BaseItemDto, LiveTvChannel>(dto, tvChannel) };
var task = _livetvManager().AddChannelInfo(list, options, user); _livetvManager().AddChannelInfo(list, options, user);
Task.WaitAll(task);
} }
else if (item is LiveTvProgram) else if (item is LiveTvProgram)
{ {

View File

@ -1810,7 +1810,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
var config = GetConfiguration(); var config = GetConfiguration();
var regInfo = await _liveTvManager.GetRegistrationInfo("embytvrecordingconversion").ConfigureAwait(false); var regInfo = await _liveTvManager.GetRegistrationInfo("dvr").ConfigureAwait(false);
if (regInfo.IsValid) if (regInfo.IsValid)
{ {

View File

@ -985,8 +985,7 @@ namespace Emby.Server.Implementations.LiveTv
var queryResult = _libraryManager.QueryItems(internalQuery); var queryResult = _libraryManager.QueryItems(internalQuery);
var returnArray = (await _dtoService.GetBaseItemDtos(queryResult.Items, options, user) var returnArray = _dtoService.GetBaseItemDtos(queryResult.Items, options, user);
.ConfigureAwait(false));
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -1070,8 +1069,7 @@ namespace Emby.Server.Implementations.LiveTv
var user = _userManager.GetUserById(query.UserId); var user = _userManager.GetUserById(query.UserId);
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user) var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user);
.ConfigureAwait(false));
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -1656,7 +1654,7 @@ namespace Emby.Server.Implementations.LiveTv
}); });
} }
public async Task<QueryResult<BaseItemDto>> GetRecordingSeries(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken) public QueryResult<BaseItemDto> GetRecordingSeries(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken)
{ {
var user = string.IsNullOrEmpty(query.UserId) ? null : _userManager.GetUserById(query.UserId); var user = string.IsNullOrEmpty(query.UserId) ? null : _userManager.GetUserById(query.UserId);
if (user != null && !IsLiveTvEnabled(user)) if (user != null && !IsLiveTvEnabled(user))
@ -1702,8 +1700,7 @@ namespace Emby.Server.Implementations.LiveTv
DtoOptions = options DtoOptions = options
}); });
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user) var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user);
.ConfigureAwait(false));
return new QueryResult<BaseItemDto> return new QueryResult<BaseItemDto>
{ {
@ -2040,8 +2037,7 @@ namespace Emby.Server.Implementations.LiveTv
var internalResult = await GetInternalRecordings(query, options, cancellationToken).ConfigureAwait(false); var internalResult = await GetInternalRecordings(query, options, cancellationToken).ConfigureAwait(false);
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user) var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user);
.ConfigureAwait(false));
return new QueryResult<BaseItemDto> return new QueryResult<BaseItemDto>
{ {
@ -2368,7 +2364,7 @@ namespace Emby.Server.Implementations.LiveTv
}; };
} }
public async Task AddChannelInfo(List<Tuple<BaseItemDto, LiveTvChannel>> tuples, DtoOptions options, User user) public void AddChannelInfo(List<Tuple<BaseItemDto, LiveTvChannel>> tuples, DtoOptions options, User user)
{ {
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
@ -2425,7 +2421,7 @@ namespace Emby.Server.Implementations.LiveTv
if (addCurrentProgram) if (addCurrentProgram)
{ {
var currentProgramDtos = await _dtoService.GetBaseItemDtos(currentProgramsList, options, user).ConfigureAwait(false); var currentProgramDtos = _dtoService.GetBaseItemDtos(currentProgramsList, options, user);
foreach (var programDto in currentProgramDtos) foreach (var programDto in currentProgramDtos)
{ {

View File

@ -128,7 +128,7 @@ namespace MediaBrowser.Api
DisplayName = system.Name DisplayName = system.Name
}; };
var items = user == null ? var items = user == null ?
system.GetRecursiveChildren(i => i is Game) : system.GetRecursiveChildren(i => i is Game) :
system.GetRecursiveChildren(user, new InternalItemsQuery(user) system.GetRecursiveChildren(user, new InternalItemsQuery(user)
{ {
@ -157,14 +157,14 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public async Task<object> Get(GetSimilarGames request) public object Get(GetSimilarGames request)
{ {
var result = await GetSimilarItemsResult(request).ConfigureAwait(false); var result = GetSimilarItemsResult(request);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
private async Task<QueryResult<BaseItemDto>> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request) private QueryResult<BaseItemDto> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request)
{ {
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
@ -186,7 +186,7 @@ namespace MediaBrowser.Api
}); });
var returnList = (await _dtoService.GetBaseItemDtos(itemsResult, dtoOptions, user).ConfigureAwait(false)); var returnList = _dtoService.GetBaseItemDtos(itemsResult, dtoOptions, user);
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {

View File

@ -922,8 +922,7 @@ namespace MediaBrowser.Api.LiveTv
options.AddCurrentProgram = request.AddCurrentProgram; options.AddCurrentProgram = request.AddCurrentProgram;
var returnArray = (await _dtoService.GetBaseItemDtos(channelResult.Items, options, user) var returnArray = _dtoService.GetBaseItemDtos(channelResult.Items, options, user);
.ConfigureAwait(false));
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -1075,12 +1074,12 @@ namespace MediaBrowser.Api.LiveTv
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
public async Task<object> Get(GetRecordingSeries request) public object Get(GetRecordingSeries request)
{ {
var options = GetDtoOptions(_authContext, request); var options = GetDtoOptions(_authContext, request);
options.DeviceId = _authContext.GetAuthorizationInfo(Request).DeviceId; options.DeviceId = _authContext.GetAuthorizationInfo(Request).DeviceId;
var result = await _liveTvManager.GetRecordingSeries(new RecordingQuery var result = _liveTvManager.GetRecordingSeries(new RecordingQuery
{ {
ChannelId = request.ChannelId, ChannelId = request.ChannelId,
UserId = request.UserId, UserId = request.UserId,
@ -1092,7 +1091,7 @@ namespace MediaBrowser.Api.LiveTv
IsInProgress = request.IsInProgress, IsInProgress = request.IsInProgress,
EnableTotalRecordCount = request.EnableTotalRecordCount EnableTotalRecordCount = request.EnableTotalRecordCount
}, options, CancellationToken.None).ConfigureAwait(false); }, options, CancellationToken.None);
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }

View File

@ -113,16 +113,16 @@ namespace MediaBrowser.Api.Movies
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public async Task<object> Get(GetSimilarMovies request) public object Get(GetSimilarMovies request)
{ {
var result = await GetSimilarItemsResult(request).ConfigureAwait(false); var result = GetSimilarItemsResult(request);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
public async Task<object> Get(GetSimilarTrailers request) public object Get(GetSimilarTrailers request)
{ {
var result = await GetSimilarItemsResult(request).ConfigureAwait(false); var result = GetSimilarItemsResult(request);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
@ -138,7 +138,7 @@ namespace MediaBrowser.Api.Movies
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
private async Task<QueryResult<BaseItemDto>> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request) private QueryResult<BaseItemDto> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request)
{ {
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
@ -166,7 +166,7 @@ namespace MediaBrowser.Api.Movies
}); });
var returnList = await _dtoService.GetBaseItemDtos(itemsResult, dtoOptions, user).ConfigureAwait(false); var returnList = _dtoService.GetBaseItemDtos(itemsResult, dtoOptions, user);
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -313,7 +313,7 @@ namespace MediaBrowser.Api.Movies
if (items.Count > 0) if (items.Count > 0)
{ {
var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user).Result; var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user);
yield return new RecommendationDto yield return new RecommendationDto
{ {
@ -353,7 +353,7 @@ namespace MediaBrowser.Api.Movies
if (items.Count > 0) if (items.Count > 0)
{ {
var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user).Result; var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user);
yield return new RecommendationDto yield return new RecommendationDto
{ {
@ -390,7 +390,7 @@ namespace MediaBrowser.Api.Movies
if (similar.Count > 0) if (similar.Count > 0)
{ {
var returnItems = _dtoService.GetBaseItemDtos(similar, dtoOptions, user).Result; var returnItems = _dtoService.GetBaseItemDtos(similar, dtoOptions, user);
yield return new RecommendationDto yield return new RecommendationDto
{ {

View File

@ -7,7 +7,6 @@ using MediaBrowser.Controller.Persistence;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Model.Services; using MediaBrowser.Model.Services;
namespace MediaBrowser.Api.Music namespace MediaBrowser.Api.Music
@ -52,43 +51,43 @@ namespace MediaBrowser.Api.Music
_authContext = authContext; _authContext = authContext;
} }
public async Task<object> Get(GetSimilarArtists request) public object Get(GetSimilarArtists request)
{ {
var dtoOptions = GetDtoOptions(_authContext, request); var dtoOptions = GetDtoOptions(_authContext, request);
var result = await SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager, var result = SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
_itemRepo, _itemRepo,
_libraryManager, _libraryManager,
_userDataRepository, _userDataRepository,
_dtoService, _dtoService,
Logger, Logger,
request, new[] { typeof(MusicArtist) }, request, new[] { typeof(MusicArtist) },
SimilarItemsHelper.GetSimiliarityScore).ConfigureAwait(false); SimilarItemsHelper.GetSimiliarityScore);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
/// <summary> /// <summary>
/// Gets the specified request. /// Gets the specified request.
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public async Task<object> Get(GetSimilarAlbums request) public object Get(GetSimilarAlbums request)
{ {
var dtoOptions = GetDtoOptions(_authContext, request); var dtoOptions = GetDtoOptions(_authContext, request);
var result = await SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager, var result = SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
_itemRepo, _itemRepo,
_libraryManager, _libraryManager,
_userDataRepository, _userDataRepository,
_dtoService, _dtoService,
Logger, Logger,
request, new[] { typeof(MusicAlbum) }, request, new[] { typeof(MusicAlbum) },
GetAlbumSimilarityScore).ConfigureAwait(false); GetAlbumSimilarityScore);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
/// <summary> /// <summary>
/// Gets the album similarity score. /// Gets the album similarity score.
/// </summary> /// </summary>

View File

@ -81,7 +81,7 @@ namespace MediaBrowser.Api.Music
_authContext = authContext; _authContext = authContext;
} }
public Task<object> Get(GetInstantMixFromItem request) public object Get(GetInstantMixFromItem request)
{ {
var item = _libraryManager.GetItemById(request.Id); var item = _libraryManager.GetItemById(request.Id);
@ -94,7 +94,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions); return GetResult(items, user, request, dtoOptions);
} }
public Task<object> Get(GetInstantMixFromArtistId request) public object Get(GetInstantMixFromArtistId request)
{ {
var item = _libraryManager.GetItemById(request.Id); var item = _libraryManager.GetItemById(request.Id);
@ -107,7 +107,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions); return GetResult(items, user, request, dtoOptions);
} }
public Task<object> Get(GetInstantMixFromMusicGenreId request) public object Get(GetInstantMixFromMusicGenreId request)
{ {
var item = _libraryManager.GetItemById(request.Id); var item = _libraryManager.GetItemById(request.Id);
@ -120,7 +120,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions); return GetResult(items, user, request, dtoOptions);
} }
public Task<object> Get(GetInstantMixFromSong request) public object Get(GetInstantMixFromSong request)
{ {
var item = _libraryManager.GetItemById(request.Id); var item = _libraryManager.GetItemById(request.Id);
@ -133,7 +133,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions); return GetResult(items, user, request, dtoOptions);
} }
public Task<object> Get(GetInstantMixFromAlbum request) public object Get(GetInstantMixFromAlbum request)
{ {
var album = _libraryManager.GetItemById(request.Id); var album = _libraryManager.GetItemById(request.Id);
@ -146,7 +146,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions); return GetResult(items, user, request, dtoOptions);
} }
public Task<object> Get(GetInstantMixFromPlaylist request) public object Get(GetInstantMixFromPlaylist request)
{ {
var playlist = (Playlist)_libraryManager.GetItemById(request.Id); var playlist = (Playlist)_libraryManager.GetItemById(request.Id);
@ -159,7 +159,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions); return GetResult(items, user, request, dtoOptions);
} }
public Task<object> Get(GetInstantMixFromMusicGenre request) public object Get(GetInstantMixFromMusicGenre request)
{ {
var user = _userManager.GetUserById(request.UserId); var user = _userManager.GetUserById(request.UserId);
@ -170,7 +170,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions); return GetResult(items, user, request, dtoOptions);
} }
public Task<object> Get(GetInstantMixFromArtist request) public object Get(GetInstantMixFromArtist request)
{ {
var user = _userManager.GetUserById(request.UserId); var user = _userManager.GetUserById(request.UserId);
var artist = _libraryManager.GetArtist(request.Name, new DtoOptions(false)); var artist = _libraryManager.GetArtist(request.Name, new DtoOptions(false));
@ -182,7 +182,7 @@ namespace MediaBrowser.Api.Music
return GetResult(items, user, request, dtoOptions); return GetResult(items, user, request, dtoOptions);
} }
private async Task<object> GetResult(List<BaseItem> items, User user, BaseGetSimilarItems request, DtoOptions dtoOptions) private object GetResult(List<BaseItem> items, User user, BaseGetSimilarItems request, DtoOptions dtoOptions)
{ {
var list = items; var list = items;
@ -196,8 +196,7 @@ namespace MediaBrowser.Api.Music
list = list.Take(request.Limit.Value).ToList(); list = list.Take(request.Limit.Value).ToList();
} }
var returnList = (await _dtoService.GetBaseItemDtos(list, dtoOptions, user) var returnList = _dtoService.GetBaseItemDtos(list, dtoOptions, user);
.ConfigureAwait(false));
result.Items = returnList; result.Items = returnList;

View File

@ -172,7 +172,7 @@ namespace MediaBrowser.Api
Task.WaitAll(task); Task.WaitAll(task);
} }
public async Task<object> Get(GetPlaylistItems request) public object Get(GetPlaylistItems request)
{ {
var playlist = (Playlist)_libraryManager.GetItemById(request.Id); var playlist = (Playlist)_libraryManager.GetItemById(request.Id);
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
@ -193,8 +193,7 @@ namespace MediaBrowser.Api
var dtoOptions = GetDtoOptions(_authContext, request); var dtoOptions = GetDtoOptions(_authContext, request);
var dtos = (await _dtoService.GetBaseItemDtos(items.Select(i => i.Item2).ToList(), dtoOptions, user) var dtos = _dtoService.GetBaseItemDtos(items.Select(i => i.Item2).ToList(), dtoOptions, user);
.ConfigureAwait(false));
var index = 0; var index = 0;
foreach (var item in dtos) foreach (var item in dtos)

View File

@ -71,7 +71,7 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
public static class SimilarItemsHelper public static class SimilarItemsHelper
{ {
internal static async Task<QueryResult<BaseItemDto>> GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Type[] includeTypes, Func<BaseItem, List<PersonInfo>, List<PersonInfo>, BaseItem, int> getSimilarityScore) internal static QueryResult<BaseItemDto> GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Type[] includeTypes, Func<BaseItem, List<PersonInfo>, List<PersonInfo>, BaseItem, int> getSimilarityScore)
{ {
var user = !string.IsNullOrWhiteSpace(request.UserId) ? userManager.GetUserById(request.UserId) : null; var user = !string.IsNullOrWhiteSpace(request.UserId) ? userManager.GetUserById(request.UserId) : null;
@ -104,7 +104,7 @@ namespace MediaBrowser.Api
returnItems = returnItems.Take(request.Limit.Value).ToList(); returnItems = returnItems.Take(request.Limit.Value).ToList();
} }
var dtos = await dtoService.GetBaseItemDtos(returnItems, dtoOptions, user).ConfigureAwait(false); var dtos = dtoService.GetBaseItemDtos(returnItems, dtoOptions, user);
return new QueryResult<BaseItemDto> return new QueryResult<BaseItemDto>
{ {

View File

@ -47,21 +47,21 @@ namespace MediaBrowser.Api
_libraryManager = libraryManager; _libraryManager = libraryManager;
} }
public async Task<object> Get(GetSuggestedItems request) public object Get(GetSuggestedItems request)
{ {
var result = await GetResultItems(request).ConfigureAwait(false); var result = GetResultItems(request);
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
private async Task<QueryResult<BaseItemDto>> GetResultItems(GetSuggestedItems request) private QueryResult<BaseItemDto> GetResultItems(GetSuggestedItems request)
{ {
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
var dtoOptions = GetDtoOptions(_authContext, request); var dtoOptions = GetDtoOptions(_authContext, request);
var result = GetItems(request, user, dtoOptions); var result = GetItems(request, user, dtoOptions);
var dtoList = await _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user).ConfigureAwait(false); var dtoList = _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user);
if (dtoList == null) if (dtoList == null)
{ {

View File

@ -293,14 +293,14 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public async Task<object> Get(GetSimilarShows request) public object Get(GetSimilarShows request)
{ {
var result = await GetSimilarItemsResult(request).ConfigureAwait(false); var result = GetSimilarItemsResult(request);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
private async Task<QueryResult<BaseItemDto>> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request) private QueryResult<BaseItemDto> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request)
{ {
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
@ -322,7 +322,7 @@ namespace MediaBrowser.Api
}); });
var returnList = (await _dtoService.GetBaseItemDtos(itemsResult, dtoOptions, user).ConfigureAwait(false)); var returnList = _dtoService.GetBaseItemDtos(itemsResult, dtoOptions, user);
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -334,7 +334,7 @@ namespace MediaBrowser.Api
return result; return result;
} }
public async Task<object> Get(GetUpcomingEpisodes request) public object Get(GetUpcomingEpisodes request)
{ {
var user = _userManager.GetUserById(request.UserId); var user = _userManager.GetUserById(request.UserId);
@ -358,7 +358,7 @@ namespace MediaBrowser.Api
}); });
var returnItems = (await _dtoService.GetBaseItemDtos(itemsResult, options, user).ConfigureAwait(false)); var returnItems = _dtoService.GetBaseItemDtos(itemsResult, options, user);
var result = new QueryResult<BaseItemDto> var result = new QueryResult<BaseItemDto>
{ {
@ -374,7 +374,7 @@ namespace MediaBrowser.Api
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public async Task<object> Get(GetNextUpEpisodes request) public object Get(GetNextUpEpisodes request)
{ {
var options = GetDtoOptions(_authContext, request); var options = GetDtoOptions(_authContext, request);
@ -390,7 +390,7 @@ namespace MediaBrowser.Api
var user = _userManager.GetUserById(request.UserId); var user = _userManager.GetUserById(request.UserId);
var returnItems = (await _dtoService.GetBaseItemDtos(result.Items, options, user).ConfigureAwait(false)); var returnItems = _dtoService.GetBaseItemDtos(result.Items, options, user);
return ToOptimizedSerializedResultUsingCache(new QueryResult<BaseItemDto> return ToOptimizedSerializedResultUsingCache(new QueryResult<BaseItemDto>
{ {
@ -423,7 +423,7 @@ namespace MediaBrowser.Api
return items; return items;
} }
public async Task<object> Get(GetSeasons request) public object Get(GetSeasons request)
{ {
var user = _userManager.GetUserById(request.UserId); var user = _userManager.GetUserById(request.UserId);
@ -444,7 +444,7 @@ namespace MediaBrowser.Api
var dtoOptions = GetDtoOptions(_authContext, request); var dtoOptions = GetDtoOptions(_authContext, request);
var returnItems = (await _dtoService.GetBaseItemDtos(seasons, dtoOptions, user).ConfigureAwait(false)); var returnItems = _dtoService.GetBaseItemDtos(seasons, dtoOptions, user);
return new QueryResult<BaseItemDto> return new QueryResult<BaseItemDto>
{ {
@ -463,7 +463,7 @@ namespace MediaBrowser.Api
return null; return null;
} }
public async Task<object> Get(GetEpisodes request) public object Get(GetEpisodes request)
{ {
var user = _userManager.GetUserById(request.UserId); var user = _userManager.GetUserById(request.UserId);
@ -544,7 +544,7 @@ namespace MediaBrowser.Api
returnItems = ApplyPaging(episodes, request.StartIndex, request.Limit).ToList(); returnItems = ApplyPaging(episodes, request.StartIndex, request.Limit).ToList();
} }
var dtos = (await _dtoService.GetBaseItemDtos(returnItems, dtoOptions, user).ConfigureAwait(false)); var dtos = _dtoService.GetBaseItemDtos(returnItems, dtoOptions, user);
return new QueryResult<BaseItemDto> return new QueryResult<BaseItemDto>
{ {

View File

@ -84,14 +84,14 @@ namespace MediaBrowser.Api.UserLibrary
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public async Task<object> Get(GetItems request) public object Get(GetItems request)
{ {
if (request == null) if (request == null)
{ {
throw new ArgumentNullException("request"); throw new ArgumentNullException("request");
} }
var result = await GetItems(request).ConfigureAwait(false); var result = GetItems(request);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
@ -100,8 +100,7 @@ namespace MediaBrowser.Api.UserLibrary
/// Gets the items. /// Gets the items.
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>Task{ItemsResult}.</returns> private QueryResult<BaseItemDto> GetItems(GetItems request)
private async Task<QueryResult<BaseItemDto>> GetItems(GetItems request)
{ {
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
@ -119,7 +118,7 @@ namespace MediaBrowser.Api.UserLibrary
throw new InvalidOperationException("GetItemsToSerialize result.Items returned null"); throw new InvalidOperationException("GetItemsToSerialize result.Items returned null");
} }
var dtoList = await _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user).ConfigureAwait(false); var dtoList = _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user);
if (dtoList == null) if (dtoList == null)
{ {

View File

@ -2,7 +2,6 @@
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using MediaBrowser.Controller.Sync; using MediaBrowser.Controller.Sync;
namespace MediaBrowser.Controller.Dto namespace MediaBrowser.Controller.Dto
@ -40,7 +39,6 @@ namespace MediaBrowser.Controller.Dto
/// <param name="fields">The fields.</param> /// <param name="fields">The fields.</param>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <param name="owner">The owner.</param> /// <param name="owner">The owner.</param>
/// <returns>Task{BaseItemDto}.</returns>
BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null); BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null);
/// <summary> /// <summary>
@ -60,10 +58,9 @@ namespace MediaBrowser.Controller.Dto
/// <param name="options">The options.</param> /// <param name="options">The options.</param>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <param name="owner">The owner.</param> /// <param name="owner">The owner.</param>
/// <returns>IEnumerable&lt;BaseItemDto&gt;.</returns> BaseItemDto[] GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null);
Task<BaseItemDto[]> GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null);
Task<BaseItemDto[]> GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null); BaseItemDto[] GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null);
/// <summary> /// <summary>
/// Gets the chapter information dto. /// Gets the chapter information dto.

View File

@ -109,7 +109,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>QueryResult{RecordingInfoDto}.</returns> /// <returns>QueryResult{RecordingInfoDto}.</returns>
Task<QueryResult<BaseItemDto>> GetRecordings(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken); Task<QueryResult<BaseItemDto>> GetRecordings(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken);
Task<QueryResult<BaseItemDto>> GetRecordingSeries(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken); QueryResult<BaseItemDto> GetRecordingSeries(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the timers. /// Gets the timers.
@ -360,7 +360,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="items">The items.</param> /// <param name="items">The items.</param>
/// <param name="options">The options.</param> /// <param name="options">The options.</param>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
Task AddChannelInfo(List<Tuple<BaseItemDto, LiveTvChannel>> items, DtoOptions options, User user); void AddChannelInfo(List<Tuple<BaseItemDto, LiveTvChannel>> items, DtoOptions options, User user);
/// <summary> /// <summary>
/// Called when [recording file deleted]. /// Called when [recording file deleted].

View File

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.28.8")] [assembly: AssemblyVersion("3.2.29.1")]