display current program in tv channel osd
This commit is contained in:
parent
42712d42aa
commit
8e8ce40de2
|
@ -372,5 +372,14 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <param name="feature">The feature.</param>
|
||||
/// <returns>Task<MBRegistrationRecord>.</returns>
|
||||
Task<MBRegistrationRecord> GetRegistrationInfo(string channelId, string programId, string feature);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the channel information.
|
||||
/// </summary>
|
||||
/// <param name="dto">The dto.</param>
|
||||
/// <param name="channel">The channel.</param>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
void AddChannelInfo(BaseItemDto dto, LiveTvChannel channel, DtoOptions options, User user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1195,6 +1195,10 @@ namespace MediaBrowser.Model.Dto
|
|||
/// </summary>
|
||||
/// <value>The timer identifier.</value>
|
||||
public string TimerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current program.
|
||||
/// </summary>
|
||||
/// <value>The current program.</value>
|
||||
public BaseItemDto CurrentProgram { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
|
||||
var byName = item as IItemByName;
|
||||
|
||||
if (byName != null && !(item is LiveTvChannel))
|
||||
if (byName != null)
|
||||
{
|
||||
if (options.Fields.Contains(ItemFields.ItemCounts))
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
|
||||
var byName = item as IItemByName;
|
||||
|
||||
if (byName != null && !(item is LiveTvChannel))
|
||||
if (byName != null)
|
||||
{
|
||||
if (options.Fields.Contains(ItemFields.ItemCounts))
|
||||
{
|
||||
|
@ -351,6 +351,12 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
|
||||
AttachBasicFields(dto, item, owner, options);
|
||||
|
||||
var tvChannel = item as LiveTvChannel;
|
||||
if (tvChannel != null)
|
||||
{
|
||||
_livetvManager().AddChannelInfo(dto, tvChannel, options, user);
|
||||
}
|
||||
|
||||
var collectionFolder = item as ICollectionFolder;
|
||||
if (collectionFolder != null)
|
||||
{
|
||||
|
@ -1520,12 +1526,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
SetPhotoProperties(dto, photo);
|
||||
}
|
||||
|
||||
var tvChannel = item as LiveTvChannel;
|
||||
if (tvChannel != null)
|
||||
{
|
||||
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(tvChannel, true).ToList();
|
||||
}
|
||||
|
||||
dto.ChannelId = item.ChannelId;
|
||||
|
||||
var channelItem = item as IChannelItem;
|
||||
|
|
|
@ -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) ?
|
||||
|
|
Loading…
Reference in New Issue
Block a user