From 5f274beded71a84a28165f5514f1349fd392b3b6 Mon Sep 17 00:00:00 2001 From: Dominik Date: Mon, 14 Nov 2022 10:11:09 +0100 Subject: [PATCH 01/18] Fix logs for TranscodingThrottler not working --- Jellyfin.Api/Helpers/TranscodingJobHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs index c663c6e310..f54f9eadfe 100644 --- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs +++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs @@ -655,7 +655,7 @@ namespace Jellyfin.Api.Helpers { if (EnableThrottling(state)) { - transcodingJob.TranscodingThrottler = new TranscodingThrottler(transcodingJob, new Logger(new LoggerFactory()), _serverConfigurationManager, _fileSystem, _mediaEncoder); + transcodingJob.TranscodingThrottler = new TranscodingThrottler(transcodingJob, _loggerFactory.CreateLogger(), _serverConfigurationManager, _fileSystem, _mediaEncoder); transcodingJob.TranscodingThrottler.Start(); } } From 832b36562aef04b2c0f6d012920fcf80e0dd080c Mon Sep 17 00:00:00 2001 From: Dominik Date: Mon, 14 Nov 2022 10:11:25 +0100 Subject: [PATCH 02/18] Add new options for segment deletion --- MediaBrowser.Model/Configuration/EncodingOptions.cs | 6 ++++++ 1 file changed, 6 insertions(+) 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; } /// From c2c182d099e8f5d77d43af76d7098848ab74c86c Mon Sep 17 00:00:00 2001 From: Dominik Date: Mon, 14 Nov 2022 10:13:17 +0100 Subject: [PATCH 03/18] Add support for ffmpeg's segment deletion and segment wrapping --- .../Controllers/DynamicHlsController.cs | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs index 0f4d3c1ebc..b86f62cf82 100644 --- a/Jellyfin.Api/Controllers/DynamicHlsController.cs +++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs @@ -1503,8 +1503,17 @@ namespace Jellyfin.Api.Controllers // If the playlist doesn't already exist, startup ffmpeg try { - await _transcodingJobHelper.KillTranscodingJobs(streamingRequest.DeviceId, streamingRequest.PlaySessionId, p => false) + if (_encodingOptions.EnableThrottling && _encodingOptions.EnableSegmentDeletion) + { + // Delete old HLS files when segment deletion is active since ffmpeg doesn't clean them up by itself + await _transcodingJobHelper.KillTranscodingJobs(streamingRequest.DeviceId, streamingRequest.PlaySessionId, p => true) .ConfigureAwait(false); + } + else + { + await _transcodingJobHelper.KillTranscodingJobs(streamingRequest.DeviceId, streamingRequest.PlaySessionId, p => false) + .ConfigureAwait(false); + } if (currentTranscodingIndex.HasValue) { @@ -1639,9 +1648,11 @@ namespace Jellyfin.Api.Controllers Path.GetFileNameWithoutExtension(outputPath)); } + var hlsArguments = GetHlsArguments(isEventPlaylist, state.SegmentLength); + return string.Format( CultureInfo.InvariantCulture, - "{0} {1} -map_metadata -1 -map_chapters -1 -threads {2} {3} {4} {5} -copyts -avoid_negative_ts disabled -max_muxing_queue_size {6} -f hls -max_delay 5000000 -hls_time {7} -hls_segment_type {8} -start_number {9}{10} -hls_segment_filename \"{12}\" -hls_playlist_type {11} -hls_list_size 0 -y \"{13}\"", + "{0} {1} -map_metadata -1 -map_chapters -1 -threads {2} {3} {4} {5} -copyts -avoid_negative_ts disabled -max_muxing_queue_size {6} -f hls -max_delay 5000000 -hls_time {7} -hls_segment_type {8} -start_number {9}{10} -hls_segment_filename \"{11}\" {12} -y \"{13}\"", inputModifier, _encodingHelper.GetInputArgument(state, _encodingOptions, segmentContainer), threads, @@ -1653,11 +1664,38 @@ namespace Jellyfin.Api.Controllers segmentFormat, startNumber.ToString(CultureInfo.InvariantCulture), baseUrlParam, - isEventPlaylist ? "event" : "vod", outputTsArg, + hlsArguments, outputPath).Trim(); } + /// + /// Gets the HLS arguments for transcoding. + /// + /// The command line arguments for HLS transcoding. + private string GetHlsArguments(bool isEventPlaylist, int segmentLength) + { + var enableThrottling = _encodingOptions.EnableThrottling; + var enableSegmentDeletion = _encodingOptions.EnableSegmentDeletion; + + // Only enable segment deletion when throttling is enabled + if (enableThrottling && enableSegmentDeletion) + { + // Store enough segments for configured seconds of playback; this needs to be above throttling settings + var segmentCount = _encodingOptions.SegmentKeepSeconds / segmentLength; + + _logger.LogDebug("Using throttling and segment deletion, keeping {0} segments", segmentCount); + + return string.Format(CultureInfo.InvariantCulture, "-hls_list_size {0} -segment_wrap {0} -hls_flags delete_segments", segmentCount.ToString(CultureInfo.InvariantCulture)); + } + else + { + _logger.LogDebug("Using normal playback, is event playlist? {0}", isEventPlaylist); + + return string.Format(CultureInfo.InvariantCulture, "-hls_playlist_type {0} -hls_list_size 0", isEventPlaylist ? "event" : "vod"); + } + } + /// /// Gets the audio arguments for transcoding. /// From 9f4f76b0ab0f3c3e0d7833d37b28f9915cff0549 Mon Sep 17 00:00:00 2001 From: Dominik Date: Mon, 14 Nov 2022 14:39:08 +0100 Subject: [PATCH 04/18] Remove segment wrapping --- Jellyfin.Api/Controllers/DynamicHlsController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs index b86f62cf82..556057a0fd 100644 --- a/Jellyfin.Api/Controllers/DynamicHlsController.cs +++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs @@ -1686,7 +1686,7 @@ namespace Jellyfin.Api.Controllers _logger.LogDebug("Using throttling and segment deletion, keeping {0} segments", segmentCount); - return string.Format(CultureInfo.InvariantCulture, "-hls_list_size {0} -segment_wrap {0} -hls_flags delete_segments", segmentCount.ToString(CultureInfo.InvariantCulture)); + return string.Format(CultureInfo.InvariantCulture, "-hls_list_size {0} -hls_flags delete_segments", segmentCount.ToString(CultureInfo.InvariantCulture)); } else { From abcf9c4819f241be7c80102d7cc80f3b3b27eae2 Mon Sep 17 00:00:00 2001 From: Dominik Date: Mon, 14 Nov 2022 14:45:42 +0100 Subject: [PATCH 05/18] Simplify HLS file deletion Co-authored-by: Claus Vium --- Jellyfin.Api/Controllers/DynamicHlsController.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs index 556057a0fd..8c385761b2 100644 --- a/Jellyfin.Api/Controllers/DynamicHlsController.cs +++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs @@ -1503,17 +1503,10 @@ namespace Jellyfin.Api.Controllers // If the playlist doesn't already exist, startup ffmpeg try { - if (_encodingOptions.EnableThrottling && _encodingOptions.EnableSegmentDeletion) - { - // Delete old HLS files when segment deletion is active since ffmpeg doesn't clean them up by itself - await _transcodingJobHelper.KillTranscodingJobs(streamingRequest.DeviceId, streamingRequest.PlaySessionId, p => true) + // Delete old HLS files when segment deletion is active since ffmpeg doesn't clean them up by itself + var deleteFiles = _encodingOptions.EnableThrottling && _encodingOptions.EnableSegmentDeletion; + await _transcodingJobHelper.KillTranscodingJobs(streamingRequest.DeviceId, streamingRequest.PlaySessionId, _ => deleteFiles) .ConfigureAwait(false); - } - else - { - await _transcodingJobHelper.KillTranscodingJobs(streamingRequest.DeviceId, streamingRequest.PlaySessionId, p => false) - .ConfigureAwait(false); - } if (currentTranscodingIndex.HasValue) { From 87f3bdb918954cbb5c4bdc7408b1ca41b246c83b Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 15 Nov 2022 11:32:58 +0100 Subject: [PATCH 06/18] Do not set different force_key_frames for vod streams --- .../MediaEncoding/EncodingHelper.cs | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index cee08eedac..0ddb3be426 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1272,22 +1272,11 @@ namespace MediaBrowser.Controller.MediaEncoding { var args = string.Empty; var gopArg = string.Empty; - var keyFrameArg = string.Empty; - if (isEventPlaylist) - { - keyFrameArg = string.Format( - CultureInfo.InvariantCulture, - " -force_key_frames:0 \"expr:gte(t,n_forced*{0})\"", - segmentLength); - } - else if (startNumber.HasValue) - { - keyFrameArg = string.Format( - CultureInfo.InvariantCulture, - " -force_key_frames:0 \"expr:gte(t,{0}+n_forced*{1})\"", - startNumber.Value * segmentLength, - segmentLength); - } + + var keyFrameArg = string.Format( + CultureInfo.InvariantCulture, + " -force_key_frames:0 \"expr:gte(t,n_forced*{0})\"", + segmentLength); var framerate = state.VideoStream?.RealFrameRate; if (framerate.HasValue) From 09a1d6786a0cad593cc862d62351a0c5e748497f Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 15 Nov 2022 16:06:24 +0100 Subject: [PATCH 07/18] Increase default SegmentKeepSeconds --- MediaBrowser.Model/Configuration/EncodingOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From e8ae7e5c38e28f13fa8de295e26c930cb46d9b79 Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 15 Nov 2022 17:14:18 +0100 Subject: [PATCH 08/18] Do not delete segments when seeking --- Jellyfin.Api/Controllers/DynamicHlsController.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs index 8c385761b2..81d77663e9 100644 --- a/Jellyfin.Api/Controllers/DynamicHlsController.cs +++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs @@ -1503,9 +1503,7 @@ namespace Jellyfin.Api.Controllers // If the playlist doesn't already exist, startup ffmpeg try { - // Delete old HLS files when segment deletion is active since ffmpeg doesn't clean them up by itself - var deleteFiles = _encodingOptions.EnableThrottling && _encodingOptions.EnableSegmentDeletion; - await _transcodingJobHelper.KillTranscodingJobs(streamingRequest.DeviceId, streamingRequest.PlaySessionId, _ => deleteFiles) + await _transcodingJobHelper.KillTranscodingJobs(streamingRequest.DeviceId, streamingRequest.PlaySessionId, p => false) .ConfigureAwait(false); if (currentTranscodingIndex.HasValue) From 6771b5cabe96b4b3cbd1cd0c998d564f3dd17ed4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 15 Jun 2023 09:37:38 -0600 Subject: [PATCH 09/18] chore(deps): update dependency serilog.sinks.graylog to v3.0.1 (#9892) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 49081399e1..1c3f68a800 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -62,7 +62,7 @@ - + From 0dffe64489f826b91410bddc32ad2ceb1c5cc0d0 Mon Sep 17 00:00:00 2001 From: Dominik Date: Thu, 15 Jun 2023 19:55:11 +0200 Subject: [PATCH 10/18] 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(-) 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. /// From dbe44a591cbc19859161cd6cd7f63dab91110594 Mon Sep 17 00:00:00 2001 From: Dominik Date: Thu, 15 Jun 2023 21:38:45 +0200 Subject: [PATCH 11/18] Pick safer default value for segments to keep --- MediaBrowser.Model/Configuration/EncodingOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From a81f3e7c97ef804bf89d891170e97f9c708a1ea9 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Sun, 18 Jun 2023 09:59:55 +0800 Subject: [PATCH 12/18] Fix #9642 backport Signed-off-by: nyanmisaka --- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 39d53768e9..c5fb4dd683 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -2966,7 +2966,7 @@ namespace MediaBrowser.Controller.MediaEncoding if (string.Equals(hwTonemapSuffix, "vaapi", StringComparison.OrdinalIgnoreCase)) { - args = "procamp_vaapi=b={2}:c={3}," + args + ":extra_hw_frames=32"; + args = "procamp_vaapi=b={1}:c={2},tonemap_vaapi=format={0}:p=bt709:t=bt709:m=bt709:extra_hw_frames=32"; return string.Format( CultureInfo.InvariantCulture, From f81b004d3ffbcf6720d252e7ad54ddf3845dd1af Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Sun, 18 Jun 2023 10:00:53 +0800 Subject: [PATCH 13/18] Removed unused lines Signed-off-by: nyanmisaka --- .../MediaEncoding/EncodingHelper.cs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index c5fb4dd683..26564740d8 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -2975,25 +2975,6 @@ namespace MediaBrowser.Controller.MediaEncoding options.VppTonemappingBrightness, options.VppTonemappingContrast); } - - if (string.Equals(hwTonemapSuffix, "vulkan", StringComparison.OrdinalIgnoreCase)) - { - args = "libplacebo=format={1}:tonemapping={2}:color_primaries=bt709:color_trc=bt709:colorspace=bt709:peak_detect=0:upscaler=none:downscaler=none"; - - if (!string.Equals(options.TonemappingRange, "auto", StringComparison.OrdinalIgnoreCase)) - { - args += ":range={6}"; - } - - if (string.Equals(options.TonemappingAlgorithm, "bt2390", StringComparison.OrdinalIgnoreCase)) - { - algorithm = "bt.2390"; - } - else if (string.Equals(options.TonemappingAlgorithm, "none", StringComparison.OrdinalIgnoreCase)) - { - algorithm = "clip"; - } - } else { args = "tonemap_{0}=format={1}:p=bt709:t=bt709:m=bt709:tonemap={2}:peak={3}:desat={4}"; From 7dec2608fc3762991706d8a4cce61f71fa371e8c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 18 Jun 2023 19:22:57 -0600 Subject: [PATCH 14/18] chore(deps): update dotnet monorepo (#9886) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Cody Robibero --- Directory.Packages.props | 20 ++++++++++---------- deployment/Dockerfile.centos.amd64 | 2 +- deployment/Dockerfile.fedora.amd64 | 2 +- deployment/Dockerfile.ubuntu.amd64 | 2 +- deployment/Dockerfile.ubuntu.arm64 | 2 +- deployment/Dockerfile.ubuntu.armhf | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1c3f68a800..002e0403d0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -23,13 +23,13 @@ - - + + - - - - + + + + @@ -38,11 +38,11 @@ - - + + - + @@ -77,7 +77,7 @@ - + diff --git a/deployment/Dockerfile.centos.amd64 b/deployment/Dockerfile.centos.amd64 index 16bb99a3d0..ee1bc911bb 100644 --- a/deployment/Dockerfile.centos.amd64 +++ b/deployment/Dockerfile.centos.amd64 @@ -13,7 +13,7 @@ RUN yum update -yq \ && yum install -yq @buildsys-build rpmdevtools yum-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel git wget # Install DotNET SDK -RUN wget -q https://download.visualstudio.microsoft.com/download/pr/ebfd0bf8-79bd-480a-9e81-0b217463738d/9adc6bf0614ce02670101e278a2d8555/dotnet-sdk-7.0.203-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget -q https://download.visualstudio.microsoft.com/download/pr/9c86d7b4-acb2-4be4-8a89-d13bc3c3f28f/1d044c7c29df018e8f2837bb343e8a84/dotnet-sdk-7.0.304-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.fedora.amd64 b/deployment/Dockerfile.fedora.amd64 index 8d708f9028..0a2ee7b3f3 100644 --- a/deployment/Dockerfile.fedora.amd64 +++ b/deployment/Dockerfile.fedora.amd64 @@ -12,7 +12,7 @@ RUN dnf update -yq \ && dnf install -yq @buildsys-build rpmdevtools git dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel systemd wget make # Install DotNET SDK -RUN wget -q https://download.visualstudio.microsoft.com/download/pr/ebfd0bf8-79bd-480a-9e81-0b217463738d/9adc6bf0614ce02670101e278a2d8555/dotnet-sdk-7.0.203-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget -q https://download.visualstudio.microsoft.com/download/pr/9c86d7b4-acb2-4be4-8a89-d13bc3c3f28f/1d044c7c29df018e8f2837bb343e8a84/dotnet-sdk-7.0.304-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.ubuntu.amd64 b/deployment/Dockerfile.ubuntu.amd64 index b440a21421..457f28f50c 100644 --- a/deployment/Dockerfile.ubuntu.amd64 +++ b/deployment/Dockerfile.ubuntu.amd64 @@ -17,7 +17,7 @@ RUN apt-get update -yqq \ libfreetype6-dev libssl-dev libssl1.1 liblttng-ust0 # Install dotnet repository -RUN wget -q https://download.visualstudio.microsoft.com/download/pr/ebfd0bf8-79bd-480a-9e81-0b217463738d/9adc6bf0614ce02670101e278a2d8555/dotnet-sdk-7.0.203-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget -q https://download.visualstudio.microsoft.com/download/pr/9c86d7b4-acb2-4be4-8a89-d13bc3c3f28f/1d044c7c29df018e8f2837bb343e8a84/dotnet-sdk-7.0.304-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.ubuntu.arm64 b/deployment/Dockerfile.ubuntu.arm64 index f195d70045..e3f1032a82 100644 --- a/deployment/Dockerfile.ubuntu.arm64 +++ b/deployment/Dockerfile.ubuntu.arm64 @@ -16,7 +16,7 @@ RUN apt-get update -yqq \ mmv build-essential lsb-release # Install dotnet repository -RUN wget -q https://download.visualstudio.microsoft.com/download/pr/ebfd0bf8-79bd-480a-9e81-0b217463738d/9adc6bf0614ce02670101e278a2d8555/dotnet-sdk-7.0.203-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget -q https://download.visualstudio.microsoft.com/download/pr/9c86d7b4-acb2-4be4-8a89-d13bc3c3f28f/1d044c7c29df018e8f2837bb343e8a84/dotnet-sdk-7.0.304-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.ubuntu.armhf b/deployment/Dockerfile.ubuntu.armhf index 0fb59d5ca1..aebcaeccff 100644 --- a/deployment/Dockerfile.ubuntu.armhf +++ b/deployment/Dockerfile.ubuntu.armhf @@ -16,7 +16,7 @@ RUN apt-get update -yqq \ mmv build-essential lsb-release # Install dotnet repository -RUN wget -q https://download.visualstudio.microsoft.com/download/pr/ebfd0bf8-79bd-480a-9e81-0b217463738d/9adc6bf0614ce02670101e278a2d8555/dotnet-sdk-7.0.203-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget -q https://download.visualstudio.microsoft.com/download/pr/9c86d7b4-acb2-4be4-8a89-d13bc3c3f28f/1d044c7c29df018e8f2837bb343e8a84/dotnet-sdk-7.0.304-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet From db15c590e3ec4eade5dc12adb49bf27ab435e1f3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 18 Jun 2023 19:23:06 -0600 Subject: [PATCH 15/18] chore(deps): update github/codeql-action action to v2.20.0 (#9887) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9f1be02327..4173e21046 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -27,11 +27,11 @@ jobs: dotnet-version: '7.0.x' - name: Initialize CodeQL - uses: github/codeql-action/init@83f0fe6c4988d98a455712a27f0255212bba9bd4 # v2.3.6 + uses: github/codeql-action/init@6c089f53dd51dc3fc7e599c3cb5356453a52ca9e # v2.20.0 with: languages: ${{ matrix.language }} queries: +security-extended - name: Autobuild - uses: github/codeql-action/autobuild@83f0fe6c4988d98a455712a27f0255212bba9bd4 # v2.3.6 + uses: github/codeql-action/autobuild@6c089f53dd51dc3fc7e599c3cb5356453a52ca9e # v2.20.0 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@83f0fe6c4988d98a455712a27f0255212bba9bd4 # v2.3.6 + uses: github/codeql-action/analyze@6c089f53dd51dc3fc7e599c3cb5356453a52ca9e # v2.20.0 From dc91d34c6077810295a9e098b8f937418e5ae496 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Mon, 19 Jun 2023 07:56:15 -0600 Subject: [PATCH 16/18] Use intermediate env --- .github/workflows/openapi.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml index ad1cedd52e..f00bb9e9bd 100644 --- a/.github/workflows/openapi.yml +++ b/.github/workflows/openapi.yml @@ -45,10 +45,12 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} fetch-depth: 0 - name: Checkout common ancestor + env: + HEAD_REF: ${{ github.head_ref }} run: | git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }} git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules upstream +refs/heads/*:refs/remotes/upstream/* +refs/tags/*:refs/tags/* - ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/${{ github.head_ref }}) + ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/${{ $HEAD_REF }}) git checkout --progress --force $ANCESTOR_REF - name: Setup .NET uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 From 1952a915e65a87fa92b3e92c113cc1ab7b845b3e Mon Sep 17 00:00:00 2001 From: Frank Riley Date: Thu, 15 Jun 2023 18:48:52 -0700 Subject: [PATCH 17/18] 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(-) 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. /// From 30f6c0a397df25a95b31de517afb3ae89400e84e Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Mon, 19 Jun 2023 08:51:01 -0600 Subject: [PATCH 18/18] Update .github/workflows/openapi.yml Co-authored-by: Jorge <46056498+jorgectf@users.noreply.github.com> --- .github/workflows/openapi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml index f00bb9e9bd..d3dfd0a6aa 100644 --- a/.github/workflows/openapi.yml +++ b/.github/workflows/openapi.yml @@ -50,7 +50,7 @@ jobs: run: | git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }} git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules upstream +refs/heads/*:refs/remotes/upstream/* +refs/tags/*:refs/tags/* - ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/${{ $HEAD_REF }}) + ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/$HEAD_REF) git checkout --progress --force $ANCESTOR_REF - name: Setup .NET uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0