From a0934e62261f0fc8788efb13c653973c16d02d3e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 13 Mar 2017 16:42:21 -0400 Subject: continue with tuner discovery --- Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 14 ++++++++++++++ Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 5 +++++ .../LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs | 1 + 3 files changed, 20 insertions(+) (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index a7ccafd69..42e8c4f5f 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -2543,6 +2543,20 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public CancellationTokenSource CancellationTokenSource { get; set; } } + public async Task> DiscoverTuners(CancellationToken cancellationToken) + { + var list = new List(); + + foreach (var host in _liveTvManager.TunerHosts) + { + var discoveredDevices = await DiscoverDevices(host, 3000, cancellationToken).ConfigureAwait(false); + + list.AddRange(discoveredDevices); + } + + return list; + } + public async Task ScanForTunerDeviceChanges(CancellationToken cancellationToken) { foreach (var host in _liveTvManager.TunerHosts) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index de39d3838..92ef24dea 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -160,6 +160,11 @@ namespace Emby.Server.Implementations.LiveTv }).ToList(); } + public Task> DiscoverTuners(CancellationToken cancellationToken) + { + return EmbyTV.EmbyTV.Current.DiscoverTuners(cancellationToken); + } + void service_DataSourceChanged(object sender, EventArgs e) { if (!_isDisposed) diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index dbcabd174..6d6730855 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -706,6 +706,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun var modelInfo = await GetModelInfo(hostInfo, false, cancellationToken).ConfigureAwait(false); hostInfo.DeviceId = modelInfo.DeviceID; + hostInfo.FriendlyName = modelInfo.FriendlyName; return hostInfo; } -- cgit v1.2.3 From 8d72c7e881c14961ef51b08658f4c30e66d86ac8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 14 Mar 2017 15:44:11 -0400 Subject: add option to refresh metadata every N number of days --- Emby.Server.Implementations/Dto/DtoService.cs | 4 ++-- MediaBrowser.Model/Configuration/LibraryOptions.cs | 2 ++ MediaBrowser.Providers/Manager/MetadataService.cs | 21 +++++++++------------ Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 147abd171..d477008a5 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.Dto } } - //if (!(item is LiveTvProgram) || fields.Contains(ItemFields.PlayAccess)) + if (!(item is LiveTvProgram) || fields.Contains(ItemFields.PlayAccess)) { dto.PlayAccess = item.GetPlayAccess(user); } @@ -1639,7 +1639,7 @@ namespace Emby.Server.Implementations.Dto var width = size.Width; var height = size.Height; - if (width == 0 || height == 0) + if (width.Equals(0) || height.Equals(0)) { return null; } diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index 7af0acc59..9cd656fa7 100644 --- a/MediaBrowser.Model/Configuration/LibraryOptions.cs +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -16,6 +16,8 @@ public bool EnableAutomaticSeriesGrouping { get; set; } public bool EnableEmbeddedTitles { get; set; } + public int AutomaticRefreshIntervalDays { get; set; } + /// /// Gets or sets the preferred metadata language. /// diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index bdfe13c1d..59a2278a1 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -45,12 +45,21 @@ namespace MediaBrowser.Providers.Manager var updateType = ItemUpdateType.None; var requiresRefresh = false; + var libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item); + if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None) { // TODO: If this returns true, should we instead just change metadata refresh mode to Full? requiresRefresh = item.RequiresRefresh(); } + if (!requiresRefresh && + libraryOptions.AutomaticRefreshIntervalDays > 0 && + (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= libraryOptions.AutomaticRefreshIntervalDays) + { + requiresRefresh = true; + } + var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager, FileSystem); var localImagesFailed = false; @@ -116,8 +125,6 @@ namespace MediaBrowser.Providers.Manager } } - LibraryOptions libraryOptions = null; - // Next run remote image providers, but only if local image providers didn't throw an exception if (!localImagesFailed && refreshOptions.ImageRefreshMode != ImageRefreshMode.ValidationOnly) { @@ -125,11 +132,6 @@ namespace MediaBrowser.Providers.Manager if (providers.Count > 0) { - if (libraryOptions == null) - { - libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item); - } - var result = await itemImageProvider.RefreshImages(itemOfType, libraryOptions, providers, refreshOptions, config, cancellationToken).ConfigureAwait(false); updateType = updateType | result.UpdateType; @@ -177,11 +179,6 @@ namespace MediaBrowser.Providers.Manager item.DateLastRefreshed = default(DateTime); } - if (libraryOptions == null) - { - libraryOptions = LibraryManager.GetLibraryOptions((BaseItem)item); - } - // Save to database await SaveItem(metadataResult, libraryOptions, updateType, cancellationToken).ConfigureAwait(false); } diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 1e03f1169..54133b718 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.696 + 3.0.697 Emby.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index d6777dad1..e59460c94 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.696 + 3.0.697 Emby.Server.Core Emby Team ebr,Luke,scottisafool -- cgit v1.2.3 From 296e5bfe32bd0e859d20632b2f20eca6d00a698d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 14 Mar 2017 15:44:35 -0400 Subject: update handling of new programs for xml tv --- Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 6 ++++-- .../LiveTv/Listings/XmlTvListingsProvider.cs | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 42e8c4f5f..d18004f96 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -2543,13 +2543,15 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public CancellationTokenSource CancellationTokenSource { get; set; } } + private const int TunerDiscoveryDurationMs = 3000; + public async Task> DiscoverTuners(CancellationToken cancellationToken) { var list = new List(); foreach (var host in _liveTvManager.TunerHosts) { - var discoveredDevices = await DiscoverDevices(host, 3000, cancellationToken).ConfigureAwait(false); + var discoveredDevices = await DiscoverDevices(host, TunerDiscoveryDurationMs, cancellationToken).ConfigureAwait(false); list.AddRange(discoveredDevices); } @@ -2567,7 +2569,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV private async Task ScanForTunerDeviceChanges(ITunerHost host, CancellationToken cancellationToken) { - var discoveredDevices = await DiscoverDevices(host, 3000, cancellationToken).ConfigureAwait(false); + var discoveredDevices = await DiscoverDevices(host, TunerDiscoveryDurationMs, cancellationToken).ConfigureAwait(false); var configuredDevices = GetConfiguration().TunerHosts .Where(i => string.Equals(i.Type, host.Type, StringComparison.OrdinalIgnoreCase)) diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index c22bb1171..21c4006a6 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -205,6 +205,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings } programInfo.ShowId = uniqueString.GetMD5().ToString("N"); + + // If we don't have valid episode info, assume it's a unique program, otherwise recordings might be skipped + if (programInfo.IsSeries && !programInfo.IsRepeat) + { + if ((programInfo.EpisodeNumber ?? 0) == 0) + { + programInfo.ShowId = programInfo.ShowId + programInfo.StartDate.Ticks.ToString(CultureInfo.InvariantCulture); + } + } } // Construct an id from the channel and start date -- cgit v1.2.3 From f069559b1e9f27adf3816f7035bf3ee638404862 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 14 Mar 2017 15:44:54 -0400 Subject: update tuner host interface --- .../LiveTv/TunerHosts/BaseTunerHost.cs | 25 +++++++++++++++++++--- .../LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs | 22 ++++++------------- .../LiveTv/TunerHosts/M3UTunerHost.cs | 12 ----------- 3 files changed, 29 insertions(+), 30 deletions(-) (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs index 79fa9bb61..c9cd289e7 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs @@ -135,8 +135,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts { // Check to make sure the tuner is available // If there's only one tuner, don't bother with the check and just let the tuner be the one to throw an error - if (hostsWithChannel.Count > 1 && - !await IsAvailable(host, channelId, cancellationToken).ConfigureAwait(false)) + if (hostsWithChannel.Count > 1 && !await IsAvailable(host, channelId, cancellationToken).ConfigureAwait(false)) { Logger.Error("Tuner is not currently available"); continue; @@ -208,6 +207,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts foreach (var host in hostsWithChannel) { + if (!channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase)) + { + continue; + } + try { var liveStream = await GetChannelStream(host, channelId, streamId, cancellationToken).ConfigureAwait(false); @@ -243,7 +247,22 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts protected abstract Task IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken); - protected abstract bool IsValidChannelId(string channelId); + protected virtual string ChannelIdPrefix + { + get + { + return Type + "_"; + } + } + protected virtual bool IsValidChannelId(string channelId) + { + if (string.IsNullOrWhiteSpace(channelId)) + { + throw new ArgumentNullException("channelId"); + } + + return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); + } protected LiveTvOptions GetConfiguration() { diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 6d6730855..d9c0807de 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -56,7 +56,13 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun get { return "hdhomerun"; } } - private const string ChannelIdPrefix = "hdhr_"; + protected override string ChannelIdPrefix + { + get + { + return "hdhr_"; + } + } private string GetChannelId(TunerHostInfo info, Channels i) { @@ -559,26 +565,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun return list; } - protected override bool IsValidChannelId(string channelId) - { - if (string.IsNullOrWhiteSpace(channelId)) - { - throw new ArgumentNullException("channelId"); - } - - return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); - } - protected override async Task GetChannelStream(TunerHostInfo info, string channelId, string streamId, CancellationToken cancellationToken) { var profile = streamId.Split('_')[0]; Logger.Info("GetChannelStream: channel id: {0}. stream id: {1} profile: {2}", channelId, streamId, profile); - if (!channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase)) - { - throw new ArgumentException("Channel not found"); - } var hdhrId = GetHdHrIdFromChannelId(channelId); var channels = await GetChannels(info, true, CancellationToken.None).ConfigureAwait(false); diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs index cc0ae0983..4ec70f802 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs @@ -46,8 +46,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts get { return "M3U Tuner"; } } - private const string ChannelIdPrefix = "m3u_"; - protected override async Task> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken) { var result = await new M3uParser(Logger, _fileSystem, _httpClient, _appHost).Parse(info.Url, ChannelIdPrefix, info.Id, !info.EnableTvgId, cancellationToken).ConfigureAwait(false); @@ -87,16 +85,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts } } - protected override bool IsValidChannelId(string channelId) - { - if (string.IsNullOrWhiteSpace(channelId)) - { - throw new ArgumentNullException("channelId"); - } - - return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); - } - protected override async Task> GetChannelStreamMediaSources(TunerHostInfo info, string channelId, CancellationToken cancellationToken) { var urlHash = info.Url.GetMD5().ToString("N"); -- cgit v1.2.3 From aaa244be4c3228bfb20e8f20c1c46c8e13472c9d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 14 Mar 2017 15:55:54 -0400 Subject: 3.2.7.5 --- Emby.Server.Implementations/Localization/LocalizationManager.cs | 1 + SharedVersion.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 120f445c2..64a41acef 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -408,6 +408,7 @@ namespace Emby.Server.Implementations.Localization new LocalizatonOption{ Name="Italian", Value="it"}, new LocalizatonOption{ Name="Kazakh", Value="kk"}, new LocalizatonOption{ Name="Norwegian Bokmål", Value="nb"}, + new LocalizatonOption{ Name="Persian", Value="fa"}, new LocalizatonOption{ Name="Polish", Value="pl"}, new LocalizatonOption{ Name="Portuguese (Brazil)", Value="pt-BR"}, new LocalizatonOption{ Name="Portuguese (Portugal)", Value="pt-PT"}, diff --git a/SharedVersion.cs b/SharedVersion.cs index 825a8b919..b001cfb52 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.7.4")] +[assembly: AssemblyVersion("3.2.7.5")] -- cgit v1.2.3