update dto methods
This commit is contained in:
parent
cc85dcc9d1
commit
ed81591175
|
@ -386,6 +386,9 @@ namespace Emby.Dlna.PlayTo
|
|||
case PlaystateCommand.Unpause:
|
||||
return _device.SetPlay();
|
||||
|
||||
case PlaystateCommand.PlayPause:
|
||||
return _device.IsPaused ? _device.SetPlay() : _device.SetPause();
|
||||
|
||||
case PlaystateCommand.Seek:
|
||||
{
|
||||
return Seek(command.SeekPositionTicks ?? 0);
|
||||
|
|
|
@ -182,8 +182,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
{
|
||||
};
|
||||
|
||||
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
|
@ -567,7 +566,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
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>
|
||||
{
|
||||
|
@ -832,8 +831,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
Fields = query.Fields
|
||||
};
|
||||
|
||||
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
|
@ -984,8 +982,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
Fields = query.Fields
|
||||
};
|
||||
|
||||
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
|
|
|
@ -87,17 +87,17 @@ namespace Emby.Server.Implementations.Dto
|
|||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -157,12 +157,13 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
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)
|
||||
{
|
||||
await _livetvManager().AddChannelInfo(channelTuples, options, user).ConfigureAwait(false);
|
||||
_livetvManager().AddChannelInfo(channelTuples, options, user);
|
||||
}
|
||||
|
||||
return returnItems;
|
||||
|
@ -177,8 +178,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
if (tvChannel != null)
|
||||
{
|
||||
var list = new List<Tuple<BaseItemDto, LiveTvChannel>> { new Tuple<BaseItemDto, LiveTvChannel>(dto, tvChannel) };
|
||||
var task = _livetvManager().AddChannelInfo(list, options, user);
|
||||
Task.WaitAll(task);
|
||||
_livetvManager().AddChannelInfo(list, options, user);
|
||||
}
|
||||
else if (item is LiveTvProgram)
|
||||
{
|
||||
|
|
|
@ -1810,7 +1810,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var config = GetConfiguration();
|
||||
|
||||
var regInfo = await _liveTvManager.GetRegistrationInfo("embytvrecordingconversion").ConfigureAwait(false);
|
||||
var regInfo = await _liveTvManager.GetRegistrationInfo("dvr").ConfigureAwait(false);
|
||||
|
||||
if (regInfo.IsValid)
|
||||
{
|
||||
|
|
|
@ -985,8 +985,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
|
||||
var queryResult = _libraryManager.QueryItems(internalQuery);
|
||||
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(queryResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnArray = _dtoService.GetBaseItemDtos(queryResult.Items, options, user);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
|
@ -1070,8 +1069,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
|
||||
var user = _userManager.GetUserById(query.UserId);
|
||||
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user);
|
||||
|
||||
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);
|
||||
if (user != null && !IsLiveTvEnabled(user))
|
||||
|
@ -1702,8 +1700,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
DtoOptions = options
|
||||
});
|
||||
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user);
|
||||
|
||||
return new QueryResult<BaseItemDto>
|
||||
{
|
||||
|
@ -2040,8 +2037,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
|
||||
var internalResult = await GetInternalRecordings(query, options, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user);
|
||||
|
||||
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;
|
||||
|
||||
|
@ -2425,7 +2421,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
|
||||
if (addCurrentProgram)
|
||||
{
|
||||
var currentProgramDtos = await _dtoService.GetBaseItemDtos(currentProgramsList, options, user).ConfigureAwait(false);
|
||||
var currentProgramDtos = _dtoService.GetBaseItemDtos(currentProgramsList, options, user);
|
||||
|
||||
foreach (var programDto in currentProgramDtos)
|
||||
{
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace MediaBrowser.Api
|
|||
DisplayName = system.Name
|
||||
};
|
||||
|
||||
var items = user == null ?
|
||||
var items = user == null ?
|
||||
system.GetRecursiveChildren(i => i is Game) :
|
||||
system.GetRecursiveChildren(user, new InternalItemsQuery(user)
|
||||
{
|
||||
|
@ -157,14 +157,14 @@ namespace MediaBrowser.Api
|
|||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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>
|
||||
{
|
||||
|
|
|
@ -922,8 +922,7 @@ namespace MediaBrowser.Api.LiveTv
|
|||
|
||||
options.AddCurrentProgram = request.AddCurrentProgram;
|
||||
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(channelResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnArray = _dtoService.GetBaseItemDtos(channelResult.Items, options, user);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
|
@ -1075,12 +1074,12 @@ namespace MediaBrowser.Api.LiveTv
|
|||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetRecordingSeries request)
|
||||
public object Get(GetRecordingSeries request)
|
||||
{
|
||||
var options = GetDtoOptions(_authContext, request);
|
||||
options.DeviceId = _authContext.GetAuthorizationInfo(Request).DeviceId;
|
||||
|
||||
var result = await _liveTvManager.GetRecordingSeries(new RecordingQuery
|
||||
var result = _liveTvManager.GetRecordingSeries(new RecordingQuery
|
||||
{
|
||||
ChannelId = request.ChannelId,
|
||||
UserId = request.UserId,
|
||||
|
@ -1092,7 +1091,7 @@ namespace MediaBrowser.Api.LiveTv
|
|||
IsInProgress = request.IsInProgress,
|
||||
EnableTotalRecordCount = request.EnableTotalRecordCount
|
||||
|
||||
}, options, CancellationToken.None).ConfigureAwait(false);
|
||||
}, options, CancellationToken.None);
|
||||
|
||||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
|
|
@ -113,16 +113,16 @@ namespace MediaBrowser.Api.Movies
|
|||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace MediaBrowser.Api.Movies
|
|||
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;
|
||||
|
||||
|
@ -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>
|
||||
{
|
||||
|
@ -313,7 +313,7 @@ namespace MediaBrowser.Api.Movies
|
|||
|
||||
if (items.Count > 0)
|
||||
{
|
||||
var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user).Result;
|
||||
var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user);
|
||||
|
||||
yield return new RecommendationDto
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ namespace MediaBrowser.Api.Movies
|
|||
|
||||
if (items.Count > 0)
|
||||
{
|
||||
var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user).Result;
|
||||
var returnItems = _dtoService.GetBaseItemDtos(items, dtoOptions, user);
|
||||
|
||||
yield return new RecommendationDto
|
||||
{
|
||||
|
@ -390,7 +390,7 @@ namespace MediaBrowser.Api.Movies
|
|||
|
||||
if (similar.Count > 0)
|
||||
{
|
||||
var returnItems = _dtoService.GetBaseItemDtos(similar, dtoOptions, user).Result;
|
||||
var returnItems = _dtoService.GetBaseItemDtos(similar, dtoOptions, user);
|
||||
|
||||
yield return new RecommendationDto
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ using MediaBrowser.Controller.Persistence;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
namespace MediaBrowser.Api.Music
|
||||
|
@ -52,43 +51,43 @@ namespace MediaBrowser.Api.Music
|
|||
_authContext = authContext;
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetSimilarArtists request)
|
||||
public object Get(GetSimilarArtists request)
|
||||
{
|
||||
var dtoOptions = GetDtoOptions(_authContext, request);
|
||||
|
||||
var result = await SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
|
||||
var result = SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
|
||||
_itemRepo,
|
||||
_libraryManager,
|
||||
_userDataRepository,
|
||||
_dtoService,
|
||||
Logger,
|
||||
request, new[] { typeof(MusicArtist) },
|
||||
SimilarItemsHelper.GetSimiliarityScore).ConfigureAwait(false);
|
||||
SimilarItemsHelper.GetSimiliarityScore);
|
||||
|
||||
return ToOptimizedSerializedResultUsingCache(result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public async Task<object> Get(GetSimilarAlbums request)
|
||||
public object Get(GetSimilarAlbums request)
|
||||
{
|
||||
var dtoOptions = GetDtoOptions(_authContext, request);
|
||||
|
||||
var result = await SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
|
||||
var result = SimilarItemsHelper.GetSimilarItemsResult(dtoOptions, _userManager,
|
||||
_itemRepo,
|
||||
_libraryManager,
|
||||
_userDataRepository,
|
||||
_dtoService,
|
||||
Logger,
|
||||
request, new[] { typeof(MusicAlbum) },
|
||||
GetAlbumSimilarityScore).ConfigureAwait(false);
|
||||
GetAlbumSimilarityScore);
|
||||
|
||||
return ToOptimizedSerializedResultUsingCache(result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the album similarity score.
|
||||
/// </summary>
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace MediaBrowser.Api.Music
|
|||
_authContext = authContext;
|
||||
}
|
||||
|
||||
public Task<object> Get(GetInstantMixFromItem request)
|
||||
public object Get(GetInstantMixFromItem request)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(request.Id);
|
||||
|
||||
|
@ -94,7 +94,7 @@ namespace MediaBrowser.Api.Music
|
|||
return GetResult(items, user, request, dtoOptions);
|
||||
}
|
||||
|
||||
public Task<object> Get(GetInstantMixFromArtistId request)
|
||||
public object Get(GetInstantMixFromArtistId request)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(request.Id);
|
||||
|
||||
|
@ -107,7 +107,7 @@ namespace MediaBrowser.Api.Music
|
|||
return GetResult(items, user, request, dtoOptions);
|
||||
}
|
||||
|
||||
public Task<object> Get(GetInstantMixFromMusicGenreId request)
|
||||
public object Get(GetInstantMixFromMusicGenreId request)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(request.Id);
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace MediaBrowser.Api.Music
|
|||
return GetResult(items, user, request, dtoOptions);
|
||||
}
|
||||
|
||||
public Task<object> Get(GetInstantMixFromSong request)
|
||||
public object Get(GetInstantMixFromSong request)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(request.Id);
|
||||
|
||||
|
@ -133,7 +133,7 @@ namespace MediaBrowser.Api.Music
|
|||
return GetResult(items, user, request, dtoOptions);
|
||||
}
|
||||
|
||||
public Task<object> Get(GetInstantMixFromAlbum request)
|
||||
public object Get(GetInstantMixFromAlbum request)
|
||||
{
|
||||
var album = _libraryManager.GetItemById(request.Id);
|
||||
|
||||
|
@ -146,7 +146,7 @@ namespace MediaBrowser.Api.Music
|
|||
return GetResult(items, user, request, dtoOptions);
|
||||
}
|
||||
|
||||
public Task<object> Get(GetInstantMixFromPlaylist request)
|
||||
public object Get(GetInstantMixFromPlaylist request)
|
||||
{
|
||||
var playlist = (Playlist)_libraryManager.GetItemById(request.Id);
|
||||
|
||||
|
@ -159,7 +159,7 @@ namespace MediaBrowser.Api.Music
|
|||
return GetResult(items, user, request, dtoOptions);
|
||||
}
|
||||
|
||||
public Task<object> Get(GetInstantMixFromMusicGenre request)
|
||||
public object Get(GetInstantMixFromMusicGenre request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
|
||||
|
@ -170,7 +170,7 @@ namespace MediaBrowser.Api.Music
|
|||
return GetResult(items, user, request, dtoOptions);
|
||||
}
|
||||
|
||||
public Task<object> Get(GetInstantMixFromArtist request)
|
||||
public object Get(GetInstantMixFromArtist request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
var artist = _libraryManager.GetArtist(request.Name, new DtoOptions(false));
|
||||
|
@ -182,7 +182,7 @@ namespace MediaBrowser.Api.Music
|
|||
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;
|
||||
|
||||
|
@ -196,8 +196,7 @@ namespace MediaBrowser.Api.Music
|
|||
list = list.Take(request.Limit.Value).ToList();
|
||||
}
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(list, dtoOptions, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnList = _dtoService.GetBaseItemDtos(list, dtoOptions, user);
|
||||
|
||||
result.Items = returnList;
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace MediaBrowser.Api
|
|||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetPlaylistItems request)
|
||||
public object Get(GetPlaylistItems request)
|
||||
{
|
||||
var playlist = (Playlist)_libraryManager.GetItemById(request.Id);
|
||||
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||
|
@ -193,8 +193,7 @@ namespace MediaBrowser.Api
|
|||
|
||||
var dtoOptions = GetDtoOptions(_authContext, request);
|
||||
|
||||
var dtos = (await _dtoService.GetBaseItemDtos(items.Select(i => i.Item2).ToList(), dtoOptions, user)
|
||||
.ConfigureAwait(false));
|
||||
var dtos = _dtoService.GetBaseItemDtos(items.Select(i => i.Item2).ToList(), dtoOptions, user);
|
||||
|
||||
var index = 0;
|
||||
foreach (var item in dtos)
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace MediaBrowser.Api
|
|||
/// </summary>
|
||||
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;
|
||||
|
||||
|
@ -104,7 +104,7 @@ namespace MediaBrowser.Api
|
|||
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>
|
||||
{
|
||||
|
|
|
@ -47,21 +47,21 @@ namespace MediaBrowser.Api
|
|||
_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);
|
||||
}
|
||||
|
||||
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 dtoOptions = GetDtoOptions(_authContext, request);
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -293,14 +293,14 @@ namespace MediaBrowser.Api
|
|||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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>
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ namespace MediaBrowser.Api
|
|||
return result;
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetUpcomingEpisodes request)
|
||||
public object Get(GetUpcomingEpisodes request)
|
||||
{
|
||||
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>
|
||||
{
|
||||
|
@ -374,7 +374,7 @@ namespace MediaBrowser.Api
|
|||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public async Task<object> Get(GetNextUpEpisodes request)
|
||||
public object Get(GetNextUpEpisodes request)
|
||||
{
|
||||
var options = GetDtoOptions(_authContext, request);
|
||||
|
||||
|
@ -390,7 +390,7 @@ namespace MediaBrowser.Api
|
|||
|
||||
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>
|
||||
{
|
||||
|
@ -423,7 +423,7 @@ namespace MediaBrowser.Api
|
|||
return items;
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetSeasons request)
|
||||
public object Get(GetSeasons request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
|
||||
|
@ -444,7 +444,7 @@ namespace MediaBrowser.Api
|
|||
|
||||
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>
|
||||
{
|
||||
|
@ -463,7 +463,7 @@ namespace MediaBrowser.Api
|
|||
return null;
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetEpisodes request)
|
||||
public object Get(GetEpisodes request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
|
||||
|
@ -544,7 +544,7 @@ namespace MediaBrowser.Api
|
|||
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>
|
||||
{
|
||||
|
|
|
@ -84,14 +84,14 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public async Task<object> Get(GetItems request)
|
||||
public object Get(GetItems request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
|
||||
var result = await GetItems(request).ConfigureAwait(false);
|
||||
var result = GetItems(request);
|
||||
|
||||
return ToOptimizedSerializedResultUsingCache(result);
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// Gets the items.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>Task{ItemsResult}.</returns>
|
||||
private async Task<QueryResult<BaseItemDto>> GetItems(GetItems request)
|
||||
private QueryResult<BaseItemDto> GetItems(GetItems request)
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
var dtoList = await _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user).ConfigureAwait(false);
|
||||
var dtoList = _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user);
|
||||
|
||||
if (dtoList == null)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Sync;
|
||||
|
||||
namespace MediaBrowser.Controller.Dto
|
||||
|
@ -40,7 +39,6 @@ namespace MediaBrowser.Controller.Dto
|
|||
/// <param name="fields">The fields.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="owner">The owner.</param>
|
||||
/// <returns>Task{BaseItemDto}.</returns>
|
||||
BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null);
|
||||
|
||||
/// <summary>
|
||||
|
@ -60,10 +58,9 @@ namespace MediaBrowser.Controller.Dto
|
|||
/// <param name="options">The options.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="owner">The owner.</param>
|
||||
/// <returns>IEnumerable<BaseItemDto>.</returns>
|
||||
Task<BaseItemDto[]> GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null);
|
||||
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>
|
||||
/// Gets the chapter information dto.
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>QueryResult{RecordingInfoDto}.</returns>
|
||||
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>
|
||||
/// Gets the timers.
|
||||
|
@ -360,7 +360,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <param name="items">The items.</param>
|
||||
/// <param name="options">The options.</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>
|
||||
/// Called when [recording file deleted].
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.2.28.8")]
|
||||
[assembly: AssemblyVersion("3.2.29.1")]
|
||||
|
|
Loading…
Reference in New Issue
Block a user