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="itemId">The item id.</param>
  18. /// <param name="client">The client string.</param>
  19. public DisplayPreferences(Guid userId, Guid itemId, string client)
  20. {
  21. UserId = userId;
  22. ItemId = itemId;
  23. Client = client;
  24. ShowSidebar = false;
  25. ShowBackdrop = true;
  26. SkipForwardLength = 30000;
  27. SkipBackwardLength = 10000;
  28. ScrollDirection = ScrollDirection.Horizontal;
  29. ChromecastVersion = ChromecastVersion.Stable;
  30. HomeSections = new HashSet<HomeSection>();
  31. }
  32. /// <summary>
  33. /// Gets the Id.
  34. /// </summary>
  35. /// <remarks>
  36. /// Required.
  37. /// </remarks>
  38. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  39. public int Id { get; private set; }
  40. /// <summary>
  41. /// Gets or sets the user Id.
  42. /// </summary>
  43. /// <remarks>
  44. /// Required.
  45. /// </remarks>
  46. public Guid UserId { get; set; }
  47. /// <summary>
  48. /// Gets or sets the id of the associated item.
  49. /// </summary>
  50. /// <remarks>
  51. /// Required.
  52. /// </remarks>
  53. public Guid ItemId { get; set; }
  54. /// <summary>
  55. /// Gets or sets the client string.
  56. /// </summary>
  57. /// <remarks>
  58. /// Required. Max Length = 32.
  59. /// </remarks>
  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 the home sections.
  130. /// </summary>
  131. public virtual ICollection<HomeSection> HomeSections { get; private set; }
  132. }
  133. }