2020-03-05 16:21:27 +01:00
|
|
|
using System;
|
2020-03-05 18:09:33 +01:00
|
|
|
using System.IO;
|
2020-03-05 16:21:27 +01:00
|
|
|
using MediaBrowser.Common.Configuration;
|
|
|
|
using MediaBrowser.Model.Configuration;
|
2020-03-05 18:09:33 +01:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2020-03-05 16:21:27 +01:00
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
namespace Jellyfin.Server.Migrations
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Updater that takes care of bringing configuration up to 10.5.0 standards.
|
|
|
|
/// </summary>
|
2020-03-05 18:09:33 +01:00
|
|
|
internal class DisableTranscodingThrottling : IUpdater
|
2020-03-05 16:21:27 +01:00
|
|
|
{
|
|
|
|
/// <inheritdoc/>
|
2020-03-05 18:09:33 +01:00
|
|
|
public string Name => "DisableTranscodingThrottling";
|
2020-03-05 16:21:27 +01:00
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2020-03-05 18:09:33 +01:00
|
|
|
public void Perform(CoreAppHost host, ILogger logger)
|
2020-03-05 16:21:27 +01:00
|
|
|
{
|
|
|
|
// Set EnableThrottling to false as it wasn't used before, and in 10.5.0 it 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|