stubbed out channel mappings
This commit is contained in:
parent
faefbf36cc
commit
83105f5aae
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Dto;
|
||||
|
||||
namespace MediaBrowser.Model.LiveTv
|
||||
{
|
||||
|
@ -77,6 +78,7 @@ namespace MediaBrowser.Model.LiveTv
|
|||
public string[] SportsCategories { get; set; }
|
||||
public string[] KidsCategories { get; set; }
|
||||
public string[] MovieCategories { get; set; }
|
||||
public NameValuePair[] ChannelMappings { get; set; }
|
||||
|
||||
public ListingsProviderInfo()
|
||||
{
|
||||
|
@ -86,6 +88,7 @@ namespace MediaBrowser.Model.LiveTv
|
|||
MovieCategories = new string[] { "movie" };
|
||||
EnabledTuners = new string[] { };
|
||||
EnableAllTuners = true;
|
||||
ChannelMappings = new NameValuePair[] {};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -625,7 +625,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
_logger.Debug("Getting programs for channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
|
||||
|
||||
var programs = await provider.Item1.GetProgramsAsync(provider.Item2, channel.Number, channel.Name, startDateUtc, endDateUtc, cancellationToken)
|
||||
var channelMappings = GetChannelMappings(provider.Item2);
|
||||
var channelNumber = channel.Number;
|
||||
string mappedChannelNumber;
|
||||
if (channelMappings.TryGetValue(channelNumber, out mappedChannelNumber))
|
||||
{
|
||||
_logger.Debug("Found mapped channel on provider {0}. Tuner channel number: {1}, Mapped channel number: {2}", provider.Item1.Name, channelNumber, mappedChannelNumber);
|
||||
channelNumber = mappedChannelNumber;
|
||||
}
|
||||
|
||||
var programs = await provider.Item1.GetProgramsAsync(provider.Item2, channelNumber, channel.Name, startDateUtc, endDateUtc, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var list = programs.ToList();
|
||||
|
@ -647,6 +656,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
|||
return new List<ProgramInfo>();
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetChannelMappings(ListingsProviderInfo info)
|
||||
{
|
||||
var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var mapping in info.ChannelMappings)
|
||||
{
|
||||
dict[mapping.Name] = mapping.Value;
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
private List<Tuple<IListingsProvider, ListingsProviderInfo>> GetListingProviders()
|
||||
{
|
||||
return GetConfiguration().ListingProviders
|
||||
|
|
|
@ -17,14 +17,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
private Dictionary<string, string> _channelMappings = new Dictionary<string, string>(){
|
||||
{ "1", "UK_RT_2667" },
|
||||
{ "2", "UK_RT_116" },
|
||||
{ "3", "UK_RT_2118" },
|
||||
{ "4", "UK_RT_2056" },
|
||||
{ "5", "UK_RT_134" }
|
||||
};
|
||||
|
||||
public XmlTvListingsProvider(IServerConfigurationManager config)
|
||||
{
|
||||
_config = config;
|
||||
|
@ -51,11 +43,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
var reader = new XmlTvReader(info.Path, GetLanguage(), null);
|
||||
string mappedChannel = channelNumber;
|
||||
|
||||
if (_channelMappings.ContainsKey(channelNumber))
|
||||
{
|
||||
mappedChannel = _channelMappings[channelNumber];
|
||||
}
|
||||
|
||||
var results = reader.GetProgrammes(mappedChannel, startDateUtc, endDateUtc, cancellationToken);
|
||||
return Task.FromResult(results.Select(p => new ProgramInfo()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user