jellyfin-server/Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs

33 lines
1.2 KiB
C#
Raw Normal View History

using System;
2020-03-05 17:09:33 +00:00
using System.IO;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
2020-03-05 17:09:33 +00:00
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Server.Migrations.Routines
{
/// <summary>
2020-03-07 19:18:45 +00:00
/// Disable transcode throttling for all installations since it is currently broken for certain video formats.
/// </summary>
2020-03-06 20:51:50 +00:00
internal class DisableTranscodingThrottling : IMigrationRoutine
{
/// <inheritdoc/>
2020-03-05 17:09:33 +00:00
public string Name => "DisableTranscodingThrottling";
/// <inheritdoc/>
2020-03-05 17:09:33 +00:00
public void Perform(CoreAppHost host, ILogger logger)
{
2020-03-07 19:18:45 +00:00
// Set EnableThrottling to false since it wasn't used before and may introduce issues
var encoding = ((IConfigurationManager)host.ServerConfigurationManager).GetConfiguration<EncodingOptions>("encoding");
if (encoding.EnableThrottling)
{
logger.LogInformation("Disabling transcoding throttling during migration");
encoding.EnableThrottling = false;
host.ServerConfigurationManager.SaveConfiguration("encoding", encoding);
}
}
}
}