improve guide loading performance

This commit is contained in:
Luke Pulverenti 2015-08-02 13:02:23 -04:00
parent bd39a81ba2
commit edecae6ed5
12 changed files with 164 additions and 51 deletions

View File

@ -410,18 +410,20 @@ namespace Emby.Drawing
{ {
ImageSize size; ImageSize size;
try size = ImageHeader.GetDimensions(path, _logger, _fileSystem);
{ //try
size = ImageHeader.GetDimensions(path, _logger, _fileSystem); //{
} // size = ImageHeader.GetDimensions(path, _logger, _fileSystem);
catch //}
{ //catch
_logger.Info("Failed to read image header for {0}. Doing it the slow way.", path); //{
// return;
// //_logger.Info("Failed to read image header for {0}. Doing it the slow way.", path);
CheckDisposed(); // //CheckDisposed();
size = _imageEncoder.GetImageSize(path); // //size = _imageEncoder.GetImageSize(path);
} //}
StartSaveImageSizeTimer(); StartSaveImageSizeTimer();

View File

@ -29,7 +29,7 @@ namespace MediaBrowser.Api.LiveTv
[Route("/LiveTv/Channels", "GET", Summary = "Gets available live tv channels.")] [Route("/LiveTv/Channels", "GET", Summary = "Gets available live tv channels.")]
[Authenticated] [Authenticated]
public class GetChannels : IReturn<QueryResult<ChannelInfoDto>> public class GetChannels : IReturn<QueryResult<ChannelInfoDto>>, IHasDtoOptions
{ {
[ApiMember(Name = "Type", Description = "Optional filter by channel type.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "Type", Description = "Optional filter by channel type.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public ChannelType? Type { get; set; } public ChannelType? Type { get; set; }
@ -62,6 +62,22 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "EnableFavoriteSorting", Description = "Incorporate favorite and like status into channel sorting.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "EnableFavoriteSorting", Description = "Incorporate favorite and like status into channel sorting.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool EnableFavoriteSorting { get; set; } public bool EnableFavoriteSorting { get; set; }
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get; set; }
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get; set; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string Fields { get; set; }
} }
[Route("/LiveTv/Channels/{Id}", "GET", Summary = "Gets a live tv channel")] [Route("/LiveTv/Channels/{Id}", "GET", Summary = "Gets a live tv channel")]
@ -81,7 +97,7 @@ namespace MediaBrowser.Api.LiveTv
[Route("/LiveTv/Recordings", "GET", Summary = "Gets live tv recordings")] [Route("/LiveTv/Recordings", "GET", Summary = "Gets live tv recordings")]
[Authenticated] [Authenticated]
public class GetRecordings : IReturn<QueryResult<BaseItemDto>> public class GetRecordings : IReturn<QueryResult<BaseItemDto>>, IHasDtoOptions
{ {
[ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ChannelId { get; set; } public string ChannelId { get; set; }
@ -106,6 +122,22 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "SeriesTimerId", Description = "Optional filter by recordings belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "SeriesTimerId", Description = "Optional filter by recordings belonging to a series timer", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get; set; }
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get; set; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string Fields { get; set; }
} }
[Route("/LiveTv/Recordings/Groups", "GET", Summary = "Gets live tv recording groups")] [Route("/LiveTv/Recordings/Groups", "GET", Summary = "Gets live tv recording groups")]
@ -164,7 +196,7 @@ namespace MediaBrowser.Api.LiveTv
[Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")] [Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]
[Authenticated] [Authenticated]
public class GetPrograms : IReturn<QueryResult<BaseItemDto>> public class GetPrograms : IReturn<QueryResult<BaseItemDto>>, IHasDtoOptions
{ {
[ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")] [ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string ChannelIds { get; set; } public string ChannelIds { get; set; }
@ -207,11 +239,27 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "Genres", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")] [ApiMember(Name = "Genres", Description = "The genres to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string Genres { get; set; } public string Genres { get; set; }
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get; set; }
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get; set; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string Fields { get; set; }
} }
[Route("/LiveTv/Programs/Recommended", "GET", Summary = "Gets available live tv epgs..")] [Route("/LiveTv/Programs/Recommended", "GET", Summary = "Gets available live tv epgs..")]
[Authenticated] [Authenticated]
public class GetRecommendedPrograms : IReturn<QueryResult<BaseItemDto>> public class GetRecommendedPrograms : IReturn<QueryResult<BaseItemDto>>, IHasDtoOptions
{ {
[ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")] [ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string UserId { get; set; } public string UserId { get; set; }
@ -230,6 +278,22 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "IsMovie", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "IsMovie", Description = "Optional filter for movies.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsMovie { get; set; } public bool? IsMovie { get; set; }
[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]
public bool? EnableImages { get; set; }
[ApiMember(Name = "ImageTypeLimit", Description = "Optional, the max number of images to return, per image type", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? ImageTypeLimit { get; set; }
[ApiMember(Name = "EnableImageTypes", Description = "Optional. The image types to include in the output.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string EnableImageTypes { get; set; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string Fields { get; set; }
} }
[Route("/LiveTv/Programs/{Id}", "GET", Summary = "Gets a live tv program")] [Route("/LiveTv/Programs/{Id}", "GET", Summary = "Gets a live tv program")]
@ -490,7 +554,7 @@ namespace MediaBrowser.Api.LiveTv
IsDisliked = request.IsDisliked, IsDisliked = request.IsDisliked,
EnableFavoriteSorting = request.EnableFavoriteSorting EnableFavoriteSorting = request.EnableFavoriteSorting
}, CancellationToken.None).ConfigureAwait(false); }, GetDtoOptions(request), CancellationToken.None).ConfigureAwait(false);
return ToOptimizedSerializedResultUsingCache(result); return ToOptimizedSerializedResultUsingCache(result);
} }
@ -546,7 +610,7 @@ namespace MediaBrowser.Api.LiveTv
query.IsSports = request.IsSports; query.IsSports = request.IsSports;
query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var result = await _liveTvManager.GetPrograms(query, CancellationToken.None).ConfigureAwait(false); var result = await _liveTvManager.GetPrograms(query, GetDtoOptions(request), CancellationToken.None).ConfigureAwait(false);
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
@ -563,7 +627,7 @@ namespace MediaBrowser.Api.LiveTv
IsSports = request.IsSports IsSports = request.IsSports
}; };
var result = await _liveTvManager.GetRecommendedPrograms(query, CancellationToken.None).ConfigureAwait(false); var result = await _liveTvManager.GetRecommendedPrograms(query, GetDtoOptions(request), CancellationToken.None).ConfigureAwait(false);
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
@ -575,7 +639,7 @@ namespace MediaBrowser.Api.LiveTv
public async Task<object> Get(GetRecordings request) public async Task<object> Get(GetRecordings request)
{ {
var options = new DtoOptions(); var options = GetDtoOptions(request);
options.DeviceId = AuthorizationContext.GetAuthorizationInfo(Request).DeviceId; options.DeviceId = AuthorizationContext.GetAuthorizationInfo(Request).DeviceId;
var result = await _liveTvManager.GetRecordings(new RecordingQuery var result = await _liveTvManager.GetRecordings(new RecordingQuery

View File

@ -69,9 +69,10 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the channels. /// Gets the channels.
/// </summary> /// </summary>
/// <param name="query">The query.</param> /// <param name="query">The query.</param>
/// <param name="options">The options.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>IEnumerable{Channel}.</returns> /// <returns>IEnumerable{Channel}.</returns>
Task<QueryResult<ChannelInfoDto>> GetChannels(LiveTvChannelQuery query, CancellationToken cancellationToken); Task<QueryResult<ChannelInfoDto>> GetChannels(LiveTvChannelQuery query, DtoOptions options, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the recording. /// Gets the recording.
@ -173,14 +174,15 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <returns>Task{ProgramInfoDto}.</returns> /// <returns>Task{ProgramInfoDto}.</returns>
Task<BaseItemDto> GetProgram(string id, CancellationToken cancellationToken, User user = null); Task<BaseItemDto> GetProgram(string id, CancellationToken cancellationToken, User user = null);
/// <summary> /// <summary>
/// Gets the programs. /// Gets the programs.
/// </summary> /// </summary>
/// <param name="query">The query.</param> /// <param name="query">The query.</param>
/// <param name="options">The options.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>IEnumerable{ProgramInfo}.</returns> /// <returns>IEnumerable{ProgramInfo}.</returns>
Task<QueryResult<BaseItemDto>> GetPrograms(ProgramQuery query, CancellationToken cancellationToken); Task<QueryResult<BaseItemDto>> GetPrograms(ProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Updates the timer. /// Updates the timer.
@ -240,10 +242,10 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the recommended programs. /// Gets the recommended programs.
/// </summary> /// </summary>
/// <param name="query">The query.</param> /// <param name="query">The query.</param>
/// <param name="options">The options.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{QueryResult{ProgramInfoDto}}.</returns> /// <returns>Task{QueryResult{ProgramInfoDto}}.</returns>
Task<QueryResult<BaseItemDto>> GetRecommendedPrograms(RecommendedProgramQuery query, Task<QueryResult<BaseItemDto>> GetRecommendedPrograms(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the recommended programs internal. /// Gets the recommended programs internal.
@ -251,8 +253,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="query">The query.</param> /// <param name="query">The query.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;QueryResult&lt;LiveTvProgram&gt;&gt;.</returns> /// <returns>Task&lt;QueryResult&lt;LiveTvProgram&gt;&gt;.</returns>
Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, CancellationToken cancellationToken);
CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Gets the live tv information. /// Gets the live tv information.

View File

@ -971,17 +971,17 @@ namespace MediaBrowser.Dlna.Didl
int? width = null; int? width = null;
int? height = null; int? height = null;
try //try
{ //{
var size = _imageProcessor.GetImageSize(imageInfo); // var size = _imageProcessor.GetImageSize(imageInfo);
width = Convert.ToInt32(size.Width); // width = Convert.ToInt32(size.Width);
height = Convert.ToInt32(size.Height); // height = Convert.ToInt32(size.Height);
} //}
catch //catch
{ //{
} //}
return new ImageDownloadInfo return new ImageDownloadInfo
{ {

View File

@ -1,7 +1,19 @@
namespace MediaBrowser.Model.Channels using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.Channels
{ {
public class ChannelQuery public class ChannelQuery
{ {
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
public ItemFields[] Fields { get; set; }
public bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; }
/// <summary> /// <summary>
/// Gets or sets the user identifier. /// Gets or sets the user identifier.
/// </summary> /// </summary>

View File

@ -1,5 +1,6 @@
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using System; using System;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.LiveTv namespace MediaBrowser.Model.LiveTv
{ {
@ -15,6 +16,15 @@ namespace MediaBrowser.Model.LiveTv
Genres = new string[] { }; Genres = new string[] { };
} }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
public ItemFields[] Fields { get; set; }
public bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; }
/// <summary> /// <summary>
/// Gets or sets the channel ids. /// Gets or sets the channel ids.
/// </summary> /// </summary>

View File

@ -1,7 +1,19 @@
namespace MediaBrowser.Model.LiveTv using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.LiveTv
{ {
public class RecommendedProgramQuery public class RecommendedProgramQuery
{ {
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
public ItemFields[] Fields { get; set; }
public bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; }
/// <summary> /// <summary>
/// Gets or sets the user identifier. /// Gets or sets the user identifier.
/// </summary> /// </summary>

View File

@ -1,4 +1,7 @@
namespace MediaBrowser.Model.LiveTv using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.LiveTv
{ {
/// <summary> /// <summary>
/// Class RecordingQuery. /// Class RecordingQuery.
@ -58,5 +61,14 @@
/// </summary> /// </summary>
/// <value>The series timer identifier.</value> /// <value>The series timer identifier.</value>
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
/// <summary>
/// Fields to return within the items, in addition to basic information
/// </summary>
/// <value>The fields.</value>
public ItemFields[] Fields { get; set; }
public bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; }
} }
} }

View File

@ -1767,11 +1767,6 @@ namespace MediaBrowser.Server.Implementations.Dto
{ {
size = _imageProcessor.GetImageSize(imageInfo); size = _imageProcessor.GetImageSize(imageInfo);
} }
catch (FileNotFoundException)
{
_logger.Error("Image file does not exist: {0}", path);
return;
}
catch (Exception ex) catch (Exception ex)
{ {
_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path); _logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path);

View File

@ -77,6 +77,10 @@ namespace MediaBrowser.Server.Implementations.Library
{ {
return false; return false;
} }
if (string.Equals(stream.Codec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
}
return true; return true;
} }

View File

@ -198,10 +198,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
/// Gets the channel info dto. /// Gets the channel info dto.
/// </summary> /// </summary>
/// <param name="info">The info.</param> /// <param name="info">The info.</param>
/// <param name="options">The options.</param>
/// <param name="currentProgram">The current program.</param> /// <param name="currentProgram">The current program.</param>
/// <param name="user">The user.</param> /// <param name="user">The user.</param>
/// <returns>ChannelInfoDto.</returns> /// <returns>ChannelInfoDto.</returns>
public ChannelInfoDto GetChannelInfoDto(LiveTvChannel info, LiveTvProgram currentProgram, User user = null) public ChannelInfoDto GetChannelInfoDto(LiveTvChannel info, DtoOptions options, LiveTvProgram currentProgram, User user = null)
{ {
var dto = new ChannelInfoDto var dto = new ChannelInfoDto
{ {
@ -238,7 +239,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (currentProgram != null) if (currentProgram != null)
{ {
dto.CurrentProgram = _dtoService.GetBaseItemDto(currentProgram, new DtoOptions(), user); dto.CurrentProgram = _dtoService.GetBaseItemDto(currentProgram, options, user);
} }
return dto; return dto;

View File

@ -238,7 +238,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return result; return result;
} }
public async Task<QueryResult<ChannelInfoDto>> GetChannels(LiveTvChannelQuery query, CancellationToken cancellationToken) public async Task<QueryResult<ChannelInfoDto>> GetChannels(LiveTvChannelQuery 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);
@ -261,7 +261,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var channelIdString = channel.Id.ToString("N"); var channelIdString = channel.Id.ToString("N");
var currentProgram = programs.FirstOrDefault(i => string.Equals(i.ChannelId, channelIdString, StringComparison.OrdinalIgnoreCase)); var currentProgram = programs.FirstOrDefault(i => string.Equals(i.ChannelId, channelIdString, StringComparison.OrdinalIgnoreCase));
returnList.Add(_tvDtoService.GetChannelInfoDto(channel, currentProgram, user)); returnList.Add(_tvDtoService.GetChannelInfoDto(channel, options, currentProgram, user));
} }
var result = new QueryResult<ChannelInfoDto> var result = new QueryResult<ChannelInfoDto>
@ -762,7 +762,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return dto; return dto;
} }
public async Task<QueryResult<BaseItemDto>> GetPrograms(ProgramQuery query, CancellationToken cancellationToken) public async Task<QueryResult<BaseItemDto>> GetPrograms(ProgramQuery query, DtoOptions options, CancellationToken cancellationToken)
{ {
var internalQuery = new InternalItemsQuery var internalQuery = new InternalItemsQuery
{ {
@ -822,7 +822,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
.Select(i => .Select(i =>
{ {
RefreshIfNeeded(i); RefreshIfNeeded(i);
return _dtoService.GetBaseItemDto(i, new DtoOptions(), user); return _dtoService.GetBaseItemDto(i, options, user);
}) })
.ToArray(); .ToArray();
@ -907,14 +907,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return result; return result;
} }
public async Task<QueryResult<BaseItemDto>> GetRecommendedPrograms(RecommendedProgramQuery query, CancellationToken cancellationToken) public async Task<QueryResult<BaseItemDto>> GetRecommendedPrograms(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken)
{ {
var internalResult = await GetRecommendedProgramsInternal(query, cancellationToken).ConfigureAwait(false); var internalResult = await GetRecommendedProgramsInternal(query, cancellationToken).ConfigureAwait(false);
var user = _userManager.GetUserById(query.UserId); var user = _userManager.GetUserById(query.UserId);
var returnArray = internalResult.Items var returnArray = internalResult.Items
.Select(i => _dtoService.GetBaseItemDto(i, new DtoOptions(), user)) .Select(i => _dtoService.GetBaseItemDto(i, options, user))
.ToArray(); .ToArray();
await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false); await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false);
@ -1712,7 +1712,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
.OrderBy(i => i.StartDate) .OrderBy(i => i.StartDate)
.FirstOrDefault(); .FirstOrDefault();
var dto = _tvDtoService.GetChannelInfoDto(channel, currentProgram, user); var dto = _tvDtoService.GetChannelInfoDto(channel, new DtoOptions(), currentProgram, user);
return dto; return dto;
} }