AddDefaultCastReceivers.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using MediaBrowser.Controller.Configuration;
  3. using MediaBrowser.Model.System;
  4. namespace Jellyfin.Server.Migrations.Routines;
  5. /// <summary>
  6. /// Migration to add the default cast receivers to the system config.
  7. /// </summary>
  8. #pragma warning disable CS0618 // Type or member is obsolete
  9. [JellyfinMigration("2025-04-20T16:00:00", nameof(AddDefaultCastReceivers), "34A1A1C4-5572-418E-A2F8-32CDFE2668E8", RunMigrationOnSetup = true)]
  10. public class AddDefaultCastReceivers : IMigrationRoutine
  11. #pragma warning restore CS0618 // Type or member is obsolete
  12. {
  13. private readonly IServerConfigurationManager _serverConfigurationManager;
  14. /// <summary>
  15. /// Initializes a new instance of the <see cref="AddDefaultCastReceivers"/> class.
  16. /// </summary>
  17. /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
  18. public AddDefaultCastReceivers(IServerConfigurationManager serverConfigurationManager)
  19. {
  20. _serverConfigurationManager = serverConfigurationManager;
  21. }
  22. /// <inheritdoc />
  23. public void Perform()
  24. {
  25. _serverConfigurationManager.Configuration.CastReceiverApplications =
  26. [
  27. new()
  28. {
  29. Id = "F007D354",
  30. Name = "Stable"
  31. },
  32. new()
  33. {
  34. Id = "6F511C87",
  35. Name = "Unstable"
  36. }
  37. ];
  38. _serverConfigurationManager.SaveConfiguration();
  39. }
  40. }