From 39394e74c70f0b8fa9bd4415f6213edbd5ba04fd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 23 Sep 2017 21:03:46 -0400 Subject: fix dlna direct play on samsung tv's --- MediaBrowser.Model/Configuration/EncodingOptions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index a143bb9e3..fbc5e1b37 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -25,7 +25,8 @@ namespace MediaBrowser.Model.Configuration EnableThrottling = true; ThrottleDelaySeconds = 180; EncodingThreadCount = -1; - VaapiDevice = "/dev/dri/card0"; + // This is a DRM device that is almost guaranteed to be there on every intel platform, plus it's the default one in ffmpeg if you don't specify anything + VaapiDevice = "/dev/dri/renderD128"; H264Crf = 23; EnableHardwareEncoding = true; EnableSubtitleExtraction = true; -- cgit v1.2.3 From de5a8d579bbc08be23ea7c3d250f33106d3aabd2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 24 Sep 2017 16:23:56 -0400 Subject: move season zero display name to per library settings --- .../Library/LibraryManager.cs | 53 +--------------------- .../Library/Resolvers/TV/SeasonResolver.cs | 4 +- MediaBrowser.Model/Configuration/LibraryOptions.cs | 3 ++ .../Configuration/ServerConfiguration.cs | 8 ---- MediaBrowser.Model/Dlna/StreamBuilder.cs | 3 +- MediaBrowser.Providers/TV/DummySeasonProvider.cs | 2 +- MediaBrowser.Providers/TV/SeasonMetadataService.cs | 8 ++-- 7 files changed, 13 insertions(+), 68 deletions(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 5871e180e..85b91ac25 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -247,11 +247,6 @@ namespace Emby.Server.Implementations.Library } } - /// - /// The _season zero display name - /// - private string _seasonZeroDisplayName; - private bool _wizardCompleted; /// /// Records the configuration values. @@ -259,7 +254,6 @@ namespace Emby.Server.Implementations.Library /// The configuration. private void RecordConfigurationValues(ServerConfiguration configuration) { - _seasonZeroDisplayName = configuration.SeasonZeroDisplayName; _wizardCompleted = configuration.IsStartupWizardCompleted; } @@ -272,59 +266,14 @@ namespace Emby.Server.Implementations.Library { var config = ConfigurationManager.Configuration; - var newSeasonZeroName = ConfigurationManager.Configuration.SeasonZeroDisplayName; - var seasonZeroNameChanged = !string.Equals(_seasonZeroDisplayName, newSeasonZeroName, StringComparison.Ordinal); var wizardChanged = config.IsStartupWizardCompleted != _wizardCompleted; RecordConfigurationValues(config); - if (seasonZeroNameChanged || wizardChanged) + if (wizardChanged) { _taskManager.CancelIfRunningAndQueue(); } - - if (seasonZeroNameChanged) - { - Task.Run(async () => - { - await UpdateSeasonZeroNames(newSeasonZeroName, CancellationToken.None).ConfigureAwait(false); - - }); - } - } - - /// - /// Updates the season zero names. - /// - /// The new name. - /// The cancellation token. - /// Task. - private async Task UpdateSeasonZeroNames(string newName, CancellationToken cancellationToken) - { - var seasons = GetItemList(new InternalItemsQuery - { - IncludeItemTypes = new[] { typeof(Season).Name }, - Recursive = true, - IndexNumber = 0, - DtoOptions = new DtoOptions(true) - - }).Cast() - .Where(i => !string.Equals(i.Name, newName, StringComparison.Ordinal)) - .ToList(); - - foreach (var season in seasons) - { - season.Name = newName; - - try - { - await UpdateItem(season, ItemUpdateType.MetadataDownload, cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - _logger.ErrorException("Error saving {0}", ex, season.Path); - } - } } public void RegisterItem(BaseItem item) diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs index bbe1bba85..a859d8ec8 100644 --- a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs @@ -55,9 +55,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV if (season.IndexNumber.HasValue) { var seasonNumber = season.IndexNumber.Value; - + season.Name = seasonNumber == 0 ? - _config.Configuration.SeasonZeroDisplayName : + args.LibraryOptions.SeasonZeroDisplayName : string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.ToString(UsCulture)); } diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index 9cd656fa7..07a821baf 100644 --- a/MediaBrowser.Model/Configuration/LibraryOptions.cs +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -30,6 +30,8 @@ /// The metadata country code. public string MetadataCountryCode { get; set; } + public string SeasonZeroDisplayName { get; set; } + public LibraryOptions() { EnablePhotos = true; @@ -37,6 +39,7 @@ PathInfos = new MediaPathInfo[] { }; EnableInternetProviders = true; EnableAutomaticSeriesGrouping = true; + SeasonZeroDisplayName = "Specials"; } } diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index ae04bbaab..7c7358845 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -77,12 +77,6 @@ namespace MediaBrowser.Model.Configuration public string MetadataPath { get; set; } public string MetadataNetworkPath { get; set; } - /// - /// Gets or sets the display name of the season zero. - /// - /// The display name of the season zero. - public string SeasonZeroDisplayName { get; set; } - /// /// Gets or sets the preferred metadata language. /// @@ -239,8 +233,6 @@ namespace MediaBrowser.Model.Configuration SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" }; SortRemoveWords = new[] { "the", "a", "an" }; - SeasonZeroDisplayName = "Specials"; - UICulture = "en-us"; MetadataOptions = new[] diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index be0dd8e8d..3b68db802 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -794,7 +794,8 @@ namespace MediaBrowser.Model.Dlna if (applyConditions) { - foreach (var transcodingVideoCodec in ContainerProfile.SplitValue(transcodingProfile.VideoCodec)) + var transcodingVideoCodecs = ContainerProfile.SplitValue(transcodingProfile.VideoCodec); + foreach (var transcodingVideoCodec in transcodingVideoCodecs) { if (i.ContainsCodec(transcodingVideoCodec, transcodingProfile.Container)) { diff --git a/MediaBrowser.Providers/TV/DummySeasonProvider.cs b/MediaBrowser.Providers/TV/DummySeasonProvider.cs index 791d14b60..de51126ee 100644 --- a/MediaBrowser.Providers/TV/DummySeasonProvider.cs +++ b/MediaBrowser.Providers/TV/DummySeasonProvider.cs @@ -113,7 +113,7 @@ namespace MediaBrowser.Providers.TV CancellationToken cancellationToken) { var seasonName = seasonNumber == 0 ? - _config.Configuration.SeasonZeroDisplayName : + _libraryManager.GetLibraryOptions(series).SeasonZeroDisplayName : (seasonNumber.HasValue ? string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.Value.ToString(_usCulture)) : _localization.GetLocalizedString("NameSeasonUnknown")); _logger.Info("Creating Season {0} entry for {1}", seasonName, series.Name); diff --git a/MediaBrowser.Providers/TV/SeasonMetadataService.cs b/MediaBrowser.Providers/TV/SeasonMetadataService.cs index 4e712d3e3..5e3dc3c62 100644 --- a/MediaBrowser.Providers/TV/SeasonMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeasonMetadataService.cs @@ -8,9 +8,7 @@ using MediaBrowser.Providers.Manager; using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; namespace MediaBrowser.Providers.TV @@ -23,9 +21,11 @@ namespace MediaBrowser.Providers.TV if (item.IndexNumber.HasValue && item.IndexNumber.Value == 0) { - if (!string.Equals(item.Name, ServerConfigurationManager.Configuration.SeasonZeroDisplayName, StringComparison.OrdinalIgnoreCase)) + var seasonZeroDisplayName = LibraryManager.GetLibraryOptions(item).SeasonZeroDisplayName; + + if (!string.Equals(item.Name, seasonZeroDisplayName, StringComparison.OrdinalIgnoreCase)) { - item.Name = ServerConfigurationManager.Configuration.SeasonZeroDisplayName; + item.Name = seasonZeroDisplayName; updateType = updateType | ItemUpdateType.MetadataEdit; } } -- cgit v1.2.3 From 878abbddda4da46811d8709ec90248b9c1b5f569 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 29 Sep 2017 15:17:54 -0400 Subject: fixes #1427 - [Feature Request]: Require Encryption --- Emby.Server.Implementations/ApplicationHost.cs | 4 ++-- .../EntryPoints/ExternalPortForwarding.cs | 2 +- .../HttpServer/HttpListenerHost.cs | 19 +++++++++++++++++++ .../Configuration/ServerConfiguration.cs | 2 ++ 4 files changed, 24 insertions(+), 3 deletions(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 699621043..57c509923 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1931,13 +1931,13 @@ namespace Emby.Server.Implementations { get { - return SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps; + return SupportsHttps && (ServerConfigurationManager.Configuration.EnableHttps || ServerConfigurationManager.Configuration.RequireHttps); } } public bool SupportsHttps { - get { return Certificate != null; } + get { return Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy; } } public async Task GetLocalApiUrl() diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index 9b434d606..2cef46839 100644 --- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.EntryPoints values.Add(config.PublicPort.ToString(CultureInfo.InvariantCulture)); values.Add(_appHost.HttpPort.ToString(CultureInfo.InvariantCulture)); values.Add(_appHost.HttpsPort.ToString(CultureInfo.InvariantCulture)); - values.Add(config.EnableHttps.ToString()); + values.Add((config.EnableHttps || config.RequireHttps).ToString()); values.Add(_appHost.EnableHttps.ToString()); return string.Join("|", values.ToArray(values.Count)); diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 031d1d90b..acc247e45 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -423,6 +423,19 @@ namespace Emby.Server.Implementations.HttpServer return true; } + private bool ValidateSsl(string remoteIp) + { + if (_config.Configuration.RequireHttps && _appHost.EnableHttps) + { + if (!_networkManager.IsInLocalNetwork(remoteIp)) + { + return false; + } + } + + return true; + } + /// /// Overridable method that can be used to implement a custom hnandler /// @@ -453,6 +466,12 @@ namespace Emby.Server.Implementations.HttpServer return; } + if (!ValidateSsl(httpReq.RemoteIp)) + { + RedirectToUrl(httpRes, urlString.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase)); + return; + } + if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase)) { httpRes.StatusCode = 200; diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 7c7358845..f7fffbf79 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -181,6 +181,8 @@ namespace MediaBrowser.Model.Configuration public string[] CodecsUsed { get; set; } public bool EnableChannelView { get; set; } public bool EnableExternalContentInSuggestions { get; set; } + public bool RequireHttps { get; set; } + public bool IsBehindProxy { get; set; } public int ImageExtractionTimeoutMs { get; set; } -- cgit v1.2.3