Merge pull request #1551 from MediaBrowser/dev

Dev
pull/702/head
Luke 9 years ago
commit 3e2a7fcf5c

@ -33,6 +33,7 @@ namespace MediaBrowser.Model.LiveTv
public bool ImportFavoritesOnly { get; set; } public bool ImportFavoritesOnly { get; set; }
public bool IsEnabled { get; set; } public bool IsEnabled { get; set; }
public string M3UUrl { get; set; } public string M3UUrl { get; set; }
public string InfoUrl { get; set; }
public string FriendlyName { get; set; } public string FriendlyName { get; set; }
public int Tuners { get; set; } public int Tuners { get; set; }
public string DiseqC { get; set; } public string DiseqC { get; set; }

@ -219,7 +219,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{ {
try try
{ {
await provider.Item1.AddMetadata(provider.Item2, list, cancellationToken).ConfigureAwait(false); await provider.Item1.AddMetadata(provider.Item2, enabledChannels, cancellationToken).ConfigureAwait(false);
} }
catch (NotSupportedException) catch (NotSupportedException)
{ {

@ -17,6 +17,7 @@ using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
{ {
@ -64,26 +65,33 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
_logger.Debug("SAT IP found at {0}", location); _logger.Debug("SAT IP found at {0}", location);
// Just get the beginning of the url // Just get the beginning of the url
AddDevice(location); Uri uri;
if (Uri.TryCreate(location, UriKind.Absolute, out uri))
{
var apiUrl = location.Replace(uri.LocalPath, String.Empty, StringComparison.OrdinalIgnoreCase)
.TrimEnd('/');
AddDevice(apiUrl, location);
}
} }
} }
} }
private async void AddDevice(string location) private async void AddDevice(string deviceUrl, string infoUrl)
{ {
await _semaphore.WaitAsync().ConfigureAwait(false); await _semaphore.WaitAsync().ConfigureAwait(false);
try try
{ {
var options = GetConfiguration(); var options = GetConfiguration();
if (options.TunerHosts.Any(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && UriEquals(i.Url, location))) if (options.TunerHosts.Any(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && UriEquals(i.Url, deviceUrl)))
{ {
return; return;
} }
_logger.Debug("Will attempt to add SAT device {0}", location); _logger.Debug("Will attempt to add SAT device {0}", deviceUrl);
var info = await GetInfo(location, CancellationToken.None).ConfigureAwait(false); var info = await GetInfo(infoUrl, CancellationToken.None).ConfigureAwait(false);
var existing = GetConfiguration().TunerHosts var existing = GetConfiguration().TunerHosts
.FirstOrDefault(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(i.DeviceId, info.DeviceId, StringComparison.OrdinalIgnoreCase)); .FirstOrDefault(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(i.DeviceId, info.DeviceId, StringComparison.OrdinalIgnoreCase));
@ -98,7 +106,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
await _liveTvManager.SaveTunerHost(new TunerHostInfo await _liveTvManager.SaveTunerHost(new TunerHostInfo
{ {
Type = SatIpHost.DeviceType, Type = SatIpHost.DeviceType,
Url = location, Url = deviceUrl,
InfoUrl = infoUrl,
DataVersion = 1, DataVersion = 1,
DeviceId = info.DeviceId, DeviceId = info.DeviceId,
FriendlyName = info.FriendlyName, FriendlyName = info.FriendlyName,
@ -110,14 +119,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
} }
else else
{ {
if (!string.Equals(existing.Url, location, StringComparison.OrdinalIgnoreCase)) existing.Url = deviceUrl;
{ existing.InfoUrl = infoUrl;
existing.Url = location; existing.M3UUrl = info.M3UUrl;
existing.M3UUrl = info.M3UUrl; existing.FriendlyName = info.FriendlyName;
existing.FriendlyName = info.FriendlyName; existing.Tuners = info.Tuners;
existing.Tuners = info.Tuners; await _liveTvManager.SaveTunerHost(existing).ConfigureAwait(false);
await _liveTvManager.SaveTunerHost(existing).ConfigureAwait(false);
}
} }
} }
catch (OperationCanceledException) catch (OperationCanceledException)

@ -116,7 +116,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
protected override async Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken) protected override async Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
{ {
var updatedInfo = await SatIpDiscovery.Current.GetInfo(tuner.Url, cancellationToken).ConfigureAwait(false); var updatedInfo = await SatIpDiscovery.Current.GetInfo(tuner.InfoUrl, cancellationToken).ConfigureAwait(false);
return updatedInfo.TunersAvailable > 0; return updatedInfo.TunersAvailable > 0;
} }

@ -269,6 +269,9 @@
<Content Include="dashboard-ui\legacy\dashboard.js"> <Content Include="dashboard-ui\legacy\dashboard.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\legacy\objectassign.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\livetvguideprovider.html"> <Content Include="dashboard-ui\livetvguideprovider.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

Loading…
Cancel
Save