commit
81e96ed4f6
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Controller.Channels;
|
||||
using System;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Dto;
|
||||
|
@ -343,11 +344,11 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <summary>
|
||||
/// Adds the information to program dto.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="dto">The dto.</param>
|
||||
/// <param name="programs">The programs.</param>
|
||||
/// <param name="fields">The fields.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
void AddInfoToProgramDto(BaseItem item, BaseItemDto dto, List<ItemFields> fields, User user = null);
|
||||
/// <returns>Task.</returns>
|
||||
Task AddInfoToProgramDto(List<Tuple<BaseItem,BaseItemDto>> programs, List<ItemFields> fields, User user = null);
|
||||
/// <summary>
|
||||
/// Saves the tuner host.
|
||||
/// </summary>
|
||||
|
|
|
@ -26,6 +26,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CommonIO;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Dto
|
||||
|
@ -92,11 +93,17 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
var syncDictionary = GetSyncedItemProgressDictionary(syncJobItems);
|
||||
|
||||
var list = new List<BaseItemDto>();
|
||||
var programTuples = new List<Tuple<BaseItem, BaseItemDto>> { };
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
var dto = GetBaseItemDtoInternal(item, options, syncDictionary, user, owner);
|
||||
|
||||
if (item is LiveTvProgram)
|
||||
{
|
||||
programTuples.Add(new Tuple<BaseItem, BaseItemDto>(item, dto));
|
||||
}
|
||||
|
||||
var byName = item as IItemByName;
|
||||
|
||||
if (byName != null)
|
||||
|
@ -118,6 +125,12 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
list.Add(dto);
|
||||
}
|
||||
|
||||
if (programTuples.Count > 0)
|
||||
{
|
||||
var task = _livetvManager().AddInfoToProgramDto(programTuples, options.Fields, user);
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -139,6 +152,13 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
|
||||
var dto = GetBaseItemDtoInternal(item, options, GetSyncedItemProgressDictionary(syncProgress), user, owner);
|
||||
|
||||
if (item is LiveTvProgram)
|
||||
{
|
||||
var list = new List<Tuple<BaseItem, BaseItemDto>> { new Tuple<BaseItem, BaseItemDto>(item, dto) };
|
||||
var task = _livetvManager().AddInfoToProgramDto(list, options.Fields, user);
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
var byName = item as IItemByName;
|
||||
|
||||
if (byName != null)
|
||||
|
@ -393,11 +413,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
_livetvManager().AddInfoToRecordingDto(item, dto, user);
|
||||
}
|
||||
|
||||
else if (item is LiveTvProgram)
|
||||
{
|
||||
_livetvManager().AddInfoToProgramDto(item, dto, fields, user);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
CancellationToken = cancellationToken,
|
||||
|
||||
// Seeing block length errors
|
||||
EnableHttpCompression = false
|
||||
EnableHttpCompression = false,
|
||||
|
||||
LogRequest = false
|
||||
};
|
||||
|
||||
options.SetPostData(data);
|
||||
|
@ -99,7 +101,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
CancellationToken = cancellationToken,
|
||||
|
||||
// Seeing block length errors
|
||||
EnableHttpCompression = false
|
||||
EnableHttpCompression = false,
|
||||
|
||||
LogRequest = false
|
||||
};
|
||||
|
||||
options.SetPostData(data);
|
||||
|
|
|
@ -1489,70 +1489,79 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
};
|
||||
}
|
||||
|
||||
public void AddInfoToProgramDto(BaseItem item, BaseItemDto dto, List<ItemFields> fields, User user = null)
|
||||
public async Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> tuples, List<ItemFields> fields, User user = null)
|
||||
{
|
||||
var program = (LiveTvProgram)item;
|
||||
var recordingTuples = new List<Tuple<BaseItemDto, string, string>>();
|
||||
|
||||
dto.StartDate = program.StartDate;
|
||||
dto.EpisodeTitle = program.EpisodeTitle;
|
||||
foreach (var tuple in tuples)
|
||||
{
|
||||
var program = (LiveTvProgram)tuple.Item1;
|
||||
var dto = tuple.Item2;
|
||||
|
||||
if (program.IsRepeat)
|
||||
{
|
||||
dto.IsRepeat = program.IsRepeat;
|
||||
}
|
||||
if (program.IsMovie)
|
||||
{
|
||||
dto.IsMovie = program.IsMovie;
|
||||
}
|
||||
if (program.IsSeries)
|
||||
{
|
||||
dto.IsSeries = program.IsSeries;
|
||||
}
|
||||
if (program.IsSports)
|
||||
{
|
||||
dto.IsSports = program.IsSports;
|
||||
}
|
||||
if (program.IsLive)
|
||||
{
|
||||
dto.IsLive = program.IsLive;
|
||||
}
|
||||
if (program.IsNews)
|
||||
{
|
||||
dto.IsNews = program.IsNews;
|
||||
}
|
||||
if (program.IsKids)
|
||||
{
|
||||
dto.IsKids = program.IsKids;
|
||||
}
|
||||
if (program.IsPremiere)
|
||||
{
|
||||
dto.IsPremiere = program.IsPremiere;
|
||||
}
|
||||
dto.StartDate = program.StartDate;
|
||||
dto.EpisodeTitle = program.EpisodeTitle;
|
||||
|
||||
if (fields.Contains(ItemFields.ChannelInfo))
|
||||
{
|
||||
var channel = GetInternalChannel(program.ChannelId);
|
||||
|
||||
if (channel != null)
|
||||
if (program.IsRepeat)
|
||||
{
|
||||
dto.ChannelName = channel.Name;
|
||||
dto.MediaType = channel.MediaType;
|
||||
dto.IsRepeat = program.IsRepeat;
|
||||
}
|
||||
if (program.IsMovie)
|
||||
{
|
||||
dto.IsMovie = program.IsMovie;
|
||||
}
|
||||
if (program.IsSeries)
|
||||
{
|
||||
dto.IsSeries = program.IsSeries;
|
||||
}
|
||||
if (program.IsSports)
|
||||
{
|
||||
dto.IsSports = program.IsSports;
|
||||
}
|
||||
if (program.IsLive)
|
||||
{
|
||||
dto.IsLive = program.IsLive;
|
||||
}
|
||||
if (program.IsNews)
|
||||
{
|
||||
dto.IsNews = program.IsNews;
|
||||
}
|
||||
if (program.IsKids)
|
||||
{
|
||||
dto.IsKids = program.IsKids;
|
||||
}
|
||||
if (program.IsPremiere)
|
||||
{
|
||||
dto.IsPremiere = program.IsPremiere;
|
||||
}
|
||||
|
||||
if (channel.HasImage(ImageType.Primary))
|
||||
if (fields.Contains(ItemFields.ChannelInfo))
|
||||
{
|
||||
var channel = GetInternalChannel(program.ChannelId);
|
||||
|
||||
if (channel != null)
|
||||
{
|
||||
dto.ChannelPrimaryImageTag = _tvDtoService.GetImageTag(channel);
|
||||
dto.ChannelName = channel.Name;
|
||||
dto.MediaType = channel.MediaType;
|
||||
|
||||
if (channel.HasImage(ImageType.Primary))
|
||||
{
|
||||
dto.ChannelPrimaryImageTag = _tvDtoService.GetImageTag(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var service = GetService(program);
|
||||
var serviceName = service == null ? null : service.Name;
|
||||
|
||||
if (fields.Contains(ItemFields.ServiceName))
|
||||
{
|
||||
dto.ServiceName = serviceName;
|
||||
}
|
||||
|
||||
recordingTuples.Add(new Tuple<BaseItemDto, string, string>(dto, serviceName, program.ExternalId));
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.ServiceName))
|
||||
{
|
||||
var service = GetService(program);
|
||||
if (service != null)
|
||||
{
|
||||
dto.ServiceName = service.Name;
|
||||
}
|
||||
}
|
||||
await AddRecordingInfo(recordingTuples, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, User user = null)
|
||||
|
|
Loading…
Reference in New Issue
Block a user