IsAutomated not set on copy

pull/9554/head
nicknsy 2 years ago committed by Nick
parent b18d6bd356
commit 31a858f520

@ -25,6 +25,7 @@ namespace MediaBrowser.Controller.Providers
ForceSave = copy.ForceSave; ForceSave = copy.ForceSave;
ReplaceAllMetadata = copy.ReplaceAllMetadata; ReplaceAllMetadata = copy.ReplaceAllMetadata;
EnableRemoteContentProbe = copy.EnableRemoteContentProbe; EnableRemoteContentProbe = copy.EnableRemoteContentProbe;
IsAutomated = copy.IsAutomated;
IsAutomated = copy.IsAutomated; IsAutomated = copy.IsAutomated;
ImageRefreshMode = copy.ImageRefreshMode; ImageRefreshMode = copy.ImageRefreshMode;

@ -48,7 +48,6 @@ public class EncodingOptions
EnableIntelLowPowerH264HwEncoder = false; EnableIntelLowPowerH264HwEncoder = false;
EnableIntelLowPowerHevcHwEncoder = false; EnableIntelLowPowerHevcHwEncoder = false;
EnableHardwareEncoding = true; EnableHardwareEncoding = true;
EnableTrickplayHwAccel = false;
AllowHevcEncoding = false; AllowHevcEncoding = false;
AllowMjpegEncoding = false; AllowMjpegEncoding = false;
EnableSubtitleExtraction = true; EnableSubtitleExtraction = true;
@ -246,11 +245,6 @@ public class EncodingOptions
/// </summary> /// </summary>
public bool EnableHardwareEncoding { get; set; } 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> /// <summary>
/// Gets or sets a value indicating whether HEVC encoding is enabled. /// Gets or sets a value indicating whether HEVC encoding is enabled.
/// </summary> /// </summary>

@ -36,6 +36,10 @@ namespace MediaBrowser.Model.Configuration
public bool ExtractChapterImagesDuringLibraryScan { get; set; } public bool ExtractChapterImagesDuringLibraryScan { get; set; }
public bool EnableTrickplayImageExtraction { get; set; }
public bool ExtractTrickplayImagesDuringLibraryScan { get; set; }
public MediaPathInfo[] PathInfos { get; set; } public MediaPathInfo[] PathInfos { get; set; }
public bool SaveLocalMetadata { get; set; } public bool SaveLocalMetadata { get; set; }

@ -6,6 +6,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Trickplay; using MediaBrowser.Controller.Trickplay;
@ -26,6 +27,7 @@ namespace MediaBrowser.Providers.Trickplay
private readonly IMediaEncoder _mediaEncoder; private readonly IMediaEncoder _mediaEncoder;
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly EncodingHelper _encodingHelper; private readonly EncodingHelper _encodingHelper;
private readonly ILibraryManager _libraryManager;
private static readonly SemaphoreSlim _resourcePool = new(1, 1); 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="mediaEncoder">The media encoder.</param>
/// <param name="fileSystem">The file systen.</param> /// <param name="fileSystem">The file systen.</param>
/// <param name="encodingHelper">The encoding helper.</param> /// <param name="encodingHelper">The encoding helper.</param>
/// <param name="libraryManager">The library manager.</param>
public TrickplayManager( public TrickplayManager(
ILogger<TrickplayManager> logger, ILogger<TrickplayManager> logger,
IItemRepository itemRepo, IItemRepository itemRepo,
IMediaEncoder mediaEncoder, IMediaEncoder mediaEncoder,
IFileSystem fileSystem, IFileSystem fileSystem,
EncodingHelper encodingHelper) EncodingHelper encodingHelper,
ILibraryManager libraryManager)
{ {
_logger = logger; _logger = logger;
_itemRepo = itemRepo; _itemRepo = itemRepo;
_mediaEncoder = mediaEncoder; _mediaEncoder = mediaEncoder;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_encodingHelper = encodingHelper; _encodingHelper = encodingHelper;
_libraryManager = libraryManager;
} }
/// <inheritdoc /> /// <inheritdoc />
@ -287,11 +292,15 @@ namespace MediaBrowser.Providers.Trickplay
return false; return false;
} }
/* TODO config options if (!video.RunTimeTicks.HasValue || video.RunTimeTicks.Value < TimeSpan.FromMilliseconds(interval).Ticks)
{
return false;
}
var libraryOptions = _libraryManager.GetLibraryOptions(video); var libraryOptions = _libraryManager.GetLibraryOptions(video);
if (libraryOptions is not null) if (libraryOptions is not null)
{ {
if (!libraryOptions.EnableChapterImageExtraction) if (!libraryOptions.EnableTrickplayImageExtraction)
{ {
return false; return false;
} }
@ -300,12 +309,6 @@ namespace MediaBrowser.Providers.Trickplay
{ {
return false; 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 // Can't extract images if there are no video streams
return video.GetMediaStreams().Count > 0; return video.GetMediaStreams().Count > 0;

@ -27,6 +27,7 @@ namespace MediaBrowser.Providers.Trickplay
private readonly ILogger<TrickplayProvider> _logger; private readonly ILogger<TrickplayProvider> _logger;
private readonly IServerConfigurationManager _configurationManager; private readonly IServerConfigurationManager _configurationManager;
private readonly ITrickplayManager _trickplayManager; private readonly ITrickplayManager _trickplayManager;
private readonly ILibraryManager _libraryManager;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="TrickplayProvider"/> class. /// 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="logger">The logger.</param>
/// <param name="configurationManager">The configuration manager.</param> /// <param name="configurationManager">The configuration manager.</param>
/// <param name="trickplayManager">The trickplay manager.</param> /// <param name="trickplayManager">The trickplay manager.</param>
/// <param name="libraryManager">The library manager.</param>
public TrickplayProvider( public TrickplayProvider(
ILogger<TrickplayProvider> logger, ILogger<TrickplayProvider> logger,
IServerConfigurationManager configurationManager, IServerConfigurationManager configurationManager,
ITrickplayManager trickplayManager) ITrickplayManager trickplayManager,
ILibraryManager libraryManager)
{ {
_logger = logger; _logger = logger;
_configurationManager = configurationManager; _configurationManager = configurationManager;
_trickplayManager = trickplayManager; _trickplayManager = trickplayManager;
_libraryManager = libraryManager;
} }
/// <inheritdoc /> /// <inheritdoc />
public string Name => "Trickplay Preview"; public string Name => "Trickplay Provider";
/// <inheritdoc /> /// <inheritdoc />
public int Order => 1000; public int Order => 100;
/// <inheritdoc /> /// <inheritdoc />
public bool HasChanged(BaseItem item, IDirectoryService directoryService) public bool HasChanged(BaseItem item, IDirectoryService directoryService)
@ -95,11 +99,24 @@ namespace MediaBrowser.Providers.Trickplay
return FetchInternal(item, options, cancellationToken); 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 // 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 // The core doesn't need to trigger any save operations over this
return ItemUpdateType.None; return ItemUpdateType.None;

Loading…
Cancel
Save