display current program in tv channel osd

This commit is contained in:
Luke Pulverenti
2015-08-31 00:57:12 -04:00
parent 42712d42aa
commit 8e8ce40de2
4 changed files with 50 additions and 9 deletions

View File

@@ -1040,6 +1040,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{
cancellationToken.ThrowIfCancellationRequested();
_logger.Debug("Refreshing guide from {0}", service.Name);
try
{
var innerProgress = new ActionableProgress<double>();
@@ -1721,6 +1723,32 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return dto;
}
public void AddChannelInfo(BaseItemDto dto, LiveTvChannel channel, DtoOptions options, User user)
{
dto.MediaSources = channel.GetMediaSources(true).ToList();
var now = DateTime.UtcNow;
var programs = _libraryManager.GetItems(new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
ChannelIds = new[] { channel.Id.ToString("N") },
MaxStartDate = now,
MinEndDate = now,
Limit = 1
}).Items.Cast<LiveTvProgram>();
var currentProgram = programs
.OrderBy(i => i.StartDate)
.FirstOrDefault();
if (currentProgram != null)
{
dto.CurrentProgram = _dtoService.GetBaseItemDto(currentProgram, options, user);
}
}
private async Task<Tuple<SeriesTimerInfo, ILiveTvService>> GetNewTimerDefaultsInternal(CancellationToken cancellationToken, LiveTvProgram program = null)
{
var service = program != null && !string.IsNullOrWhiteSpace(program.ServiceName) ?