mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
re-enable sat/ip
This commit is contained in:
parent
63efe6ae98
commit
62023e986a
@ -21,225 +21,225 @@ using MediaBrowser.Model.Serialization;
|
|||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
|
namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
|
||||||
{
|
{
|
||||||
//public class SatIpDiscovery : IServerEntryPoint
|
public class SatIpDiscovery : IServerEntryPoint
|
||||||
//{
|
{
|
||||||
// private readonly IDeviceDiscovery _deviceDiscovery;
|
private readonly IDeviceDiscovery _deviceDiscovery;
|
||||||
// private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
// private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
// private readonly ILiveTvManager _liveTvManager;
|
private readonly ILiveTvManager _liveTvManager;
|
||||||
// private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
|
private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
|
||||||
// private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
// private readonly IJsonSerializer _json;
|
private readonly IJsonSerializer _json;
|
||||||
|
|
||||||
// public static SatIpDiscovery Current;
|
public static SatIpDiscovery Current;
|
||||||
|
|
||||||
// private readonly List<TunerHostInfo> _discoveredHosts = new List<TunerHostInfo>();
|
private readonly List<TunerHostInfo> _discoveredHosts = new List<TunerHostInfo>();
|
||||||
|
|
||||||
// public List<TunerHostInfo> DiscoveredHosts
|
public List<TunerHostInfo> DiscoveredHosts
|
||||||
// {
|
{
|
||||||
// get { return _discoveredHosts.ToList(); }
|
get { return _discoveredHosts.ToList(); }
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public SatIpDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient, IJsonSerializer json)
|
public SatIpDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient, IJsonSerializer json)
|
||||||
// {
|
{
|
||||||
// _deviceDiscovery = deviceDiscovery;
|
_deviceDiscovery = deviceDiscovery;
|
||||||
// _config = config;
|
_config = config;
|
||||||
// _logger = logger;
|
_logger = logger;
|
||||||
// _liveTvManager = liveTvManager;
|
_liveTvManager = liveTvManager;
|
||||||
// _httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
// _json = json;
|
_json = json;
|
||||||
// Current = this;
|
Current = this;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public void Run()
|
public void Run()
|
||||||
// {
|
{
|
||||||
// _deviceDiscovery.DeviceDiscovered += _deviceDiscovery_DeviceDiscovered;
|
_deviceDiscovery.DeviceDiscovered += _deviceDiscovery_DeviceDiscovered;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// void _deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e)
|
void _deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e)
|
||||||
// {
|
{
|
||||||
// string st = null;
|
string st = null;
|
||||||
// string nt = null;
|
string nt = null;
|
||||||
// e.Headers.TryGetValue("ST", out st);
|
e.Headers.TryGetValue("ST", out st);
|
||||||
// e.Headers.TryGetValue("NT", out nt);
|
e.Headers.TryGetValue("NT", out nt);
|
||||||
|
|
||||||
// if (string.Equals(st, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase) ||
|
if (string.Equals(st, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase) ||
|
||||||
// string.Equals(nt, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase))
|
string.Equals(nt, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase))
|
||||||
// {
|
{
|
||||||
// string location;
|
string location;
|
||||||
// if (e.Headers.TryGetValue("Location", out location) && !string.IsNullOrWhiteSpace(location))
|
if (e.Headers.TryGetValue("Location", out location) && !string.IsNullOrWhiteSpace(location))
|
||||||
// {
|
{
|
||||||
// _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);
|
AddDevice(location);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// private async void AddDevice(string location)
|
private async void AddDevice(string location)
|
||||||
// {
|
{
|
||||||
// await _semaphore.WaitAsync().ConfigureAwait(false);
|
await _semaphore.WaitAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// if (_discoveredHosts.Any(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(location, i.Url, StringComparison.OrdinalIgnoreCase)))
|
if (_discoveredHosts.Any(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(location, i.Url, StringComparison.OrdinalIgnoreCase)))
|
||||||
// {
|
{
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// _logger.Debug("Will attempt to add SAT device {0}", location);
|
_logger.Debug("Will attempt to add SAT device {0}", location);
|
||||||
// var info = await GetInfo(location, CancellationToken.None).ConfigureAwait(false);
|
var info = await GetInfo(location, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
// _discoveredHosts.Add(info);
|
_discoveredHosts.Add(info);
|
||||||
// }
|
}
|
||||||
// catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
// {
|
{
|
||||||
|
|
||||||
// }
|
}
|
||||||
// catch (NotImplementedException)
|
catch (NotImplementedException)
|
||||||
// {
|
{
|
||||||
|
|
||||||
// }
|
}
|
||||||
// catch (Exception ex)
|
catch (Exception ex)
|
||||||
// {
|
{
|
||||||
// _logger.ErrorException("Error saving device", ex);
|
_logger.ErrorException("Error saving device", ex);
|
||||||
// }
|
}
|
||||||
// finally
|
finally
|
||||||
// {
|
{
|
||||||
// _semaphore.Release();
|
_semaphore.Release();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public void Dispose()
|
public void Dispose()
|
||||||
// {
|
{
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public async Task<SatIpTunerHostInfo> GetInfo(string url, CancellationToken cancellationToken)
|
public async Task<SatIpTunerHostInfo> GetInfo(string url, CancellationToken cancellationToken)
|
||||||
// {
|
{
|
||||||
// var result = new SatIpTunerHostInfo
|
var result = new SatIpTunerHostInfo
|
||||||
// {
|
{
|
||||||
// Url = url,
|
Url = url,
|
||||||
// IsEnabled = true,
|
IsEnabled = true,
|
||||||
// Type = SatIpHost.DeviceType,
|
Type = SatIpHost.DeviceType,
|
||||||
// Tuners = 1,
|
Tuners = 1,
|
||||||
// TunersAvailable = 1
|
TunersAvailable = 1
|
||||||
// };
|
};
|
||||||
|
|
||||||
// using (var stream = await _httpClient.Get(url, cancellationToken).ConfigureAwait(false))
|
using (var stream = await _httpClient.Get(url, cancellationToken).ConfigureAwait(false))
|
||||||
// {
|
{
|
||||||
// using (var streamReader = new StreamReader(stream))
|
using (var streamReader = new StreamReader(stream))
|
||||||
// {
|
{
|
||||||
// // Use XmlReader for best performance
|
// Use XmlReader for best performance
|
||||||
// using (var reader = XmlReader.Create(streamReader))
|
using (var reader = XmlReader.Create(streamReader))
|
||||||
// {
|
{
|
||||||
// reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
// // Loop through each element
|
// Loop through each element
|
||||||
// while (reader.Read())
|
while (reader.Read())
|
||||||
// {
|
{
|
||||||
// if (reader.NodeType == XmlNodeType.Element)
|
if (reader.NodeType == XmlNodeType.Element)
|
||||||
// {
|
{
|
||||||
// switch (reader.Name)
|
switch (reader.Name)
|
||||||
// {
|
{
|
||||||
// case "device":
|
case "device":
|
||||||
// using (var subtree = reader.ReadSubtree())
|
using (var subtree = reader.ReadSubtree())
|
||||||
// {
|
{
|
||||||
// FillFromDeviceNode(result, subtree);
|
FillFromDeviceNode(result, subtree);
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
// default:
|
default:
|
||||||
// reader.Skip();
|
reader.Skip();
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (string.IsNullOrWhiteSpace(result.Id))
|
if (string.IsNullOrWhiteSpace(result.Id))
|
||||||
// {
|
{
|
||||||
// throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Device hasn't implemented an m3u list
|
// Device hasn't implemented an m3u list
|
||||||
// if (string.IsNullOrWhiteSpace(result.M3UUrl))
|
if (string.IsNullOrWhiteSpace(result.M3UUrl))
|
||||||
// {
|
{
|
||||||
// result.IsEnabled = false;
|
result.IsEnabled = false;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// else if (!result.M3UUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
else if (!result.M3UUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||||
// {
|
{
|
||||||
// var fullM3uUrl = url.Substring(0, url.LastIndexOf('/'));
|
var fullM3uUrl = url.Substring(0, url.LastIndexOf('/'));
|
||||||
// result.M3UUrl = fullM3uUrl + "/" + result.M3UUrl.TrimStart('/');
|
result.M3UUrl = fullM3uUrl + "/" + result.M3UUrl.TrimStart('/');
|
||||||
// }
|
}
|
||||||
|
|
||||||
// _logger.Debug("SAT device result: {0}", _json.SerializeToString(result));
|
_logger.Debug("SAT device result: {0}", _json.SerializeToString(result));
|
||||||
|
|
||||||
// return result;
|
return result;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// private void FillFromDeviceNode(SatIpTunerHostInfo info, XmlReader reader)
|
private void FillFromDeviceNode(SatIpTunerHostInfo info, XmlReader reader)
|
||||||
// {
|
{
|
||||||
// reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
// while (reader.Read())
|
while (reader.Read())
|
||||||
// {
|
{
|
||||||
// if (reader.NodeType == XmlNodeType.Element)
|
if (reader.NodeType == XmlNodeType.Element)
|
||||||
// {
|
{
|
||||||
// switch (reader.LocalName)
|
switch (reader.LocalName)
|
||||||
// {
|
{
|
||||||
// case "UDN":
|
case "UDN":
|
||||||
// {
|
{
|
||||||
// info.Id = reader.ReadElementContentAsString();
|
info.Id = reader.ReadElementContentAsString();
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// case "friendlyName":
|
case "friendlyName":
|
||||||
// {
|
{
|
||||||
// info.FriendlyName = reader.ReadElementContentAsString();
|
info.FriendlyName = reader.ReadElementContentAsString();
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// case "satip:X_SATIPCAP":
|
case "satip:X_SATIPCAP":
|
||||||
// case "X_SATIPCAP":
|
case "X_SATIPCAP":
|
||||||
// {
|
{
|
||||||
// // <satip:X_SATIPCAP xmlns:satip="urn:ses-com:satip">DVBS2-2</satip:X_SATIPCAP>
|
// <satip:X_SATIPCAP xmlns:satip="urn:ses-com:satip">DVBS2-2</satip:X_SATIPCAP>
|
||||||
// var value = reader.ReadElementContentAsString() ?? string.Empty;
|
var value = reader.ReadElementContentAsString() ?? string.Empty;
|
||||||
// var parts = value.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
|
var parts = value.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
// if (parts.Length == 2)
|
if (parts.Length == 2)
|
||||||
// {
|
{
|
||||||
// int intValue;
|
int intValue;
|
||||||
// if (int.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out intValue))
|
if (int.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out intValue))
|
||||||
// {
|
{
|
||||||
// info.TunersAvailable = intValue;
|
info.TunersAvailable = intValue;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (int.TryParse(parts[0].Substring(parts[0].Length - 1), NumberStyles.Any, CultureInfo.InvariantCulture, out intValue))
|
if (int.TryParse(parts[0].Substring(parts[0].Length - 1), NumberStyles.Any, CultureInfo.InvariantCulture, out intValue))
|
||||||
// {
|
{
|
||||||
// info.Tuners = intValue;
|
info.Tuners = intValue;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// case "satip:X_SATIPM3U":
|
case "satip:X_SATIPM3U":
|
||||||
// case "X_SATIPM3U":
|
case "X_SATIPM3U":
|
||||||
// {
|
{
|
||||||
// // <satip:X_SATIPM3U xmlns:satip="urn:ses-com:satip">/channellist.lua?select=m3u</satip:X_SATIPM3U>
|
// <satip:X_SATIPM3U xmlns:satip="urn:ses-com:satip">/channellist.lua?select=m3u</satip:X_SATIPM3U>
|
||||||
// info.M3UUrl = reader.ReadElementContentAsString();
|
info.M3UUrl = reader.ReadElementContentAsString();
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// default:
|
default:
|
||||||
// reader.Skip();
|
reader.Skip();
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
public class SatIpTunerHostInfo : TunerHostInfo
|
public class SatIpTunerHostInfo : TunerHostInfo
|
||||||
{
|
{
|
||||||
|
@ -19,153 +19,153 @@ using MediaBrowser.Model.Serialization;
|
|||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
|
namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
|
||||||
{
|
{
|
||||||
//public class SatIpHost : BaseTunerHost, ITunerHost
|
public class SatIpHost : BaseTunerHost, ITunerHost
|
||||||
//{
|
{
|
||||||
// private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
// private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
|
|
||||||
// public SatIpHost(IConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IHttpClient httpClient)
|
|
||||||
// : base(config, logger, jsonSerializer, mediaEncoder)
|
|
||||||
// {
|
|
||||||
// _fileSystem = fileSystem;
|
|
||||||
// _httpClient = httpClient;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private const string ChannelIdPrefix = "sat_";
|
public SatIpHost(IConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IHttpClient httpClient)
|
||||||
|
: base(config, logger, jsonSerializer, mediaEncoder)
|
||||||
// protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken)
|
{
|
||||||
// {
|
_fileSystem = fileSystem;
|
||||||
// var satInfo = (SatIpTunerHostInfo) tuner;
|
_httpClient = httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
// return await new M3uParser(Logger, _fileSystem, _httpClient).Parse(satInfo.M3UUrl, ChannelIdPrefix, tuner.Id, cancellationToken).ConfigureAwait(false);
|
private const string ChannelIdPrefix = "sat_";
|
||||||
// }
|
|
||||||
|
|
||||||
// public static string DeviceType
|
protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken)
|
||||||
// {
|
{
|
||||||
// get { return "satip"; }
|
var satInfo = (SatIpTunerHostInfo)tuner;
|
||||||
// }
|
|
||||||
|
|
||||||
// public override string Type
|
return await new M3uParser(Logger, _fileSystem, _httpClient).Parse(satInfo.M3UUrl, ChannelIdPrefix, tuner.Id, cancellationToken).ConfigureAwait(false);
|
||||||
// {
|
}
|
||||||
// get { return DeviceType; }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// protected override async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
public static string DeviceType
|
||||||
// {
|
{
|
||||||
// var urlHash = tuner.Url.GetMD5().ToString("N");
|
get { return "satip"; }
|
||||||
// var prefix = ChannelIdPrefix + urlHash;
|
}
|
||||||
// if (!channelId.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var channels = await GetChannels(tuner, true, cancellationToken).ConfigureAwait(false);
|
public override string Type
|
||||||
// var m3uchannels = channels.Cast<M3UChannel>();
|
{
|
||||||
// var channel = m3uchannels.FirstOrDefault(c => string.Equals(c.Id, channelId, StringComparison.OrdinalIgnoreCase));
|
get { return DeviceType; }
|
||||||
// if (channel != null)
|
}
|
||||||
// {
|
|
||||||
// var path = channel.Path;
|
|
||||||
// MediaProtocol protocol = MediaProtocol.File;
|
|
||||||
// if (path.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
|
||||||
// {
|
|
||||||
// protocol = MediaProtocol.Http;
|
|
||||||
// }
|
|
||||||
// else if (path.StartsWith("rtmp", StringComparison.OrdinalIgnoreCase))
|
|
||||||
// {
|
|
||||||
// protocol = MediaProtocol.Rtmp;
|
|
||||||
// }
|
|
||||||
// else if (path.StartsWith("rtsp", StringComparison.OrdinalIgnoreCase))
|
|
||||||
// {
|
|
||||||
// protocol = MediaProtocol.Rtsp;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var mediaSource = new MediaSourceInfo
|
protected override async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
||||||
// {
|
{
|
||||||
// Path = channel.Path,
|
var urlHash = tuner.Url.GetMD5().ToString("N");
|
||||||
// Protocol = protocol,
|
var prefix = ChannelIdPrefix + urlHash;
|
||||||
// MediaStreams = new List<MediaStream>
|
if (!channelId.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
||||||
// {
|
{
|
||||||
// new MediaStream
|
return null;
|
||||||
// {
|
}
|
||||||
// Type = MediaStreamType.Video,
|
|
||||||
// // Set the index to -1 because we don't know the exact index of the video stream within the container
|
|
||||||
// Index = -1,
|
|
||||||
// IsInterlaced = true
|
|
||||||
// },
|
|
||||||
// new MediaStream
|
|
||||||
// {
|
|
||||||
// Type = MediaStreamType.Audio,
|
|
||||||
// // Set the index to -1 because we don't know the exact index of the audio stream within the container
|
|
||||||
// Index = -1
|
|
||||||
|
|
||||||
// }
|
var channels = await GetChannels(tuner, true, cancellationToken).ConfigureAwait(false);
|
||||||
// },
|
var m3uchannels = channels.Cast<M3UChannel>();
|
||||||
// RequiresOpening = false,
|
var channel = m3uchannels.FirstOrDefault(c => string.Equals(c.Id, channelId, StringComparison.OrdinalIgnoreCase));
|
||||||
// RequiresClosing = false
|
if (channel != null)
|
||||||
// };
|
{
|
||||||
|
var path = channel.Path;
|
||||||
|
MediaProtocol protocol = MediaProtocol.File;
|
||||||
|
if (path.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
protocol = MediaProtocol.Http;
|
||||||
|
}
|
||||||
|
else if (path.StartsWith("rtmp", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
protocol = MediaProtocol.Rtmp;
|
||||||
|
}
|
||||||
|
else if (path.StartsWith("rtsp", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
protocol = MediaProtocol.Rtsp;
|
||||||
|
}
|
||||||
|
|
||||||
// return new List<MediaSourceInfo> { mediaSource };
|
var mediaSource = new MediaSourceInfo
|
||||||
// }
|
{
|
||||||
// return new List<MediaSourceInfo> { };
|
Path = channel.Path,
|
||||||
// }
|
Protocol = protocol,
|
||||||
|
MediaStreams = new List<MediaStream>
|
||||||
|
{
|
||||||
|
new MediaStream
|
||||||
|
{
|
||||||
|
Type = MediaStreamType.Video,
|
||||||
|
// Set the index to -1 because we don't know the exact index of the video stream within the container
|
||||||
|
Index = -1,
|
||||||
|
IsInterlaced = true
|
||||||
|
},
|
||||||
|
new MediaStream
|
||||||
|
{
|
||||||
|
Type = MediaStreamType.Audio,
|
||||||
|
// Set the index to -1 because we don't know the exact index of the audio stream within the container
|
||||||
|
Index = -1
|
||||||
|
|
||||||
// protected override async Task<MediaSourceInfo> GetChannelStream(TunerHostInfo tuner, string channelId, string streamId, CancellationToken cancellationToken)
|
}
|
||||||
// {
|
},
|
||||||
// var sources = await GetChannelStreamMediaSources(tuner, channelId, cancellationToken).ConfigureAwait(false);
|
RequiresOpening = false,
|
||||||
|
RequiresClosing = false
|
||||||
|
};
|
||||||
|
|
||||||
// return sources.First();
|
return new List<MediaSourceInfo> { mediaSource };
|
||||||
// }
|
}
|
||||||
|
return new List<MediaSourceInfo> { };
|
||||||
|
}
|
||||||
|
|
||||||
// protected override async Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
protected override async Task<MediaSourceInfo> GetChannelStream(TunerHostInfo tuner, string channelId, string streamId, CancellationToken cancellationToken)
|
||||||
// {
|
{
|
||||||
// var updatedInfo = await SatIpDiscovery.Current.GetInfo(tuner.Url, cancellationToken).ConfigureAwait(false);
|
var sources = await GetChannelStreamMediaSources(tuner, channelId, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
// return updatedInfo.TunersAvailable > 0;
|
return sources.First();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// protected override bool IsValidChannelId(string channelId)
|
protected override async Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
|
||||||
// {
|
{
|
||||||
// return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase);
|
var updatedInfo = await SatIpDiscovery.Current.GetInfo(tuner.Url, cancellationToken).ConfigureAwait(false);
|
||||||
// }
|
|
||||||
|
|
||||||
// protected override List<TunerHostInfo> GetTunerHosts()
|
return updatedInfo.TunersAvailable > 0;
|
||||||
// {
|
}
|
||||||
// return SatIpDiscovery.Current.DiscoveredHosts;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public string Name
|
protected override bool IsValidChannelId(string channelId)
|
||||||
// {
|
{
|
||||||
// get { return "Sat IP"; }
|
return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// public Task<List<LiveTvTunerInfo>> GetTunerInfos(CancellationToken cancellationToken)
|
protected override List<TunerHostInfo> GetTunerHosts()
|
||||||
// {
|
{
|
||||||
// var list = GetTunerHosts()
|
return SatIpDiscovery.Current.DiscoveredHosts;
|
||||||
// .SelectMany(i => GetTunerInfos(i, cancellationToken))
|
}
|
||||||
// .ToList();
|
|
||||||
|
|
||||||
// return Task.FromResult(list);
|
public string Name
|
||||||
// }
|
{
|
||||||
|
get { return "Sat IP"; }
|
||||||
|
}
|
||||||
|
|
||||||
// public List<LiveTvTunerInfo> GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken)
|
public Task<List<LiveTvTunerInfo>> GetTunerInfos(CancellationToken cancellationToken)
|
||||||
// {
|
{
|
||||||
// var satInfo = (SatIpTunerHostInfo) info;
|
var list = GetTunerHosts()
|
||||||
|
.SelectMany(i => GetTunerInfos(i, cancellationToken))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
// var list = new List<LiveTvTunerInfo>();
|
return Task.FromResult(list);
|
||||||
|
}
|
||||||
|
|
||||||
// for (var i = 0; i < satInfo.Tuners; i++)
|
public List<LiveTvTunerInfo> GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken)
|
||||||
// {
|
{
|
||||||
// list.Add(new LiveTvTunerInfo
|
var satInfo = (SatIpTunerHostInfo)info;
|
||||||
// {
|
|
||||||
// Name = satInfo.FriendlyName ?? Name,
|
|
||||||
// SourceType = Type,
|
|
||||||
// Status = LiveTvTunerStatus.Available,
|
|
||||||
// Id = info.Url.GetMD5().ToString("N") + i.ToString(CultureInfo.InvariantCulture),
|
|
||||||
// Url = info.Url
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return list;
|
var list = new List<LiveTvTunerInfo>();
|
||||||
// }
|
|
||||||
//}
|
for (var i = 0; i < satInfo.Tuners; i++)
|
||||||
|
{
|
||||||
|
list.Add(new LiveTvTunerInfo
|
||||||
|
{
|
||||||
|
Name = satInfo.FriendlyName ?? Name,
|
||||||
|
SourceType = Type,
|
||||||
|
Status = LiveTvTunerStatus.Available,
|
||||||
|
Id = info.Url.GetMD5().ToString("N") + i.ToString(CultureInfo.InvariantCulture),
|
||||||
|
Url = info.Url
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user