mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
add transcode temp path migration
This commit is contained in:
parent
97ae93fe5e
commit
98ae564226
@ -250,7 +250,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
protected EncodingQuality GetQualitySetting()
|
protected EncodingQuality GetQualitySetting()
|
||||||
{
|
{
|
||||||
var quality = ApiEntryPoint.Instance.GetEncodingOptions().MediaEncodingQuality;
|
var quality = ApiEntryPoint.Instance.GetEncodingOptions().EncodingQuality;
|
||||||
|
|
||||||
if (quality == EncodingQuality.Auto)
|
if (quality == EncodingQuality.Auto)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
|||||||
UpdateCachePath();
|
UpdateCachePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddParts(IEnumerable<IConfigurationFactory> factories)
|
public virtual void AddParts(IEnumerable<IConfigurationFactory> factories)
|
||||||
{
|
{
|
||||||
_configurationFactories = factories.ToArray();
|
_configurationFactories = factories.ToArray();
|
||||||
|
|
||||||
@ -266,6 +266,11 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
|||||||
XmlSerializer.SerializeToFile(configuration, path);
|
XmlSerializer.SerializeToFile(configuration, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OnNamedConfigurationUpdated(key, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnNamedConfigurationUpdated(string key, object configuration)
|
||||||
|
{
|
||||||
EventHelper.FireEventIfNotNull(NamedConfigurationUpdated, this, new ConfigurationUpdateEventArgs
|
EventHelper.FireEventIfNotNull(NamedConfigurationUpdated, this, new ConfigurationUpdateEventArgs
|
||||||
{
|
{
|
||||||
Key = key,
|
Key = key,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Common.Configuration;
|
using System.Collections.Generic;
|
||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Events;
|
using MediaBrowser.Common.Events;
|
||||||
using MediaBrowser.Common.Implementations.Configuration;
|
using MediaBrowser.Common.Implementations.Configuration;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
@ -75,6 +76,13 @@ namespace MediaBrowser.Server.Implementations.Configuration
|
|||||||
base.OnConfigurationUpdated();
|
base.OnConfigurationUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void AddParts(IEnumerable<IConfigurationFactory> factories)
|
||||||
|
{
|
||||||
|
base.AddParts(factories);
|
||||||
|
|
||||||
|
UpdateTranscodingTempPath();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the items by name path.
|
/// Updates the items by name path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -95,6 +103,28 @@ namespace MediaBrowser.Server.Implementations.Configuration
|
|||||||
Configuration.MetadataPath;
|
Configuration.MetadataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the transcoding temporary path.
|
||||||
|
/// </summary>
|
||||||
|
private void UpdateTranscodingTempPath()
|
||||||
|
{
|
||||||
|
var encodingConfig = this.GetConfiguration<EncodingOptions>("encoding");
|
||||||
|
|
||||||
|
((ServerApplicationPaths)ApplicationPaths).TranscodingTempPath = string.IsNullOrEmpty(encodingConfig.TranscodingTempPath) ?
|
||||||
|
null :
|
||||||
|
encodingConfig.TranscodingTempPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNamedConfigurationUpdated(string key, object configuration)
|
||||||
|
{
|
||||||
|
base.OnNamedConfigurationUpdated(key, configuration);
|
||||||
|
|
||||||
|
if (string.Equals(key, "encoding", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
UpdateTranscodingTempPath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replaces the configuration.
|
/// Replaces the configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -353,12 +353,14 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
|
|
||||||
public override async Task Init(IProgress<double> progress)
|
public override async Task Init(IProgress<double> progress)
|
||||||
{
|
{
|
||||||
PerformVersionMigration();
|
PerformPreInitMigrations();
|
||||||
|
|
||||||
await base.Init(progress).ConfigureAwait(false);
|
await base.Init(progress).ConfigureAwait(false);
|
||||||
|
|
||||||
|
PerformPostInitMigrations();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PerformVersionMigration()
|
private void PerformPreInitMigrations()
|
||||||
{
|
{
|
||||||
var migrations = new List<IVersionMigration>
|
var migrations = new List<IVersionMigration>
|
||||||
{
|
{
|
||||||
@ -375,6 +377,19 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PerformPostInitMigrations()
|
||||||
|
{
|
||||||
|
var migrations = new List<IVersionMigration>
|
||||||
|
{
|
||||||
|
new MigrateTranscodingPath(ServerConfigurationManager)
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var task in migrations)
|
||||||
|
{
|
||||||
|
task.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers resources that classes will depend on
|
/// Registers resources that classes will depend on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
<Compile Include="Migrations\DeleteDlnaProfiles.cs" />
|
<Compile Include="Migrations\DeleteDlnaProfiles.cs" />
|
||||||
<Compile Include="Migrations\DeprecatePlugins.cs" />
|
<Compile Include="Migrations\DeprecatePlugins.cs" />
|
||||||
<Compile Include="Migrations\IVersionMigration.cs" />
|
<Compile Include="Migrations\IVersionMigration.cs" />
|
||||||
|
<Compile Include="Migrations\MigrateTranscodingPath.cs" />
|
||||||
<Compile Include="Migrations\MigrateUserFolders.cs" />
|
<Compile Include="Migrations\MigrateUserFolders.cs" />
|
||||||
<Compile Include="Migrations\RenameXbmcOptions.cs" />
|
<Compile Include="Migrations\RenameXbmcOptions.cs" />
|
||||||
<Compile Include="Migrations\RenameXmlOptions.cs" />
|
<Compile Include="Migrations\RenameXmlOptions.cs" />
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
|
{
|
||||||
|
public class MigrateTranscodingPath : IVersionMigration
|
||||||
|
{
|
||||||
|
private readonly IServerConfigurationManager _config;
|
||||||
|
|
||||||
|
public MigrateTranscodingPath(IServerConfigurationManager config)
|
||||||
|
{
|
||||||
|
_config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(_config.Configuration.TranscodingTempPath))
|
||||||
|
{
|
||||||
|
var newConfig = _config.GetConfiguration<EncodingOptions>("encoding");
|
||||||
|
|
||||||
|
newConfig.TranscodingTempPath = _config.Configuration.TranscodingTempPath;
|
||||||
|
_config.SaveConfiguration("encoding", newConfig);
|
||||||
|
|
||||||
|
_config.Configuration.TranscodingTempPath = null;
|
||||||
|
_config.SaveConfiguration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user