mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 10:43:30 +01:00
Migrate to customizable cast receiver config
This commit is contained in:
@@ -42,7 +42,8 @@ namespace Jellyfin.Server.Migrations
|
||||
typeof(Routines.RemoveDownloadImagesInAdvance),
|
||||
typeof(Routines.MigrateAuthenticationDb),
|
||||
typeof(Routines.FixPlaylistOwner),
|
||||
typeof(Routines.MigrateRatingLevels)
|
||||
typeof(Routines.MigrateRatingLevels),
|
||||
typeof(Routines.AddDefaultCastReceivers)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Model.System;
|
||||
|
||||
namespace Jellyfin.Server.Migrations.Routines;
|
||||
|
||||
/// <summary>
|
||||
/// Migration to add the default cast receivers to the system config.
|
||||
/// </summary>
|
||||
public class AddDefaultCastReceivers : IMigrationRoutine
|
||||
{
|
||||
private readonly IServerConfigurationManager _serverConfigurationManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AddDefaultCastReceivers"/> class.
|
||||
/// </summary>
|
||||
/// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
|
||||
public AddDefaultCastReceivers(IServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("34A1A1C4-5572-418E-A2F8-32CDFE2668E8");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "AddDefaultCastReceivers";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool PerformOnNewInstall => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Perform()
|
||||
{
|
||||
// Only add if receiver list is empty.
|
||||
if (_serverConfigurationManager.Configuration.CastReceiverApplications.Length == 0)
|
||||
{
|
||||
_serverConfigurationManager.Configuration.CastReceiverApplications = new CastReceiverApplication[]
|
||||
{
|
||||
new()
|
||||
{
|
||||
Id = "F007D354",
|
||||
Name = "Stable"
|
||||
},
|
||||
new()
|
||||
{
|
||||
Id = "6F511C87",
|
||||
Name = "Unstable"
|
||||
}
|
||||
};
|
||||
|
||||
_serverConfigurationManager.SaveConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user