Explorar el Código

update tuners

Luke Pulverenti hace 10 años
padre
commit
b194512843

+ 4 - 4
MediaBrowser.Api/LiveTv/LiveTvService.cs

@@ -334,7 +334,7 @@ namespace MediaBrowser.Api.LiveTv
 
     [Route("/LiveTv/TunerHosts", "POST", Summary = "Adds a tuner host")]
     [Authenticated]
-    public class AddTunerHost : TunerHostInfo, IReturnVoid
+    public class AddTunerHost : TunerHostInfo, IReturn<TunerHostInfo>
     {
     }
 
@@ -419,10 +419,10 @@ namespace MediaBrowser.Api.LiveTv
             _config.SaveConfiguration("livetv", config);
         }
 
-        public void Post(AddTunerHost request)
+        public async Task<object> Post(AddTunerHost request)
         {
-            var task = _liveTvManager.SaveTunerHost(request);
-            Task.WaitAll(task);
+            var result = await _liveTvManager.SaveTunerHost(request).ConfigureAwait(false);
+            return ToOptimizedResult(result);
         }
 
         public void Delete(DeleteTunerHost request)

+ 1 - 1
MediaBrowser.Controller/LiveTv/ILiveTvManager.cs

@@ -344,7 +344,7 @@ namespace MediaBrowser.Controller.LiveTv
         /// </summary>
         /// <param name="info">The information.</param>
         /// <returns>Task.</returns>
-        Task SaveTunerHost(TunerHostInfo info);
+        Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info);
         /// <summary>
         /// Saves the listing provider.
         /// </summary>

+ 1 - 0
MediaBrowser.Model/LiveTv/LiveTvOptions.cs

@@ -24,6 +24,7 @@ namespace MediaBrowser.Model.LiveTv
         public string Id { get; set; }
         public string Url { get; set; }
         public string Type { get; set; }
+        public bool ImportFavoritesOnly { get; set; }
     }
 
     public class ListingsProviderInfo

+ 3 - 1
MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -2172,7 +2172,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
             return await _libraryManager.GetNamedView(user, name, "livetv", "zz_" + name, cancellationToken).ConfigureAwait(false);
         }
 
-        public async Task SaveTunerHost(TunerHostInfo info)
+        public async Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info)
         {
             info = (TunerHostInfo)_jsonSerializer.DeserializeFromString(_jsonSerializer.SerializeToString(info), typeof(TunerHostInfo));
             
@@ -2202,6 +2202,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
             _config.SaveConfiguration("livetv", config);
 
             _taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
+
+            return info;
         }
 
         public async Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info, bool validateLogin, bool validateListings)

+ 1 - 1
MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs

@@ -73,7 +73,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                 }
 
                 // Strip off the port
-                url = new Uri(url).GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped);
+                url = new Uri(url).GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped).TrimEnd('/');
 
                 await _liveTvManager.SaveTunerHost(new TunerHostInfo
                 {

+ 8 - 1
MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs

@@ -60,7 +60,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
 
                 if (root != null)
                 {
-                    return root.Select(i => new ChannelInfo
+                    var result = root.Select(i => new ChannelInfo
                     {
                         Name = i.GuideName,
                         Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture),
@@ -68,6 +68,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
                         IsFavorite = i.Favorite
 
                     });
+
+                    if (info.ImportFavoritesOnly)
+                    {
+                        result = result.Where(i => (i.IsFavorite ?? true)).ToList();
+                    }
+
+                    return result;
                 }
                 return new List<ChannelInfo>();
             }

+ 4 - 2
MediaBrowser.Server.Implementations/Localization/Server/server.json

@@ -1480,7 +1480,7 @@
     "ButtonAddDevice": "Add Device",
     "HeaderAddDevice": "Add Device",
     "HeaderExternalServices": "External Services",
-    "LabelIpAddressPath": "IP Address / Path:",
+    "LabelTunerIpAddress": "Tuner IP Address:",
     "TabExternalServices": "External Services",
     "TabTuners": "Tuners",
     "HeaderGuideProviders": "Guide Providers",
@@ -1489,5 +1489,7 @@
     "GuideProviderListingsStep": "Step 2: Select Listings",
     "GuideProviderLoginStep": "Step 1: Login",
     "LabelLineup": "Lineup:",
-    "MessageTunerDeviceNotListed": "Is your tuner device not listed? Try installing an external service provider for more Live TV options."
+    "MessageTunerDeviceNotListed": "Is your tuner device not listed? Try installing an external service provider for more Live TV options.",
+    "LabelImportOnlyFavoriteChannels": "Restrict to channels marked as favorite",
+    "ImportFavoriteChannelsHelp": "If enabled, only channels that are marked as favorite on the tuner device will be imported."
 }

+ 12 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -195,6 +195,12 @@
     <Content Include="dashboard-ui\livetvtimers.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="dashboard-ui\livetvtunerprovider-hdhomerun.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\livetvtunerprovider-m3u.html">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\mypreferenceshome.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -210,6 +216,12 @@
     <Content Include="dashboard-ui\scripts\livetvguideprovider-scd.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="dashboard-ui\scripts\livetvtunerprovider-hdhomerun.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="dashboard-ui\scripts\livetvtunerprovider-m3u.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\scripts\mypreferenceshome.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>