2
0

AddDefaultCastReceivers.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. public class AddDefaultCastReceivers : IMigrationRoutine
  9. {
  10. private readonly IServerConfigurationManager _serverConfigurationManager;
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="AddDefaultCastReceivers"/> class.
  13. /// </summary>
  14. /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</param>
  15. public AddDefaultCastReceivers(IServerConfigurationManager serverConfigurationManager)
  16. {
  17. _serverConfigurationManager = serverConfigurationManager;
  18. }
  19. /// <inheritdoc />
  20. public Guid Id => new("34A1A1C4-5572-418E-A2F8-32CDFE2668E8");
  21. /// <inheritdoc />
  22. public string Name => "AddDefaultCastReceivers";
  23. /// <inheritdoc />
  24. public bool PerformOnNewInstall => true;
  25. /// <inheritdoc />
  26. public void Perform()
  27. {
  28. _serverConfigurationManager.Configuration.CastReceiverApplications =
  29. [
  30. new()
  31. {
  32. Id = "F007D354",
  33. Name = "Stable"
  34. },
  35. new()
  36. {
  37. Id = "6F511C87",
  38. Name = "Unstable"
  39. }
  40. ];
  41. _serverConfigurationManager.SaveConfiguration();
  42. }
  43. }