diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-07-24 17:44:25 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-07-24 17:44:25 -0400 |
| commit | 6a6145294ad19a0d88ad3928b48c7877bbf1b473 (patch) | |
| tree | 3a7e8b05927fc4286685becc427cda238c946b16 /MediaBrowser.Server.Implementations/LiveTv | |
| parent | 77afd4ba544abf2c92cd6d098e997dfc2d9b39c9 (diff) | |
stub out xml tv class
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv')
3 files changed, 64 insertions, 5 deletions
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<bool> 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<ScheduleDirect.Lineups>(responce); + var root = _jsonSerializer.DeserializeFromStream<ScheduleDirect.Lineups>(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<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public async Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> 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<List<NameIdPair>> 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<MediaSourceInfo>(); - 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<MediaSourceInfo> 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) |
