aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicknsy <20588554+nicknsy@users.noreply.github.com>2023-02-23 16:04:35 -0800
committerNick <20588554+nicknsy@users.noreply.github.com>2023-06-22 16:19:59 -0700
commit31a858f52030df85001382ae584e34edb11839ac (patch)
treecb1f5e55e4cd9a4017b0ce72d2227ef2a948dc0e
parentb18d6bd3562a5e5a69f806b461049fbf9f61b70e (diff)
IsAutomated not set on copy
-rw-r--r--MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs1
-rw-r--r--MediaBrowser.Model/Configuration/EncodingOptions.cs6
-rw-r--r--MediaBrowser.Model/Configuration/LibraryOptions.cs4
-rw-r--r--MediaBrowser.Providers/Trickplay/TrickplayManager.cs21
-rw-r--r--MediaBrowser.Providers/Trickplay/TrickplayProvider.cs29
5 files changed, 40 insertions, 21 deletions
diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
index 9e91a8bcd..004c16ba2 100644
--- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
+++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
@@ -25,6 +25,7 @@ namespace MediaBrowser.Controller.Providers
ForceSave = copy.ForceSave;
ReplaceAllMetadata = copy.ReplaceAllMetadata;
EnableRemoteContentProbe = copy.EnableRemoteContentProbe;
+ IsAutomated = copy.IsAutomated;
IsAutomated = copy.IsAutomated;
ImageRefreshMode = copy.ImageRefreshMode;
diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs
index e1d9e00b7..2990cedcd 100644
--- a/MediaBrowser.Model/Configuration/EncodingOptions.cs
+++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs
@@ -48,7 +48,6 @@ public class EncodingOptions
EnableIntelLowPowerH264HwEncoder = false;
EnableIntelLowPowerHevcHwEncoder = false;
EnableHardwareEncoding = true;
- EnableTrickplayHwAccel = false;
AllowHevcEncoding = false;
AllowMjpegEncoding = false;
EnableSubtitleExtraction = true;
@@ -247,11 +246,6 @@ public class EncodingOptions
public bool EnableHardwareEncoding { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether hardware acceleration is enabled for trickplay generation.
- /// </summary>
- public bool EnableTrickplayHwAccel { get; set; }
-
- /// <summary>
/// Gets or sets a value indicating whether HEVC encoding is enabled.
/// </summary>
public bool AllowHevcEncoding { get; set; }
diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs
index df6829946..7718f822b 100644
--- a/MediaBrowser.Model/Configuration/LibraryOptions.cs
+++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs
@@ -36,6 +36,10 @@ namespace MediaBrowser.Model.Configuration
public bool ExtractChapterImagesDuringLibraryScan { get; set; }
+ public bool EnableTrickplayImageExtraction { get; set; }
+
+ public bool ExtractTrickplayImagesDuringLibraryScan { get; set; }
+
public MediaPathInfo[] PathInfos { get; set; }
public bool SaveLocalMetadata { get; set; }
diff --git a/MediaBrowser.Providers/Trickplay/TrickplayManager.cs b/MediaBrowser.Providers/Trickplay/TrickplayManager.cs
index 62180804f..4b4514897 100644
--- a/MediaBrowser.Providers/Trickplay/TrickplayManager.cs
+++ b/MediaBrowser.Providers/Trickplay/TrickplayManager.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Trickplay;
@@ -26,6 +27,7 @@ namespace MediaBrowser.Providers.Trickplay
private readonly IMediaEncoder _mediaEncoder;
private readonly IFileSystem _fileSystem;
private readonly EncodingHelper _encodingHelper;
+ private readonly ILibraryManager _libraryManager;
private static readonly SemaphoreSlim _resourcePool = new(1, 1);
@@ -37,18 +39,21 @@ namespace MediaBrowser.Providers.Trickplay
/// <param name="mediaEncoder">The media encoder.</param>
/// <param name="fileSystem">The file systen.</param>
/// <param name="encodingHelper">The encoding helper.</param>
+ /// <param name="libraryManager">The library manager.</param>
public TrickplayManager(
ILogger<TrickplayManager> logger,
IItemRepository itemRepo,
IMediaEncoder mediaEncoder,
IFileSystem fileSystem,
- EncodingHelper encodingHelper)
+ EncodingHelper encodingHelper,
+ ILibraryManager libraryManager)
{
_logger = logger;
_itemRepo = itemRepo;
_mediaEncoder = mediaEncoder;
_fileSystem = fileSystem;
_encodingHelper = encodingHelper;
+ _libraryManager = libraryManager;
}
/// <inheritdoc />
@@ -287,11 +292,15 @@ namespace MediaBrowser.Providers.Trickplay
return false;
}
- /* TODO config options
+ if (!video.RunTimeTicks.HasValue || video.RunTimeTicks.Value < TimeSpan.FromMilliseconds(interval).Ticks)
+ {
+ return false;
+ }
+
var libraryOptions = _libraryManager.GetLibraryOptions(video);
if (libraryOptions is not null)
{
- if (!libraryOptions.EnableChapterImageExtraction)
+ if (!libraryOptions.EnableTrickplayImageExtraction)
{
return false;
}
@@ -300,12 +309,6 @@ namespace MediaBrowser.Providers.Trickplay
{
return false;
}
- */
-
- if (!video.RunTimeTicks.HasValue || video.RunTimeTicks.Value < TimeSpan.FromMilliseconds(interval).Ticks)
- {
- return false;
- }
// Can't extract images if there are no video streams
return video.GetMediaStreams().Count > 0;
diff --git a/MediaBrowser.Providers/Trickplay/TrickplayProvider.cs b/MediaBrowser.Providers/Trickplay/TrickplayProvider.cs
index be66dea8a..2b3879ca3 100644
--- a/MediaBrowser.Providers/Trickplay/TrickplayProvider.cs
+++ b/MediaBrowser.Providers/Trickplay/TrickplayProvider.cs
@@ -27,6 +27,7 @@ namespace MediaBrowser.Providers.Trickplay
private readonly ILogger<TrickplayProvider> _logger;
private readonly IServerConfigurationManager _configurationManager;
private readonly ITrickplayManager _trickplayManager;
+ private readonly ILibraryManager _libraryManager;
/// <summary>
/// Initializes a new instance of the <see cref="TrickplayProvider"/> class.
@@ -34,21 +35,24 @@ namespace MediaBrowser.Providers.Trickplay
/// <param name="logger">The logger.</param>
/// <param name="configurationManager">The configuration manager.</param>
/// <param name="trickplayManager">The trickplay manager.</param>
+ /// <param name="libraryManager">The library manager.</param>
public TrickplayProvider(
ILogger<TrickplayProvider> logger,
IServerConfigurationManager configurationManager,
- ITrickplayManager trickplayManager)
+ ITrickplayManager trickplayManager,
+ ILibraryManager libraryManager)
{
_logger = logger;
_configurationManager = configurationManager;
_trickplayManager = trickplayManager;
+ _libraryManager = libraryManager;
}
/// <inheritdoc />
- public string Name => "Trickplay Preview";
+ public string Name => "Trickplay Provider";
/// <inheritdoc />
- public int Order => 1000;
+ public int Order => 100;
/// <inheritdoc />
public bool HasChanged(BaseItem item, IDirectoryService directoryService)
@@ -95,11 +99,24 @@ namespace MediaBrowser.Providers.Trickplay
return FetchInternal(item, options, cancellationToken);
}
- private async Task<ItemUpdateType> FetchInternal(Video item, MetadataRefreshOptions options, CancellationToken cancellationToken)
+ private async Task<ItemUpdateType> FetchInternal(Video video, MetadataRefreshOptions options, CancellationToken cancellationToken)
{
- // TODO: implement all config options -->
+ var libraryOptions = _libraryManager.GetLibraryOptions(video);
+ bool? enableDuringScan = libraryOptions?.ExtractTrickplayImagesDuringLibraryScan;
+ bool replace = options.ReplaceAllImages;
+
+ if (options.IsAutomated && !enableDuringScan.GetValueOrDefault(false))
+ {
+ _logger.LogDebug("exit refresh: automated - {0} enable scan - {1}", options.IsAutomated, enableDuringScan.GetValueOrDefault(false));
+ return ItemUpdateType.None;
+ }
+
// TODO: this is always blocking for metadata collection, make non-blocking option
- await _trickplayManager.RefreshTrickplayData(item, options.ReplaceAllImages, cancellationToken).ConfigureAwait(false);
+ if (true)
+ {
+ _logger.LogDebug("called refresh");
+ await _trickplayManager.RefreshTrickplayData(video, replace, cancellationToken).ConfigureAwait(false);
+ }
// The core doesn't need to trigger any save operations over this
return ItemUpdateType.None;