From 832b36562aef04b2c0f6d012920fcf80e0dd080c Mon Sep 17 00:00:00 2001 From: Dominik Date: Mon, 14 Nov 2022 10:11:25 +0100 Subject: Add new options for segment deletion --- MediaBrowser.Model/Configuration/EncodingOptions.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'MediaBrowser.Model/Configuration') diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index f4cd2f0065..c23d4e6422 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -11,7 +11,9 @@ namespace MediaBrowser.Model.Configuration DownMixAudioBoost = 2; MaxMuxingQueueSize = 2048; EnableThrottling = false; + EnableSegmentDeletion = false; ThrottleDelaySeconds = 180; + SegmentKeepSeconds = 200; EncodingThreadCount = -1; // 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 @@ -57,8 +59,12 @@ namespace MediaBrowser.Model.Configuration public bool EnableThrottling { get; set; } + public bool EnableSegmentDeletion { get; set; } + public int ThrottleDelaySeconds { get; set; } + public int SegmentKeepSeconds { get; set; } + public string HardwareAccelerationType { get; set; } /// -- cgit v1.2.3 From 09a1d6786a0cad593cc862d62351a0c5e748497f Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 15 Nov 2022 16:06:24 +0100 Subject: Increase default SegmentKeepSeconds --- MediaBrowser.Model/Configuration/EncodingOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index c23d4e6422..0080506020 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Model.Configuration EnableThrottling = false; EnableSegmentDeletion = false; ThrottleDelaySeconds = 180; - SegmentKeepSeconds = 200; + SegmentKeepSeconds = 360; EncodingThreadCount = -1; // 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 -- cgit v1.2.3 From 0dffe64489f826b91410bddc32ad2ceb1c5cc0d0 Mon Sep 17 00:00:00 2001 From: Dominik Date: Thu, 15 Jun 2023 19:55:11 +0200 Subject: Add baseUrlParam back in and fix indentation --- Jellyfin.Api/Controllers/DynamicHlsController.cs | 9 +++++++++ MediaBrowser.Model/Configuration/EncodingOptions.cs | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs index 86be68004d..9f2088e36e 100644 --- a/Jellyfin.Api/Controllers/DynamicHlsController.cs +++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs @@ -1632,6 +1632,15 @@ public class DynamicHlsController : BaseJellyfinApiController ? _encodingOptions.MaxMuxingQueueSize.ToString(CultureInfo.InvariantCulture) : "128"; + var baseUrlParam = string.Empty; + if (isEventPlaylist) + { + baseUrlParam = string.Format( + CultureInfo.InvariantCulture, + " -hls_base_url \"hls/{0}/\"", + Path.GetFileNameWithoutExtension(outputPath)); + } + var hlsArguments = GetHlsArguments(isEventPlaylist, state.SegmentLength); return string.Format( diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index b5b6e86c8c..f11a43122a 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -103,12 +103,12 @@ public class EncodingOptions /// Gets or sets the delay after which throttling happens. /// public int ThrottleDelaySeconds { get; set; } - + /// /// Gets or sets a value indicating whether segment deletion is enabled. /// public bool EnableSegmentDeletion { get; set; } - + /// /// Gets or sets seconds for which segments should be kept before being deleted. /// -- cgit v1.2.3 From dbe44a591cbc19859161cd6cd7f63dab91110594 Mon Sep 17 00:00:00 2001 From: Dominik Date: Thu, 15 Jun 2023 21:38:45 +0200 Subject: Pick safer default value for segments to keep --- MediaBrowser.Model/Configuration/EncodingOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index f11a43122a..a53be0fee7 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -21,7 +21,7 @@ public class EncodingOptions EnableThrottling = false; ThrottleDelaySeconds = 180; EnableSegmentDeletion = false; - SegmentKeepSeconds = 360; + SegmentKeepSeconds = 720; EncodingThreadCount = -1; // 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 -- cgit v1.2.3 From 1952a915e65a87fa92b3e92c113cc1ab7b845b3e Mon Sep 17 00:00:00 2001 From: Frank Riley Date: Thu, 15 Jun 2023 18:48:52 -0700 Subject: Move hardcoded LibraryUpdateDuration to ServerConfiguration. Fixes #9893. Signed-off-by: Frank Riley --- .../EntryPoints/LibraryChangedNotifier.cs | 23 +++++++++++----------- .../Configuration/ServerConfiguration.cs | 6 ++++++ 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'MediaBrowser.Model/Configuration') diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 2e3988f9eb..be36bbd2c1 100644 --- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Jellyfin.Data.Entities; using Jellyfin.Data.Events; using MediaBrowser.Controller.Channels; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; @@ -26,12 +27,8 @@ namespace Emby.Server.Implementations.EntryPoints { public class LibraryChangedNotifier : IServerEntryPoint { - /// - /// The library update duration. - /// - private const int LibraryUpdateDuration = 30000; - private readonly ILibraryManager _libraryManager; + private readonly IServerConfigurationManager _configurationManager; private readonly IProviderManager _providerManager; private readonly ISessionManager _sessionManager; private readonly IUserManager _userManager; @@ -51,12 +48,14 @@ namespace Emby.Server.Implementations.EntryPoints public LibraryChangedNotifier( ILibraryManager libraryManager, + IServerConfigurationManager configurationManager, ISessionManager sessionManager, IUserManager userManager, ILogger logger, IProviderManager providerManager) { _libraryManager = libraryManager; + _configurationManager = configurationManager; _sessionManager = sessionManager; _userManager = userManager; _logger = logger; @@ -196,12 +195,12 @@ namespace Emby.Server.Implementations.EntryPoints LibraryUpdateTimer = new Timer( LibraryUpdateTimerCallback, null, - LibraryUpdateDuration, - Timeout.Infinite); + TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryUpdateDuration), + Timeout.InfiniteTimeSpan); } else { - LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite); + LibraryUpdateTimer.Change(TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryUpdateDuration), Timeout.InfiniteTimeSpan); } if (e.Item.GetParent() is Folder parent) @@ -229,11 +228,11 @@ namespace Emby.Server.Implementations.EntryPoints { if (LibraryUpdateTimer is null) { - LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite); + LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryUpdateDuration), Timeout.InfiniteTimeSpan); } else { - LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite); + LibraryUpdateTimer.Change(TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryUpdateDuration), Timeout.InfiniteTimeSpan); } _itemsUpdated.Add(e.Item); @@ -256,11 +255,11 @@ namespace Emby.Server.Implementations.EntryPoints { if (LibraryUpdateTimer is null) { - LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite); + LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryUpdateDuration), Timeout.InfiniteTimeSpan); } else { - LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite); + LibraryUpdateTimer.Change(TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryUpdateDuration), Timeout.InfiniteTimeSpan); } if (e.Parent is Folder parent) diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 07f02d1879..8af782b3d5 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -165,6 +165,12 @@ namespace MediaBrowser.Model.Configuration /// The file watcher delay. public int LibraryMonitorDelay { get; set; } = 60; + /// + /// Gets or sets the duration in seconds that we will wait after a library updated event before executing the library changed notification. + /// + /// The library update duration. + public int LibraryUpdateDuration { get; set; } = 30; + /// /// Gets or sets the image saving convention. /// -- cgit v1.2.3