diff --git a/Jellyfin.Data/Entities/DisplayPreferences.cs b/Jellyfin.Data/Entities/DisplayPreferences.cs
index bcb872db37..44b70d970c 100644
--- a/Jellyfin.Data/Entities/DisplayPreferences.cs
+++ b/Jellyfin.Data/Entities/DisplayPreferences.cs
@@ -14,14 +14,18 @@ namespace Jellyfin.Data.Entities
///
/// Initializes a new instance of the class.
///
- /// The client string.
/// The user's id.
- public DisplayPreferences(string client, Guid userId)
+ /// The client string.
+ public DisplayPreferences(Guid userId, string client)
{
- RememberIndexing = false;
- ShowBackdrop = true;
- Client = client;
UserId = userId;
+ Client = client;
+ ShowSidebar = false;
+ ShowBackdrop = true;
+ SkipForwardLength = 30000;
+ SkipBackwardLength = 10000;
+ ScrollDirection = ScrollDirection.Horizontal;
+ ChromecastVersion = ChromecastVersion.Stable;
HomeSections = new HashSet();
}
@@ -50,50 +54,17 @@ namespace Jellyfin.Data.Entities
///
public Guid UserId { get; set; }
- ///
- /// Gets or sets the id of the associated item.
- ///
- ///
- /// This is currently unused. In the future, this will allow us to have users set
- /// display preferences per item.
- ///
- public Guid? ItemId { get; set; }
-
///
/// Gets or sets the client string.
///
///
- /// Required. Max Length = 64.
+ /// Required. Max Length = 32.
///
[Required]
- [MaxLength(64)]
- [StringLength(64)]
+ [MaxLength(32)]
+ [StringLength(32)]
public string Client { get; set; }
- ///
- /// Gets or sets a value indicating whether the indexing should be remembered.
- ///
- ///
- /// Required.
- ///
- public bool RememberIndexing { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the sorting type should be remembered.
- ///
- ///
- /// Required.
- ///
- public bool RememberSorting { get; set; }
-
- ///
- /// Gets or sets the sort order.
- ///
- ///
- /// Required.
- ///
- public SortOrder SortOrder { get; set; }
-
///
/// Gets or sets a value indicating whether to show the sidebar.
///
@@ -110,18 +81,6 @@ namespace Jellyfin.Data.Entities
///
public bool ShowBackdrop { get; set; }
- ///
- /// Gets or sets what the view should be sorted by.
- ///
- [MaxLength(64)]
- [StringLength(64)]
- public string SortBy { get; set; }
-
- ///
- /// Gets or sets the view type.
- ///
- public ViewType? ViewType { get; set; }
-
///
/// Gets or sets the scroll direction.
///
diff --git a/Jellyfin.Data/Entities/LibraryDisplayPreferences.cs b/Jellyfin.Data/Entities/LibraryDisplayPreferences.cs
new file mode 100644
index 0000000000..87be1c6f7e
--- /dev/null
+++ b/Jellyfin.Data/Entities/LibraryDisplayPreferences.cs
@@ -0,0 +1,120 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Enums;
+
+namespace Jellyfin.Data.Entities
+{
+ public class LibraryDisplayPreferences
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The user id.
+ /// The item id.
+ /// The client.
+ public LibraryDisplayPreferences(Guid userId, Guid itemId, string client)
+ {
+ UserId = userId;
+ ItemId = itemId;
+ Client = client;
+
+ SortBy = "SortName";
+ ViewType = ViewType.Poster;
+ SortOrder = SortOrder.Ascending;
+ RememberSorting = false;
+ RememberIndexing = false;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ protected LibraryDisplayPreferences()
+ {
+ }
+
+ ///
+ /// Gets or sets the Id.
+ ///
+ ///
+ /// Required.
+ ///
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; protected set; }
+
+ ///
+ /// Gets or sets the user Id.
+ ///
+ ///
+ /// Required.
+ ///
+ public Guid UserId { get; set; }
+
+ ///
+ /// Gets or sets the id of the associated item.
+ ///
+ ///
+ /// Required.
+ ///
+ public Guid ItemId { get; set; }
+
+ ///
+ /// Gets or sets the client string.
+ ///
+ ///
+ /// Required. Max Length = 32.
+ ///
+ [Required]
+ [MaxLength(32)]
+ [StringLength(32)]
+ public string Client { get; set; }
+
+ ///
+ /// Gets or sets the view type.
+ ///
+ ///
+ /// Required.
+ ///
+ public ViewType ViewType { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the indexing should be remembered.
+ ///
+ ///
+ /// Required.
+ ///
+ public bool RememberIndexing { get; set; }
+
+ ///
+ /// Gets or sets what the view should be indexed by.
+ ///
+ public IndexingKind? IndexBy { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the sorting type should be remembered.
+ ///
+ ///
+ /// Required.
+ ///
+ public bool RememberSorting { get; set; }
+
+ ///
+ /// Gets or sets what the view should be sorted by.
+ ///
+ ///
+ /// Required.
+ ///
+ [Required]
+ [MaxLength(64)]
+ [StringLength(64)]
+ public string SortBy { get; set; }
+
+ ///
+ /// Gets or sets the sort order.
+ ///
+ ///
+ /// Required.
+ ///
+ public SortOrder SortOrder { get; set; }
+ }
+}
diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.cs
index d93144e3a5..dc4bd9979c 100644
--- a/Jellyfin.Data/Entities/User.cs
+++ b/Jellyfin.Data/Entities/User.cs
@@ -48,6 +48,7 @@ namespace Jellyfin.Data.Entities
PasswordResetProviderId = passwordResetProviderId;
AccessSchedules = new HashSet();
+ LibraryDisplayPreferences = new HashSet();
// Groups = new HashSet();
Permissions = new HashSet();
Preferences = new HashSet();
@@ -327,6 +328,15 @@ namespace Jellyfin.Data.Entities
// [ForeignKey("UserId")]
public virtual ImageInfo ProfileImage { get; set; }
+ ///
+ /// Gets or sets the user's display preferences.
+ ///
+ ///
+ /// Required.
+ ///
+ [Required]
+ public virtual DisplayPreferences DisplayPreferences { get; set; }
+
[Required]
public SyncPlayAccess SyncPlayAccess { get; set; }
@@ -352,7 +362,7 @@ namespace Jellyfin.Data.Entities
///
/// Gets or sets the list of item display preferences.
///
- public virtual ICollection DisplayPreferences { get; protected set; }
+ public virtual ICollection LibraryDisplayPreferences { get; protected set; }
/*
///