2020-03-05 15:21:27 +00:00
|
|
|
using System;
|
2020-03-05 17:09:33 +00:00
|
|
|
using System.IO;
|
2020-03-05 15:21:27 +00:00
|
|
|
using MediaBrowser.Common.Configuration;
|
|
|
|
using MediaBrowser.Model.Configuration;
|
2020-03-05 17:09:33 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2020-03-05 15:21:27 +00:00
|
|
|
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>
|
|
|
|
/// Updater that takes care of bringing configuration up to 10.5.0 standards.
|
|
|
|
/// </summary>
|
2020-03-05 17:09:33 +00:00
|
|
|
internal class DisableTranscodingThrottling : IUpdater
|
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-03-05 17:09:33 +00:00
|
|
|
public void Perform(CoreAppHost host, ILogger logger)
|
2020-03-05 15:21:27 +00: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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|