2020-03-05 15:21:27 +00:00
|
|
|
using System;
|
|
|
|
using MediaBrowser.Common.Configuration;
|
|
|
|
using MediaBrowser.Model.Configuration;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
2020-03-05 17:40:17 +00:00
|
|
|
namespace Jellyfin.Server.Migrations.Routines
|
2020-03-05 15:21:27 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
2020-03-07 19:18:45 +00:00
|
|
|
/// Disable transcode throttling for all installations since it is currently broken for certain video formats.
|
2020-03-05 15:21:27 +00:00
|
|
|
/// </summary>
|
2020-03-06 20:51:50 +00:00
|
|
|
internal class DisableTranscodingThrottling : IMigrationRoutine
|
2020-03-05 15:21:27 +00:00
|
|
|
{
|
2020-04-17 03:40:32 +00:00
|
|
|
private readonly ILogger _logger;
|
|
|
|
private readonly IConfigurationManager _configManager;
|
|
|
|
|
|
|
|
public DisableTranscodingThrottling(ILogger<DisableTranscodingThrottling> logger, IConfigurationManager configManager)
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
_configManager = configManager;
|
|
|
|
}
|
|
|
|
|
2020-03-08 15:05:31 +00:00
|
|
|
/// <inheritdoc/>
|
|
|
|
public Guid Id => Guid.Parse("{4124C2CD-E939-4FFB-9BE9-9B311C413638}");
|
|
|
|
|
2020-03-05 15:21:27 +00:00
|
|
|
/// <inheritdoc/>
|
2020-03-05 17:09:33 +00:00
|
|
|
public string Name => "DisableTranscodingThrottling";
|
2020-03-05 15:21:27 +00:00
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2020-04-17 03:40:32 +00:00
|
|
|
public void Perform()
|
2020-03-05 15:21:27 +00:00
|
|
|
{
|
2020-03-07 19:18:45 +00:00
|
|
|
// Set EnableThrottling to false since it wasn't used before and may introduce issues
|
2020-04-17 03:40:32 +00:00
|
|
|
var encoding = _configManager.GetConfiguration<EncodingOptions>("encoding");
|
2020-03-05 15:21:27 +00:00
|
|
|
if (encoding.EnableThrottling)
|
|
|
|
{
|
2020-04-17 03:40:32 +00:00
|
|
|
_logger.LogInformation("Disabling transcoding throttling during migration");
|
2020-03-05 15:21:27 +00:00
|
|
|
encoding.EnableThrottling = false;
|
|
|
|
|
2020-04-17 03:40:32 +00:00
|
|
|
_configManager.SaveConfiguration("encoding", encoding);
|
2020-03-05 15:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|