using System; using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.System; namespace Jellyfin.Server.Migrations.Routines; /// /// Migration to add the default cast receivers to the system config. /// public class AddDefaultCastReceivers : IMigrationRoutine { private readonly IServerConfigurationManager _serverConfigurationManager; /// /// Initializes a new instance of the class. /// /// Instance of the interface. public AddDefaultCastReceivers(IServerConfigurationManager serverConfigurationManager) { _serverConfigurationManager = serverConfigurationManager; } /// public Guid Id => new("34A1A1C4-5572-418E-A2F8-32CDFE2668E8"); /// public string Name => "AddDefaultCastReceivers"; /// public bool PerformOnNewInstall => true; /// 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(); } } }