diff --git a/Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs index eb3a71465..2c7e6a487 100644 --- a/Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs +++ b/Emby.Server.Core/EntryPoints/ExternalPortForwarding.cs @@ -187,7 +187,10 @@ namespace Emby.Server.Core.EntryPoints private void ClearCreatedRules(object state) { - _createdRules = new List(); + lock (_createdRules) + { + _createdRules.Clear(); + } lock (_usnsHandled) { _usnsHandled.Clear(); @@ -236,16 +239,23 @@ namespace Emby.Server.Core.EntryPoints var address = device.LocalAddress.ToString(); - if (!_createdRules.Contains(address)) + lock (_createdRules) { - _createdRules.Add(address); - - var success = await CreatePortMap(device, _appHost.HttpPort, _config.Configuration.PublicPort).ConfigureAwait(false); - - if (success) + if (!_createdRules.Contains(address)) { - await CreatePortMap(device, _appHost.HttpsPort, _config.Configuration.PublicHttpsPort).ConfigureAwait(false); + _createdRules.Add(address); } + else + { + return; + } + } + + var success = await CreatePortMap(device, _appHost.HttpPort, _config.Configuration.PublicPort).ConfigureAwait(false); + + if (success) + { + await CreatePortMap(device, _appHost.HttpsPort, _config.Configuration.PublicHttpsPort).ConfigureAwait(false); } } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index d5c2ec5d0..7460a9f06 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -67,7 +67,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV private bool CopySubtitles { - get { return string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase); } + get + { + return false; + //return string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase); + } } public string GetOutputPath(MediaSourceInfo mediaSource, string targetFile) diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs index 34d0dd853..073da48a0 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs @@ -298,15 +298,20 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts private string GetTunerChannelId(Dictionary attributes) { - string result; - attributes.TryGetValue("tvg-id", out result); + var values = new List(); - if (string.IsNullOrWhiteSpace(result)) + string result; + if (attributes.TryGetValue("tvg-id", out result)) { - attributes.TryGetValue("channel-id", out result); + values.Add(result); } - return result; + if (attributes.TryGetValue("channel-id", out result)) + { + values.Add(result); + } + + return values.Count == 0 ? null : string.Join("-", values.ToArray()); } private Dictionary ParseExtInf(string line, out string remaining) diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index 24bc5dd11..7af0acc59 100644 --- a/MediaBrowser.Model/Configuration/LibraryOptions.cs +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -14,6 +14,7 @@ public bool EnableInternetProviders { get; set; } public bool ImportMissingEpisodes { get; set; } public bool EnableAutomaticSeriesGrouping { get; set; } + public bool EnableEmbeddedTitles { get; set; } /// /// Gets or sets the preferred metadata language. diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 2270ad65c..bc68b8c98 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -195,8 +195,9 @@ namespace MediaBrowser.Providers.MediaInfo } await AddExternalSubtitles(video, mediaStreams, options, cancellationToken).ConfigureAwait(false); + var libraryOptions = _libraryManager.GetLibraryOptions(video); - FetchEmbeddedInfo(video, mediaInfo, options); + FetchEmbeddedInfo(video, mediaInfo, options, libraryOptions); await FetchPeople(video, mediaInfo, options).ConfigureAwait(false); video.IsHD = mediaStreams.Any(i => i.Type == MediaStreamType.Video && i.Width.HasValue && i.Width.Value >= 1260); @@ -222,7 +223,6 @@ namespace MediaBrowser.Providers.MediaInfo NormalizeChapterNames(chapters); - var libraryOptions = _libraryManager.GetLibraryOptions(video); var extractDuringScan = false; if (libraryOptions != null) { @@ -344,9 +344,9 @@ namespace MediaBrowser.Providers.MediaInfo } } - private void FetchEmbeddedInfo(Video video, Model.MediaInfo.MediaInfo data, MetadataRefreshOptions options) + private void FetchEmbeddedInfo(Video video, Model.MediaInfo.MediaInfo data, MetadataRefreshOptions refreshOptions, LibraryOptions libraryOptions) { - var isFullRefresh = options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh; + var isFullRefresh = refreshOptions.MetadataRefreshMode == MetadataRefreshMode.FullRefresh; if (!video.IsLocked && !video.LockedFields.Contains(MetadataFields.OfficialRating)) { @@ -418,15 +418,12 @@ namespace MediaBrowser.Providers.MediaInfo if (!video.IsLocked && !video.LockedFields.Contains(MetadataFields.Name)) { - if (!string.IsNullOrWhiteSpace(data.Name)) + if (!string.IsNullOrWhiteSpace(data.Name) && libraryOptions.EnableEmbeddedTitles) { - if (string.IsNullOrWhiteSpace(video.Name) || (string.Equals(video.Name, Path.GetFileNameWithoutExtension(video.Path), StringComparison.OrdinalIgnoreCase) && !video.ProviderIds.Any())) + // Don't use the embedded name for extras because it will often be the same name as the movie + if (!video.ExtraType.HasValue && !video.IsOwnedItem) { - // Don't use the embedded name for extras because it will often be the same name as the movie - if (!video.ExtraType.HasValue && !video.IsOwnedItem) - { - video.Name = data.Name; - } + video.Name = data.Name; } } } @@ -481,7 +478,7 @@ namespace MediaBrowser.Providers.MediaInfo /// /// The video. /// The current streams. - /// The options. + /// The refreshOptions. /// The cancellation token. /// Task. private async Task AddExternalSubtitles(Video video, diff --git a/SharedVersion.cs b/SharedVersion.cs index 68d9dc4d4..76ebc0852 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.1.114")] +[assembly: AssemblyVersion("3.2.1.115")]