DisplayPreferences.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using Jellyfin.Data.Enums;
  6. namespace Jellyfin.Data.Entities
  7. {
  8. /// <summary>
  9. /// An entity representing a user's display preferences.
  10. /// </summary>
  11. public class DisplayPreferences
  12. {
  13. /// <summary>
  14. /// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
  15. /// </summary>
  16. /// <param name="userId">The user's id.</param>
  17. /// <param name="client">The client string.</param>
  18. public DisplayPreferences(Guid userId, string client)
  19. {
  20. UserId = userId;
  21. Client = client;
  22. ShowSidebar = false;
  23. ShowBackdrop = true;
  24. SkipForwardLength = 30000;
  25. SkipBackwardLength = 10000;
  26. ScrollDirection = ScrollDirection.Horizontal;
  27. ChromecastVersion = ChromecastVersion.Stable;
  28. DashboardTheme = string.Empty;
  29. TvHome = string.Empty;
  30. HomeSections = new HashSet<HomeSection>();
  31. }
  32. /// <summary>
  33. /// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
  34. /// </summary>
  35. protected DisplayPreferences()
  36. {
  37. }
  38. /// <summary>
  39. /// Gets or sets the Id.
  40. /// </summary>
  41. /// <remarks>
  42. /// Required.
  43. /// </remarks>
  44. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  45. public int Id { get; protected set; }
  46. /// <summary>
  47. /// Gets or sets the user Id.
  48. /// </summary>
  49. /// <remarks>
  50. /// Required.
  51. /// </remarks>
  52. public Guid UserId { get; set; }
  53. /// <summary>
  54. /// Gets or sets the client string.
  55. /// </summary>
  56. /// <remarks>
  57. /// Required. Max Length = 32.
  58. /// </remarks>
  59. [Required]
  60. [MaxLength(32)]
  61. [StringLength(32)]
  62. public string Client { get; set; }
  63. /// <summary>
  64. /// Gets or sets a value indicating whether to show the sidebar.
  65. /// </summary>
  66. /// <remarks>
  67. /// Required.
  68. /// </remarks>
  69. public bool ShowSidebar { get; set; }
  70. /// <summary>
  71. /// Gets or sets a value indicating whether to show the backdrop.
  72. /// </summary>
  73. /// <remarks>
  74. /// Required.
  75. /// </remarks>
  76. public bool ShowBackdrop { get; set; }
  77. /// <summary>
  78. /// Gets or sets the scroll direction.
  79. /// </summary>
  80. /// <remarks>
  81. /// Required.
  82. /// </remarks>
  83. public ScrollDirection ScrollDirection { get; set; }
  84. /// <summary>
  85. /// Gets or sets what the view should be indexed by.
  86. /// </summary>
  87. public IndexingKind? IndexBy { get; set; }
  88. /// <summary>
  89. /// Gets or sets the length of time to skip forwards, in milliseconds.
  90. /// </summary>
  91. /// <remarks>
  92. /// Required.
  93. /// </remarks>
  94. public int SkipForwardLength { get; set; }
  95. /// <summary>
  96. /// Gets or sets the length of time to skip backwards, in milliseconds.
  97. /// </summary>
  98. /// <remarks>
  99. /// Required.
  100. /// </remarks>
  101. public int SkipBackwardLength { get; set; }
  102. /// <summary>
  103. /// Gets or sets the Chromecast Version.
  104. /// </summary>
  105. /// <remarks>
  106. /// Required.
  107. /// </remarks>
  108. public ChromecastVersion ChromecastVersion { get; set; }
  109. /// <summary>
  110. /// Gets or sets a value indicating whether the next video info overlay should be shown.
  111. /// </summary>
  112. /// <remarks>
  113. /// Required.
  114. /// </remarks>
  115. public bool EnableNextVideoInfoOverlay { get; set; }
  116. /// <summary>
  117. /// Gets or sets the dashboard theme.
  118. /// </summary>
  119. [MaxLength(32)]
  120. [StringLength(32)]
  121. public string DashboardTheme { get; set; }
  122. /// <summary>
  123. /// Gets or sets the tv home screen.
  124. /// </summary>
  125. [MaxLength(32)]
  126. [StringLength(32)]
  127. public string TvHome { get; set; }
  128. /// <summary>
  129. /// Gets or sets the home sections.
  130. /// </summary>
  131. public virtual ICollection<HomeSection> HomeSections { get; protected set; }
  132. }
  133. }