diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-06-05 17:27:14 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-06-05 17:27:14 -0400 |
| commit | 73ab3edeec59b5db3b630574a4796973eddc636b (patch) | |
| tree | 7616ec5486438e23bad26c9f4b1d7e18363428e7 | |
| parent | 7388320d96a12044f367bf3f1e5e6e31c1904608 (diff) | |
update xmltv language
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index a713ff0ef..4f43d93b7 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -9,12 +9,13 @@ using System.Threading; using System.Threading.Tasks; using Emby.XmlTv.Classes; +using MediaBrowser.Controller.Configuration; namespace MediaBrowser.Server.Implementations.LiveTv.Listings { public class XmlTvListingsProvider : IListingsProvider { - private string _language = null; + private readonly IServerConfigurationManager _config; private Dictionary<string, string> _channelMappings = new Dictionary<string, string>(){ { "1", "UK_RT_2667" }, @@ -24,6 +25,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings { "5", "UK_RT_134" } }; + public XmlTvListingsProvider(IServerConfigurationManager config) + { + _config = config; + } + public string Name { get { return "XmlTV"; } @@ -34,10 +40,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings get { return "xmltv"; } } + private string GetLanguage() + { + return _config.Configuration.PreferredMetadataLanguage; + } + // TODO: Should this method be async? public Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken) { - var reader = new XmlTvReader(info.Path, _language, null); + var reader = new XmlTvReader(info.Path, GetLanguage(), null); string mappedChannel = channelNumber; if (_channelMappings.ContainsKey(channelNumber)) @@ -77,7 +88,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings public async Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken) { // Add the channel image url - var reader = new XmlTvReader(info.Path, _language, null); + var reader = new XmlTvReader(info.Path, GetLanguage(), null); var results = reader.GetChannels().ToList(); if (channels != null && channels.Count > 0) @@ -104,7 +115,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings 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 - var reader = new XmlTvReader(info.Path, _language, null); + var reader = new XmlTvReader(info.Path, GetLanguage(), null); var results = reader.GetChannels(); // Should this method be async? |
