DisplayPreferences.cs 4.7 KB

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