From 6a6145294ad19a0d88ad3928b48c7877bbf1b473 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 24 Jul 2015 17:44:25 -0400 Subject: [PATCH] stub out xml tv class --- .../LiveTv/Listings/SchedulesDirect.cs | 19 +++++++- .../LiveTv/Listings/XmlTv.cs | 44 +++++++++++++++++++ .../TunerHosts/HdHomerun/HdHomerunHost.cs | 6 +-- .../Localization/JavaScript/javascript.json | 3 +- .../Localization/Server/server.json | 2 +- ...MediaBrowser.Server.Implementations.csproj | 1 + 6 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 72a965c6ab..65d24ee806 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -536,6 +536,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings throw new ArgumentException("Authentication required."); } + if (string.IsNullOrWhiteSpace(info.ListingsId)) + { + throw new ArgumentException("Listings Id required"); + } + _logger.Info("Adding new LineUp "); var httpOptions = new HttpRequestOptions() @@ -564,6 +569,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings private async Task HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken) { + if (string.IsNullOrWhiteSpace(info.ListingsId)) + { + throw new ArgumentException("Listings Id required"); + } + var token = await GetToken(info, cancellationToken); _logger.Info("Headends on account "); @@ -577,9 +587,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings options.RequestHeaders["token"] = token; - using (Stream responce = await _httpClient.Get(options).ConfigureAwait(false)) + using (var response = await _httpClient.Get(options).ConfigureAwait(false)) { - var root = _jsonSerializer.DeserializeFromStream(responce); + var root = _jsonSerializer.DeserializeFromStream(response); return root.lineups.Any(i => string.Equals(info.ListingsId, i.lineup, StringComparison.OrdinalIgnoreCase)); } @@ -587,6 +597,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings public async Task Validate(ListingsProviderInfo info) { + if (string.IsNullOrWhiteSpace(info.ListingsId)) + { + throw new ArgumentException("Listings Id required"); + } + var hasLineup = await HasLineup(info, CancellationToken.None).ConfigureAwait(false); if (!hasLineup) diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs new file mode 100644 index 0000000000..2e6fc8277d --- /dev/null +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs @@ -0,0 +1,44 @@ +using MediaBrowser.Controller.LiveTv; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.LiveTv; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Server.Implementations.LiveTv.Listings +{ + public class XmlTv : IListingsProvider + { + public string Name + { + get { return "XmlTV"; } + } + + public string Type + { + get { return "xmltv"; } + } + + public Task> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public async Task AddMetadata(ListingsProviderInfo info, List channels, CancellationToken cancellationToken) + { + // Might not be needed + } + + public Task Validate(ListingsProviderInfo info) + { + // Check that the path or url is valid. If not, throw a file not found exception + } + + public Task> GetLineups(ListingsProviderInfo info, string country, string location) + { + // In theory this should never be called because there is always only one lineup + throw new NotImplementedException(); + } + } +} diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index eb8f8f80ee..1e30a4fd8d 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -272,7 +272,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun var url = GetApiUrl(info, true) + "/auto/v" + channelId; - if (!string.IsNullOrWhiteSpace(profile)) + if (!string.IsNullOrWhiteSpace(profile) && !string.Equals(profile, "native", StringComparison.OrdinalIgnoreCase)) { url += "?transcode=" + profile; } @@ -316,7 +316,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun { var list = new List(); - list.Add(GetMediaSource(info, channelId, null)); + list.Add(GetMediaSource(info, channelId, "native")); try { @@ -343,7 +343,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun public async Task GetChannelStream(TunerHostInfo info, string channelId, string streamId, CancellationToken cancellationToken) { - return GetMediaSource(info, channelId, null); + return GetMediaSource(info, channelId, streamId); } public async Task Validate(TunerHostInfo info) diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index 674ee855f9..55236c2c6e 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -824,5 +824,6 @@ "ErrorAddingTunerDevice": "There was an error adding the tuner device. Please ensure it is accessible and try again.", "ErrorSavingTvProvider": "There was an error saving the TV provider. Please ensure it is accessible and try again.", "ErrorGettingTvLineups": "There was an error downloading tv lineups. Please ensure your username and password are correct and try again.", - "MessageCreateAccountAt": "Create an account at {0}" + "MessageCreateAccountAt": "Create an account at {0}", + "ErrorPleaseSelectLineup": "Please select a lineup and try again. If no lineups are available, then please check that your username, password, and postal code is correct." } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 194d406f3c..2c2fd76a73 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -1488,6 +1488,6 @@ "LabelZipCode": "Zip Code:", "GuideProviderListingsStep": "Step 2: Select Listings", "GuideProviderLoginStep": "Step 1: Login", - "LabelLineup": "Lineup", + "LabelLineup": "Lineup:", "MessageTunerDeviceNotListed": "Is your tuner device not listed? Try installing an external service provider for more Live TV options." } diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index c77c112a63..0d8b748737 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -222,6 +222,7 @@ +