diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 0e40db58cd..409b04b413 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -14,17 +14,12 @@ namespace MediaBrowser.Api.LiveTv [Api(Description = "Gets available live tv services.")] public class GetServices : IReturn> { - [ApiMember(Name = "ServiceName", Description = "Optional filter by service.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string ServiceName { get; set; } } [Route("/LiveTv/Channels", "GET")] [Api(Description = "Gets available live tv channels.")] public class GetChannels : IReturn> { - [ApiMember(Name = "ServiceName", Description = "Optional filter by service.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string ServiceName { get; set; } - [ApiMember(Name = "Type", Description = "Optional filter by channel type.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public ChannelType? Type { get; set; } @@ -51,9 +46,6 @@ namespace MediaBrowser.Api.LiveTv [Api(Description = "Gets live tv recordings")] public class GetRecordings : IReturn> { - [ApiMember(Name = "ServiceName", Description = "Optional filter by service.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string ServiceName { get; set; } - [ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string ChannelId { get; set; } } @@ -78,9 +70,6 @@ namespace MediaBrowser.Api.LiveTv [Api(Description = "Gets live tv timers")] public class GetTimers : IReturn> { - [ApiMember(Name = "ServiceName", Description = "Optional filter by service.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string ServiceName { get; set; } - [ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string ChannelId { get; set; } } @@ -89,9 +78,6 @@ namespace MediaBrowser.Api.LiveTv [Api(Description = "Gets available live tv epgs..")] public class GetPrograms : IReturn> { - [ApiMember(Name = "ServiceName", Description = "Live tv service name", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string ServiceName { get; set; } - [ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string ChannelIds { get; set; } @@ -124,21 +110,9 @@ namespace MediaBrowser.Api.LiveTv _liveTvManager = liveTvManager; } - private IEnumerable GetServices(string serviceName) - { - IEnumerable services = _liveTvManager.Services; - - if (!string.IsNullOrEmpty(serviceName)) - { - services = services.Where(i => string.Equals(i.Name, serviceName, StringComparison.OrdinalIgnoreCase)); - } - - return services; - } - public object Get(GetServices request) { - var services = GetServices(request.ServiceName) + var services = _liveTvManager.Services .Select(GetServiceInfo) .ToList(); @@ -158,7 +132,6 @@ namespace MediaBrowser.Api.LiveTv var result = _liveTvManager.GetChannels(new ChannelQuery { ChannelType = request.Type, - ServiceName = request.ServiceName, UserId = request.UserId }); @@ -177,7 +150,6 @@ namespace MediaBrowser.Api.LiveTv { var result = _liveTvManager.GetPrograms(new ProgramQuery { - ServiceName = request.ServiceName, ChannelIdList = (request.ChannelIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToArray(), UserId = request.UserId @@ -190,8 +162,7 @@ namespace MediaBrowser.Api.LiveTv { var result = _liveTvManager.GetRecordings(new RecordingQuery { - ChannelId = request.ChannelId, - ServiceName = request.ServiceName + ChannelId = request.ChannelId }, CancellationToken.None).Result; @@ -216,8 +187,7 @@ namespace MediaBrowser.Api.LiveTv { var result = _liveTvManager.GetTimers(new TimerQuery { - ChannelId = request.ChannelId, - ServiceName = request.ServiceName + ChannelId = request.ChannelId }, CancellationToken.None).Result; diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 4e73fc109f..b8dfbe05dd 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -11,6 +11,12 @@ namespace MediaBrowser.Controller.LiveTv /// public interface ILiveTvManager { + /// + /// Gets the active service. + /// + /// The active service. + ILiveTvService ActiveService { get; } + /// /// Gets the services. /// @@ -37,7 +43,7 @@ namespace MediaBrowser.Controller.LiveTv /// The identifier. /// Task. Task CancelTimer(string id); - + /// /// Adds the parts. /// @@ -82,7 +88,7 @@ namespace MediaBrowser.Controller.LiveTv /// The cancellation token. /// Task{QueryResult{TimerInfoDto}}. Task> GetTimers(TimerQuery query, CancellationToken cancellationToken); - + /// /// Gets the channel. /// diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index cf5cdb94c9..8059c1100b 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -27,11 +27,12 @@ namespace MediaBrowser.Controller.LiveTv /// /// The official rating. public string OfficialRating { get; set; } - + /// - /// Description of the progam. + /// Gets or sets the overview. /// - public string Description { get; set; } + /// The overview. + public string Overview { get; set; } /// /// The start date of the program, in UTC. @@ -54,23 +55,23 @@ namespace MediaBrowser.Controller.LiveTv /// public List Genres { get; set; } - /// - /// Gets or sets the quality. - /// - /// The quality. - public ProgramVideoQuality Quality { get; set; } - /// /// Gets or sets the original air date. /// /// The original air date. public DateTime? OriginalAirDate { get; set; } + /// + /// Gets or sets a value indicating whether this instance is hd. + /// + /// true if this instance is hd; otherwise, false. + public bool? IsHD { get; set; } + /// /// Gets or sets the audio. /// /// The audio. - public ProgramAudio Audio { get; set; } + public ProgramAudio? Audio { get; set; } /// /// Gets or sets the community rating. diff --git a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs index 2c8e8cb464..1ffbb7e237 100644 --- a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs @@ -37,11 +37,12 @@ namespace MediaBrowser.Controller.LiveTv /// /// The path. public string Path { get; set; } - + /// - /// Description of the recording. + /// Gets or sets the overview. /// - public string Description { get; set; } + /// The overview. + public string Overview { get; set; } /// /// The start date of the recording, in UTC. @@ -82,6 +83,18 @@ namespace MediaBrowser.Controller.LiveTv /// The episode title. public string EpisodeTitle { get; set; } + /// + /// Gets or sets a value indicating whether this instance is hd. + /// + /// true if this instance is hd; otherwise, false. + public bool? IsHD { get; set; } + + /// + /// Gets or sets the audio. + /// + /// The audio. + public ProgramAudio? Audio { get; set; } + /// /// Gets or sets the official rating. /// diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index 3df0b8ccab..26e5869cea 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -59,15 +59,27 @@ namespace MediaBrowser.Controller.LiveTv public RecordingStatus Status { get; set; } /// - /// Gets or sets the pre padding seconds. + /// Gets or sets the requested pre padding seconds. /// - /// The pre padding seconds. - public int PrePaddingSeconds { get; set; } + /// The requested pre padding seconds. + public int RequestedPrePaddingSeconds { get; set; } /// - /// Gets or sets the post padding seconds. + /// Gets or sets the requested post padding seconds. /// - /// The post padding seconds. - public int PostPaddingSeconds { get; set; } + /// The requested post padding seconds. + public int RequestedPostPaddingSeconds { get; set; } + + /// + /// Gets or sets the required pre padding seconds. + /// + /// The required pre padding seconds. + public int RequiredPrePaddingSeconds { get; set; } + + /// + /// Gets or sets the required post padding seconds. + /// + /// The required post padding seconds. + public int RequiredPostPaddingSeconds { get; set; } } } diff --git a/MediaBrowser.Model/LiveTv/ChannelQuery.cs b/MediaBrowser.Model/LiveTv/ChannelQuery.cs index 9fe74502fd..578f3039bb 100644 --- a/MediaBrowser.Model/LiveTv/ChannelQuery.cs +++ b/MediaBrowser.Model/LiveTv/ChannelQuery.cs @@ -6,12 +6,6 @@ namespace MediaBrowser.Model.LiveTv /// public class ChannelQuery { - /// - /// Gets or sets the name of the service. - /// - /// The name of the service. - public string ServiceName { get; set; } - /// /// Gets or sets the type of the channel. /// diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs index 6884d355d1..5f35de086d 100644 --- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs @@ -52,9 +52,9 @@ namespace MediaBrowser.Model.LiveTv public string Name { get; set; } /// - /// Description of the progam. + /// Overview of the recording. /// - public string Description { get; set; } + public string Overview { get; set; } /// /// The start date of the program, in UTC. @@ -72,16 +72,16 @@ namespace MediaBrowser.Model.LiveTv public List Genres { get; set; } /// - /// Gets or sets the quality. + /// Gets or sets a value indicating whether this instance is hd. /// - /// The quality. - public ProgramVideoQuality Quality { get; set; } + /// true if this instance is hd; otherwise, false. + public bool? IsHD { get; set; } /// /// Gets or sets the audio. /// /// The audio. - public ProgramAudio Audio { get; set; } + public ProgramAudio? Audio { get; set; } /// /// Gets or sets the original air date. @@ -107,12 +107,6 @@ namespace MediaBrowser.Model.LiveTv } } - public enum ProgramVideoQuality - { - StandardDefinition, - HighDefinition - } - public enum ProgramAudio { Stereo diff --git a/MediaBrowser.Model/LiveTv/ProgramQuery.cs b/MediaBrowser.Model/LiveTv/ProgramQuery.cs index ce0639aa0e..c2a913bc85 100644 --- a/MediaBrowser.Model/LiveTv/ProgramQuery.cs +++ b/MediaBrowser.Model/LiveTv/ProgramQuery.cs @@ -5,12 +5,6 @@ /// public class ProgramQuery { - /// - /// Gets or sets the name of the service. - /// - /// The name of the service. - public string ServiceName { get; set; } - /// /// Gets or sets the channel identifier. /// diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs index 86e82b562d..a095e1751b 100644 --- a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs @@ -44,9 +44,9 @@ namespace MediaBrowser.Model.LiveTv public string Path { get; set; } /// - /// Description of the recording. + /// Overview of the recording. /// - public string Description { get; set; } + public string Overview { get; set; } /// /// The start date of the recording, in UTC. @@ -111,6 +111,18 @@ namespace MediaBrowser.Model.LiveTv /// The community rating. public float? CommunityRating { get; set; } + /// + /// Gets or sets a value indicating whether this instance is hd. + /// + /// true if this instance is hd; otherwise, false. + public bool? IsHD { get; set; } + + /// + /// Gets or sets the audio. + /// + /// The audio. + public ProgramAudio? Audio { get; set; } + public RecordingInfoDto() { Genres = new List(); diff --git a/MediaBrowser.Model/LiveTv/RecordingQuery.cs b/MediaBrowser.Model/LiveTv/RecordingQuery.cs index 0820c7785e..cd5ebe6282 100644 --- a/MediaBrowser.Model/LiveTv/RecordingQuery.cs +++ b/MediaBrowser.Model/LiveTv/RecordingQuery.cs @@ -10,12 +10,6 @@ /// /// The channel identifier. public string ChannelId { get; set; } - - /// - /// Gets or sets the name of the service. - /// - /// The name of the service. - public string ServiceName { get; set; } } public class TimerQuery @@ -25,11 +19,5 @@ /// /// The channel identifier. public string ChannelId { get; set; } - - /// - /// Gets or sets the name of the service. - /// - /// The name of the service. - public string ServiceName { get; set; } } } diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index 9ebc2314d4..e8085fc92f 100644 --- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs @@ -64,16 +64,28 @@ namespace MediaBrowser.Model.LiveTv public string SeriesTimerId { get; set; } /// - /// Gets or sets the pre padding seconds. + /// Gets or sets the requested pre padding seconds. /// - /// The pre padding seconds. - public int PrePaddingSeconds { get; set; } + /// The requested pre padding seconds. + public int RequestedPrePaddingSeconds { get; set; } /// - /// Gets or sets the post padding seconds. + /// Gets or sets the requested post padding seconds. /// - /// The post padding seconds. - public int PostPaddingSeconds { get; set; } + /// The requested post padding seconds. + public int RequestedPostPaddingSeconds { get; set; } + + /// + /// Gets or sets the required pre padding seconds. + /// + /// The required pre padding seconds. + public int RequiredPrePaddingSeconds { get; set; } + + /// + /// Gets or sets the required post padding seconds. + /// + /// The required post padding seconds. + public int RequiredPostPaddingSeconds { get; set; } /// /// Gets or sets the duration ms. diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 4fd1f0e43b..1ed9733537 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -64,6 +64,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv get { return _services; } } + public ILiveTvService ActiveService { get; private set; } + /// /// Adds the parts. /// @@ -71,6 +73,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv public void AddParts(IEnumerable services) { _services.AddRange(services); + + ActiveService = _services.FirstOrDefault(); } /// @@ -196,7 +200,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv return new ProgramInfoDto { ChannelId = channel.Id.ToString("N"), - Description = program.Description, + Overview = program.Overview, EndDate = program.EndDate, Genres = program.Genres, ExternalId = program.Id, @@ -205,7 +209,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv ServiceName = channel.ServiceName, StartDate = program.StartDate, OfficialRating = program.OfficialRating, - Quality = program.Quality, + IsHD = program.IsHD, OriginalAirDate = program.OriginalAirDate, Audio = program.Audio, CommunityRating = program.CommunityRating, @@ -285,11 +289,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv .OrderBy(i => i.StartDate) .ThenBy(i => i.EndDate); - if (!string.IsNullOrEmpty(query.ServiceName)) - { - programs = programs.Where(i => string.Equals(i.ServiceName, query.ServiceName, StringComparison.OrdinalIgnoreCase)); - } - if (query.ChannelIdList.Length > 0) { var guids = query.ChannelIdList.Select(i => new Guid(i)).ToList(); @@ -380,7 +379,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv var dto = new RecordingInfoDto { ChannelName = info.ChannelName, - Description = info.Description, + Overview = info.Overview, EndDate = info.EndDate, Name = info.Name, StartDate = info.StartDate, @@ -395,7 +394,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv ChannelType = info.ChannelType, MediaType = info.ChannelType == ChannelType.Radio ? MediaType.Audio : MediaType.Video, CommunityRating = info.CommunityRating, - OfficialRating = info.OfficialRating + OfficialRating = info.OfficialRating, + Audio = info.Audio, + IsHD = info.IsHD }; var duration = info.EndDate - info.StartDate; @@ -413,9 +414,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var list = new List(); - foreach (var service in GetServices(query.ServiceName, query.ChannelId)) + if (ActiveService != null) { - var recordings = await GetRecordings(service, cancellationToken).ConfigureAwait(false); + var recordings = await GetRecordings(ActiveService, cancellationToken).ConfigureAwait(false); list.AddRange(recordings); } @@ -466,9 +467,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var list = new List(); - foreach (var service in GetServices(query.ServiceName, query.ChannelId)) + if (ActiveService != null) { - var timers = await GetTimers(service, cancellationToken).ConfigureAwait(false); + var timers = await GetTimers(ActiveService, cancellationToken).ConfigureAwait(false); list.AddRange(timers); } @@ -513,8 +514,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"), Status = info.Status, SeriesTimerId = info.SeriesTimerId, - PrePaddingSeconds = info.PrePaddingSeconds, - PostPaddingSeconds = info.PostPaddingSeconds + RequestedPostPaddingSeconds = info.RequestedPostPaddingSeconds, + RequestedPrePaddingSeconds = info.RequestedPrePaddingSeconds, + RequiredPostPaddingSeconds = info.RequiredPostPaddingSeconds, + RequiredPrePaddingSeconds = info.RequiredPrePaddingSeconds }; var duration = info.EndDate - info.StartDate; diff --git a/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs b/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs index 00bf9e55ba..fe565e0947 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs @@ -53,7 +53,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv public bool IsHidden { - get { return _liveTvManager.Services.Count == 0; } + get { return _liveTvManager.ActiveService == null; } } } }