diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-06-08 11:25:17 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2016-06-08 11:25:17 -0400 |
| commit | b6b5a0e6dc2e57b37129ac46cdb7d7d89ae2b628 (patch) | |
| tree | 424fdc63a5755aa79a7ff414fcc195699adfb1ad /MediaBrowser.Server.Implementations/LiveTv | |
| parent | 1c4a48d2577e7afcc94e194135f07dbe94e0dbd7 (diff) | |
| parent | 26ff2882e7b9dea4be55c50f571e64aea88c2004 (diff) | |
Merge pull request #1830 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv')
4 files changed, 61 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 41c137c295..d3e5bc1f9e 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1000,7 +1000,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV result.Item3.Release(); } - _libraryMonitor.ReportFileSystemChangeComplete(recordPath, false); + _libraryMonitor.ReportFileSystemChangeComplete(recordPath, true); } } catch (OperationCanceledException) diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index ae2a850900..fe455665ff 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -869,6 +869,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings return GetHeadends(info, country, location, CancellationToken.None); } + public async Task<List<ChannelInfo>> GetChannels(ListingsProviderInfo info, CancellationToken cancellationToken) + { + return new List<ChannelInfo>(); + } + public class ScheduleDirect { public class Token diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index 328dd99792..d9b7e8f4be 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -107,11 +107,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings var reader = new XmlTvReader(info.Path, GetLanguage(), null); var results = reader.GetChannels().ToList(); - if (channels != null && channels.Count > 0) + if (channels != null) { channels.ForEach(c => { - var match = results.FirstOrDefault(r => r.Id == c.Id); + var channelNumber = info.GetMappedChannel(c.Number); + var match = results.FirstOrDefault(r => string.Equals(r.Id, channelNumber, StringComparison.OrdinalIgnoreCase)); + if (match != null && match.Icon != null && !String.IsNullOrEmpty(match.Icon.Source)) { c.ImageUrl = match.Icon.Source; @@ -142,5 +144,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings // Should this method be async? return Task.FromResult(results.Select(c => new NameIdPair() { Id = c.Id, Name = c.DisplayName }).ToList()); } + + public async Task<List<ChannelInfo>> GetChannels(ListingsProviderInfo info, CancellationToken cancellationToken) + { + return new List<ChannelInfo>(); + } } }
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index e126e5411e..46f7a8f30c 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -30,6 +30,8 @@ using System.Threading.Tasks; using CommonIO; using IniParser; using IniParser.Model; +using MediaBrowser.Common.Events; +using MediaBrowser.Model.Events; namespace MediaBrowser.Server.Implementations.LiveTv { @@ -64,6 +66,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv private readonly List<IListingsProvider> _listingProviders = new List<IListingsProvider>(); private readonly IFileSystem _fileSystem; + public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCancelled; + public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCancelled; + public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated; + public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCreated; + public LiveTvManager(IApplicationHost appHost, IServerConfigurationManager config, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager, ILocalizationManager localization, IJsonSerializer jsonSerializer, IProviderManager providerManager, IFileSystem fileSystem) { _config = config; @@ -1759,6 +1766,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv await service.CancelTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); _lastRecordingRefreshTime = DateTime.MinValue; + + EventHelper.QueueEventIfNotNull(TimerCancelled, this, new GenericEventArgs<TimerEventInfo> + { + Argument = new TimerEventInfo + { + Id = id + } + }, _logger); } public async Task CancelSeriesTimer(string id) @@ -1774,6 +1789,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv await service.CancelSeriesTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); _lastRecordingRefreshTime = DateTime.MinValue; + + EventHelper.QueueEventIfNotNull(SeriesTimerCancelled, this, new GenericEventArgs<TimerEventInfo> + { + Argument = new TimerEventInfo + { + Id = id + } + }, _logger); } public async Task<BaseItemDto> GetRecording(string id, DtoOptions options, CancellationToken cancellationToken, User user = null) @@ -1993,6 +2016,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv await service.CreateTimerAsync(info, cancellationToken).ConfigureAwait(false); _lastRecordingRefreshTime = DateTime.MinValue; _logger.Info("New recording scheduled"); + + EventHelper.QueueEventIfNotNull(TimerCreated, this, new GenericEventArgs<TimerEventInfo> + { + Argument = new TimerEventInfo + { + ProgramId = info.ProgramId + } + }, _logger); } public async Task CreateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken) @@ -2007,6 +2038,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv await service.CreateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false); _lastRecordingRefreshTime = DateTime.MinValue; + + EventHelper.QueueEventIfNotNull(SeriesTimerCreated, this, new GenericEventArgs<TimerEventInfo> + { + Argument = new TimerEventInfo + { + ProgramId = info.ProgramId + } + }, _logger); } public async Task UpdateTimer(TimerInfoDto timer, CancellationToken cancellationToken) @@ -2521,5 +2560,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv { return new TunerHosts.SatIp.ChannelScan(_logger).Scan(info, cancellationToken); } + + public Task<List<ChannelInfo>> GetChannelsFromListingsProvider(string id, CancellationToken cancellationToken) + { + var info = GetConfiguration().ListingProviders.First(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase)); + var provider = _listingProviders.First(i => string.Equals(i.Type, info.Type, StringComparison.OrdinalIgnoreCase)); + return provider.GetChannels(info, cancellationToken); + } } }
\ No newline at end of file |
