diff options
| -rw-r--r-- | MediaBrowser.Api/LiveTv/LiveTvService.cs | 36 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 21 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/RecordingInfo.cs | 19 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/TimerInfo.cs | 24 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/ChannelQuery.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/ProgramInfoDto.cs | 18 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/ProgramQuery.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/RecordingInfoDto.cs | 16 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/RecordingQuery.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/TimerInfoDto.cs | 24 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | 33 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs | 2 |
13 files changed, 113 insertions, 114 deletions
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 0e40db58c..409b04b41 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<List<LiveTvServiceInfo>> { - [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<QueryResult<ChannelInfoDto>> { - [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<QueryResult<RecordingInfoDto>> { - [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<QueryResult<TimerInfoDto>> { - [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<QueryResult<ProgramInfoDto>> { - [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<ILiveTvService> GetServices(string serviceName) - { - IEnumerable<ILiveTvService> 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 4e73fc109..b8dfbe05d 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -12,6 +12,12 @@ namespace MediaBrowser.Controller.LiveTv public interface ILiveTvManager { /// <summary> + /// Gets the active service. + /// </summary> + /// <value>The active service.</value> + ILiveTvService ActiveService { get; } + + /// <summary> /// Gets the services. /// </summary> /// <value>The services.</value> @@ -37,7 +43,7 @@ namespace MediaBrowser.Controller.LiveTv /// <param name="id">The identifier.</param> /// <returns>Task.</returns> Task CancelTimer(string id); - + /// <summary> /// Adds the parts. /// </summary> @@ -82,7 +88,7 @@ namespace MediaBrowser.Controller.LiveTv /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{QueryResult{TimerInfoDto}}.</returns> Task<QueryResult<TimerInfoDto>> GetTimers(TimerQuery query, CancellationToken cancellationToken); - + /// <summary> /// Gets the channel. /// </summary> diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index cf5cdb94c..8059c1100 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -27,11 +27,12 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The official rating.</value> public string OfficialRating { get; set; } - + /// <summary> - /// Description of the progam. + /// Gets or sets the overview. /// </summary> - public string Description { get; set; } + /// <value>The overview.</value> + public string Overview { get; set; } /// <summary> /// The start date of the program, in UTC. @@ -55,22 +56,22 @@ namespace MediaBrowser.Controller.LiveTv public List<string> Genres { get; set; } /// <summary> - /// Gets or sets the quality. - /// </summary> - /// <value>The quality.</value> - public ProgramVideoQuality Quality { get; set; } - - /// <summary> /// Gets or sets the original air date. /// </summary> /// <value>The original air date.</value> public DateTime? OriginalAirDate { get; set; } /// <summary> + /// Gets or sets a value indicating whether this instance is hd. + /// </summary> + /// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value> + public bool? IsHD { get; set; } + + /// <summary> /// Gets or sets the audio. /// </summary> /// <value>The audio.</value> - public ProgramAudio Audio { get; set; } + public ProgramAudio? Audio { get; set; } /// <summary> /// Gets or sets the community rating. diff --git a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs index 2c8e8cb46..1ffbb7e23 100644 --- a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs @@ -37,11 +37,12 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The path.</value> public string Path { get; set; } - + /// <summary> - /// Description of the recording. + /// Gets or sets the overview. /// </summary> - public string Description { get; set; } + /// <value>The overview.</value> + public string Overview { get; set; } /// <summary> /// The start date of the recording, in UTC. @@ -83,6 +84,18 @@ namespace MediaBrowser.Controller.LiveTv public string EpisodeTitle { get; set; } /// <summary> + /// Gets or sets a value indicating whether this instance is hd. + /// </summary> + /// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value> + public bool? IsHD { get; set; } + + /// <summary> + /// Gets or sets the audio. + /// </summary> + /// <value>The audio.</value> + public ProgramAudio? Audio { get; set; } + + /// <summary> /// Gets or sets the official rating. /// </summary> /// <value>The official rating.</value> diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index 3df0b8cca..26e5869ce 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; } /// <summary> - /// Gets or sets the pre padding seconds. + /// Gets or sets the requested pre padding seconds. /// </summary> - /// <value>The pre padding seconds.</value> - public int PrePaddingSeconds { get; set; } + /// <value>The requested pre padding seconds.</value> + public int RequestedPrePaddingSeconds { get; set; } /// <summary> - /// Gets or sets the post padding seconds. + /// Gets or sets the requested post padding seconds. /// </summary> - /// <value>The post padding seconds.</value> - public int PostPaddingSeconds { get; set; } + /// <value>The requested post padding seconds.</value> + public int RequestedPostPaddingSeconds { get; set; } + + /// <summary> + /// Gets or sets the required pre padding seconds. + /// </summary> + /// <value>The required pre padding seconds.</value> + public int RequiredPrePaddingSeconds { get; set; } + + /// <summary> + /// Gets or sets the required post padding seconds. + /// </summary> + /// <value>The required post padding seconds.</value> + public int RequiredPostPaddingSeconds { get; set; } } } diff --git a/MediaBrowser.Model/LiveTv/ChannelQuery.cs b/MediaBrowser.Model/LiveTv/ChannelQuery.cs index 9fe74502f..578f3039b 100644 --- a/MediaBrowser.Model/LiveTv/ChannelQuery.cs +++ b/MediaBrowser.Model/LiveTv/ChannelQuery.cs @@ -7,12 +7,6 @@ namespace MediaBrowser.Model.LiveTv public class ChannelQuery { /// <summary> - /// Gets or sets the name of the service. - /// </summary> - /// <value>The name of the service.</value> - public string ServiceName { get; set; } - - /// <summary> /// Gets or sets the type of the channel. /// </summary> /// <value>The type of the channel.</value> diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs index 6884d355d..5f35de086 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; } /// <summary> - /// Description of the progam. + /// Overview of the recording. /// </summary> - public string Description { get; set; } + public string Overview { get; set; } /// <summary> /// The start date of the program, in UTC. @@ -72,16 +72,16 @@ namespace MediaBrowser.Model.LiveTv public List<string> Genres { get; set; } /// <summary> - /// Gets or sets the quality. + /// Gets or sets a value indicating whether this instance is hd. /// </summary> - /// <value>The quality.</value> - public ProgramVideoQuality Quality { get; set; } + /// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value> + public bool? IsHD { get; set; } /// <summary> /// Gets or sets the audio. /// </summary> /// <value>The audio.</value> - public ProgramAudio Audio { get; set; } + public ProgramAudio? Audio { get; set; } /// <summary> /// 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 ce0639aa0..c2a913bc8 100644 --- a/MediaBrowser.Model/LiveTv/ProgramQuery.cs +++ b/MediaBrowser.Model/LiveTv/ProgramQuery.cs @@ -6,12 +6,6 @@ public class ProgramQuery { /// <summary> - /// Gets or sets the name of the service. - /// </summary> - /// <value>The name of the service.</value> - public string ServiceName { get; set; } - - /// <summary> /// Gets or sets the channel identifier. /// </summary> /// <value>The channel identifier.</value> diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs index 86e82b562..a095e1751 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; } /// <summary> - /// Description of the recording. + /// Overview of the recording. /// </summary> - public string Description { get; set; } + public string Overview { get; set; } /// <summary> /// The start date of the recording, in UTC. @@ -111,6 +111,18 @@ namespace MediaBrowser.Model.LiveTv /// <value>The community rating.</value> public float? CommunityRating { get; set; } + /// <summary> + /// Gets or sets a value indicating whether this instance is hd. + /// </summary> + /// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value> + public bool? IsHD { get; set; } + + /// <summary> + /// Gets or sets the audio. + /// </summary> + /// <value>The audio.</value> + public ProgramAudio? Audio { get; set; } + public RecordingInfoDto() { Genres = new List<string>(); diff --git a/MediaBrowser.Model/LiveTv/RecordingQuery.cs b/MediaBrowser.Model/LiveTv/RecordingQuery.cs index 0820c7785..cd5ebe628 100644 --- a/MediaBrowser.Model/LiveTv/RecordingQuery.cs +++ b/MediaBrowser.Model/LiveTv/RecordingQuery.cs @@ -10,12 +10,6 @@ /// </summary> /// <value>The channel identifier.</value> public string ChannelId { get; set; } - - /// <summary> - /// Gets or sets the name of the service. - /// </summary> - /// <value>The name of the service.</value> - public string ServiceName { get; set; } } public class TimerQuery @@ -25,11 +19,5 @@ /// </summary> /// <value>The channel identifier.</value> public string ChannelId { get; set; } - - /// <summary> - /// Gets or sets the name of the service. - /// </summary> - /// <value>The name of the service.</value> - public string ServiceName { get; set; } } } diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index 9ebc2314d..e8085fc92 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; } /// <summary> - /// Gets or sets the pre padding seconds. + /// Gets or sets the requested pre padding seconds. /// </summary> - /// <value>The pre padding seconds.</value> - public int PrePaddingSeconds { get; set; } + /// <value>The requested pre padding seconds.</value> + public int RequestedPrePaddingSeconds { get; set; } /// <summary> - /// Gets or sets the post padding seconds. + /// Gets or sets the requested post padding seconds. /// </summary> - /// <value>The post padding seconds.</value> - public int PostPaddingSeconds { get; set; } + /// <value>The requested post padding seconds.</value> + public int RequestedPostPaddingSeconds { get; set; } + + /// <summary> + /// Gets or sets the required pre padding seconds. + /// </summary> + /// <value>The required pre padding seconds.</value> + public int RequiredPrePaddingSeconds { get; set; } + + /// <summary> + /// Gets or sets the required post padding seconds. + /// </summary> + /// <value>The required post padding seconds.</value> + public int RequiredPostPaddingSeconds { get; set; } /// <summary> /// Gets or sets the duration ms. diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 4fd1f0e43..1ed973353 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; } + /// <summary> /// Adds the parts. /// </summary> @@ -71,6 +73,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv public void AddParts(IEnumerable<ILiveTvService> services) { _services.AddRange(services); + + ActiveService = _services.FirstOrDefault(); } /// <summary> @@ -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<RecordingInfoDto>(); - 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<TimerInfoDto>(); - 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 00bf9e55b..fe565e094 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; } } } } |
