浏览代码

stub out xml tv class

Luke Pulverenti 10 年之前
父节点
当前提交
6a6145294a

+ 17 - 2
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)

+ 44 - 0
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();
+        }
+    }
+}

+ 3 - 3
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)

+ 2 - 1
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."
 }

+ 1 - 1
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."
 }

+ 1 - 0
MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj

@@ -222,6 +222,7 @@
     <Compile Include="LiveTv\EmbyTV\SeriesTimerManager.cs" />
     <Compile Include="LiveTv\EmbyTV\TimerManager.cs" />
     <Compile Include="LiveTv\Listings\SchedulesDirect.cs" />
+    <Compile Include="LiveTv\Listings\XmlTv.cs" />
     <Compile Include="LiveTv\LiveTvConfigurationFactory.cs" />
     <Compile Include="LiveTv\LiveTvDtoService.cs" />
     <Compile Include="LiveTv\LiveTvManager.cs" />