The Free Software Media System - Server Backend & API
update xmltv parsing
Luke Pulverenti1d849e3f2549
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csprojindex 26053719bf..195d24b218 100644--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj@@ -309,8 +309,8 @@<Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project><Name>SocketHttpListener.Portable</Name></ProjectReference>- <Reference Include="Emby.XmlTv, Version=1.0.6236.39295, Culture=neutral, processorArchitecture=MSIL">- <HintPath>..\packages\Emby.XmlTv.1.0.4\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>+ <Reference Include="Emby.XmlTv, Version=1.0.6241.4924, Culture=neutral, processorArchitecture=MSIL">+ <HintPath>..\packages\Emby.XmlTv.1.0.5\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath><Private>True</Private></Reference><Reference Include="MediaBrowser.Naming, Version=1.0.6201.24431, Culture=neutral, processorArchitecture=MSIL">diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 07fe813bdb..f942597540 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -847,6 +847,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar channelMappings = GetChannelMappings(provider.Item2);var channelNumber = channel.Number;+ var tunerChannelId = channel.TunerChannelId;if (!string.IsNullOrWhiteSpace(channelNumber)){@@ -858,7 +859,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV}}- var programs = await provider.Item1.GetProgramsAsync(provider.Item2, channelNumber, channel.Name, startDateUtc, endDateUtc, cancellationToken)+ var programs = await provider.Item1.GetProgramsAsync(provider.Item2, tunerChannelId, channelNumber, channel.Name, startDateUtc, endDateUtc, cancellationToken).ConfigureAwait(false);var list = programs.ToList();diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.csindex 66ad6911a0..e5790b875a 100644--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs@@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingsreturn dates;}- public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)+ public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken){List<ProgramInfo> programsInfo = new List<ProgramInfo>();diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.csindex abb853eb23..adb4f359eb 100644--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs@@ -106,7 +106,7 @@ namespace Emby.Server.Implementations.LiveTv.Listingsreturn cacheFile;}- public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)+ public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken){if (!await EmbyTV.EmbyTVRegistration.Instance.EnableXmlTv().ConfigureAwait(false)){@@ -161,8 +161,12 @@ namespace Emby.Server.Implementations.LiveTv.Listings}else{- var uniqueString = (p.Title ?? string.Empty) + (episodeTitle ?? string.Empty);+ var uniqueString = (p.Title ?? string.Empty) + (episodeTitle ?? string.Empty) + (p.IceTvEpisodeNumber ?? string.Empty);+ if (programInfo.SeasonNumber.HasValue)+ {+ uniqueString = "-" + programInfo.SeasonNumber.Value.ToString(CultureInfo.InvariantCulture);+ }if (programInfo.EpisodeNumber.HasValue){uniqueString = "-" + programInfo.EpisodeNumber.Value.ToString(CultureInfo.InvariantCulture);diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.csindex 5e191ada9f..bac9664c5f 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs@@ -137,6 +137,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsif (attributes.TryGetValue("tvg-id", out value)){channel.Id = value;+ channel.TunerChannelId = value;}return channel;diff --git a/Emby.Server.Implementations/packages.config b/Emby.Server.Implementations/packages.configindex a27d6b4e23..5249577e61 100644--- a/Emby.Server.Implementations/packages.config+++ b/Emby.Server.Implementations/packages.config@@ -1,6 +1,6 @@<?xml version="1.0" encoding="utf-8"?><packages>- <package id="Emby.XmlTv" version="1.0.4" targetFramework="portable45-net45+win8" />+ <package id="Emby.XmlTv" version="1.0.5" targetFramework="portable45-net45+win8" /><package id="MediaBrowser.Naming" version="1.0.4" targetFramework="portable45-net45+win8" /><package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" /><package id="SQLitePCLRaw.core" version="1.1.1" targetFramework="portable45-net45+win8" />diff --git a/MediaBrowser.Api/BasePeriodicWebSocketListener.cs b/MediaBrowser.Api/BasePeriodicWebSocketListener.csindex fe7de387f8..8004d7e9bf 100644--- a/MediaBrowser.Api/BasePeriodicWebSocketListener.cs+++ b/MediaBrowser.Api/BasePeriodicWebSocketListener.cs@@ -23,8 +23,8 @@ namespace MediaBrowser.Api/// <summary>/// The _active connections/// </summary>- protected readonly List<Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType, SemaphoreSlim>> ActiveConnections =- new List<Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType, SemaphoreSlim>>();+ protected readonly List<Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType>> ActiveConnections =+ new List<Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType>>();/// <summary>/// Gets the name.@@ -132,11 +132,9 @@ namespace MediaBrowser.ApiInitialDelayMs = dueTimeMs};- var semaphore = new SemaphoreSlim(1, 1);-lock (ActiveConnections){- ActiveConnections.Add(new Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType, SemaphoreSlim>(message.Connection, cancellationTokenSource, timer, state, semaphore));+ ActiveConnections.Add(new Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType>(message.Connection, cancellationTokenSource, timer, state));}if (timer != null)@@ -153,7 +151,7 @@ namespace MediaBrowser.Api{var connection = (IWebSocketConnection)state;- Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType, SemaphoreSlim> tuple;+ Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType> tuple;lock (ActiveConnections){@@ -176,7 +174,7 @@ namespace MediaBrowser.Apiprotected void SendData(bool force){- List<Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType, SemaphoreSlim>> tuples;+ List<Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType>> tuples;lock (ActiveConnections){@@ -204,14 +202,12 @@ namespace MediaBrowser.Api}}- private async void SendData(Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType, SemaphoreSlim> tuple)+ private async void SendData(Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType> tuple){var connection = tuple.Item1;try{- await tuple.Item5.WaitAsync(tuple.Item2.Token).ConfigureAwait(false);-var state = tuple.Item4;var data = await GetDataToSend(state).ConfigureAwait(false);@@ -227,8 +223,6 @@ namespace MediaBrowser.Apistate.DateLastSendUtc = DateTime.UtcNow;}-- tuple.Item5.Release();}catch (OperationCanceledException){@@ -265,7 +259,7 @@ namespace MediaBrowser.Api/// Disposes the connection./// </summary>/// <param name="connection">The connection.</param>- private void DisposeConnection(Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType, SemaphoreSlim> connection)+ private void DisposeConnection(Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType> connection){Logger.Debug("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name);@@ -293,15 +287,6 @@ namespace MediaBrowser.Api}- try- {- connection.Item5.Dispose();- }- catch (ObjectDisposedException)- {-- }-ActiveConnections.Remove(connection);}diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.csindex 372b095fd1..fae9076588 100644--- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs+++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs@@ -25,6 +25,8 @@ namespace MediaBrowser.Controller.LiveTv/// <value>The id of the channel.</value>public string Id { get; set; }+ public string TunerChannelId { get; set; }+/// <summary>/// Gets or sets the tuner host identifier./// </summary>diff --git a/MediaBrowser.Controller/LiveTv/IListingsProvider.cs b/MediaBrowser.Controller/LiveTv/IListingsProvider.csindex 5ecd70cc5c..3d610544ee 100644--- a/MediaBrowser.Controller/LiveTv/IListingsProvider.cs+++ b/MediaBrowser.Controller/LiveTv/IListingsProvider.cs@@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.LiveTv{string Name { get; }string Type { get; }- Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken);+ Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken);Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken);Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings);Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location);