diff options
Diffstat (limited to 'Jellyfin.Data')
| -rw-r--r-- | Jellyfin.Data/Entities/DisplayPreferences.cs | 72 | ||||
| -rw-r--r-- | Jellyfin.Data/Entities/HomeSection.cs | 21 | ||||
| -rw-r--r-- | Jellyfin.Data/Entities/User.cs | 5 | ||||
| -rw-r--r-- | Jellyfin.Data/Enums/HomeSectionType.cs | 53 | ||||
| -rw-r--r-- | Jellyfin.Data/Enums/IndexingKind.cs | 20 | ||||
| -rw-r--r-- | Jellyfin.Data/Enums/ScrollDirection.cs | 18 | ||||
| -rw-r--r-- | Jellyfin.Data/Enums/SortOrder.cs | 18 | ||||
| -rw-r--r-- | Jellyfin.Data/Enums/ViewType.cs | 38 |
8 files changed, 245 insertions, 0 deletions
diff --git a/Jellyfin.Data/Entities/DisplayPreferences.cs b/Jellyfin.Data/Entities/DisplayPreferences.cs new file mode 100644 index 000000000..668030149 --- /dev/null +++ b/Jellyfin.Data/Entities/DisplayPreferences.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Jellyfin.Data.Enums; + +namespace Jellyfin.Data.Entities +{ + public class DisplayPreferences + { + public DisplayPreferences(string client, Guid userId) + { + RememberIndexing = false; + ShowBackdrop = true; + Client = client; + UserId = userId; + + HomeSections = new HashSet<HomeSection>(); + } + + protected DisplayPreferences() + { + } + + [Required] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; protected set; } + + [Required] + public Guid UserId { get; set; } + + /// <summary> + /// Gets or sets the id of the associated item. + /// </summary> + /// <remarks> + /// This is currently unused. In the future, this will allow us to have users set + /// display preferences per item. + /// </remarks> + public Guid? ItemId { get; set; } + + [Required] + [MaxLength(64)] + [StringLength(64)] + public string Client { get; set; } + + [Required] + public bool RememberIndexing { get; set; } + + [Required] + public bool RememberSorting { get; set; } + + [Required] + public SortOrder SortOrder { get; set; } + + [Required] + public bool ShowSidebar { get; set; } + + [Required] + public bool ShowBackdrop { get; set; } + + public string SortBy { get; set; } + + public ViewType? ViewType { get; set; } + + [Required] + public ScrollDirection ScrollDirection { get; set; } + + public IndexingKind? IndexBy { get; set; } + + public virtual ICollection<HomeSection> HomeSections { get; protected set; } + } +} diff --git a/Jellyfin.Data/Entities/HomeSection.cs b/Jellyfin.Data/Entities/HomeSection.cs new file mode 100644 index 000000000..f39956a54 --- /dev/null +++ b/Jellyfin.Data/Entities/HomeSection.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Jellyfin.Data.Enums; + +namespace Jellyfin.Data.Entities +{ + public class HomeSection + { + [Key] + [Required] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; protected set; } + + public int DisplayPreferencesId { get; set; } + + public int Order { get; set; } + + public HomeSectionType Type { get; set; } + } +} diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.cs index b89b0a8f4..d93144e3a 100644 --- a/Jellyfin.Data/Entities/User.cs +++ b/Jellyfin.Data/Entities/User.cs @@ -349,6 +349,11 @@ namespace Jellyfin.Data.Entities /// </summary> public virtual ICollection<AccessSchedule> AccessSchedules { get; protected set; } + /// <summary> + /// Gets or sets the list of item display preferences. + /// </summary> + public virtual ICollection<DisplayPreferences> DisplayPreferences { get; protected set; } + /* /// <summary> /// Gets or sets the list of groups this user is a member of. diff --git a/Jellyfin.Data/Enums/HomeSectionType.cs b/Jellyfin.Data/Enums/HomeSectionType.cs new file mode 100644 index 000000000..be764c592 --- /dev/null +++ b/Jellyfin.Data/Enums/HomeSectionType.cs @@ -0,0 +1,53 @@ +namespace Jellyfin.Data.Enums +{ + /// <summary> + /// An enum representing the different options for the home screen sections. + /// </summary> + public enum HomeSectionType + { + /// <summary> + /// My Media. + /// </summary> + SmallLibraryTiles = 0, + + /// <summary> + /// My Media Small. + /// </summary> + LibraryButtons = 1, + + /// <summary> + /// Active Recordings. + /// </summary> + ActiveRecordings = 2, + + /// <summary> + /// Continue Watching. + /// </summary> + Resume = 3, + + /// <summary> + /// Continue Listening. + /// </summary> + ResumeAudio = 4, + + /// <summary> + /// Latest Media. + /// </summary> + LatestMedia = 5, + + /// <summary> + /// Next Up. + /// </summary> + NextUp = 6, + + /// <summary> + /// Live TV. + /// </summary> + LiveTv = 7, + + /// <summary> + /// None. + /// </summary> + None = 8 + } +} diff --git a/Jellyfin.Data/Enums/IndexingKind.cs b/Jellyfin.Data/Enums/IndexingKind.cs new file mode 100644 index 000000000..c4d8e70ca --- /dev/null +++ b/Jellyfin.Data/Enums/IndexingKind.cs @@ -0,0 +1,20 @@ +namespace Jellyfin.Data.Enums +{ + public enum IndexingKind + { + /// <summary> + /// Index by the premiere date. + /// </summary> + PremiereDate, + + /// <summary> + /// Index by the production year. + /// </summary> + ProductionYear, + + /// <summary> + /// Index by the community rating. + /// </summary> + CommunityRating + } +} diff --git a/Jellyfin.Data/Enums/ScrollDirection.cs b/Jellyfin.Data/Enums/ScrollDirection.cs new file mode 100644 index 000000000..382f585ba --- /dev/null +++ b/Jellyfin.Data/Enums/ScrollDirection.cs @@ -0,0 +1,18 @@ +namespace Jellyfin.Data.Enums +{ + /// <summary> + /// An enum representing the axis that should be scrolled. + /// </summary> + public enum ScrollDirection + { + /// <summary> + /// Horizontal scrolling direction. + /// </summary> + Horizontal, + + /// <summary> + /// Vertical scrolling direction. + /// </summary> + Vertical + } +} diff --git a/Jellyfin.Data/Enums/SortOrder.cs b/Jellyfin.Data/Enums/SortOrder.cs new file mode 100644 index 000000000..309fa7877 --- /dev/null +++ b/Jellyfin.Data/Enums/SortOrder.cs @@ -0,0 +1,18 @@ +namespace Jellyfin.Data.Enums +{ + /// <summary> + /// An enum representing the sorting order. + /// </summary> + public enum SortOrder + { + /// <summary> + /// Sort in increasing order. + /// </summary> + Ascending, + + /// <summary> + /// Sort in decreasing order. + /// </summary> + Descending + } +} diff --git a/Jellyfin.Data/Enums/ViewType.cs b/Jellyfin.Data/Enums/ViewType.cs new file mode 100644 index 000000000..595429ab1 --- /dev/null +++ b/Jellyfin.Data/Enums/ViewType.cs @@ -0,0 +1,38 @@ +namespace Jellyfin.Data.Enums +{ + /// <summary> + /// An enum representing the type of view for a library or collection. + /// </summary> + public enum ViewType + { + /// <summary> + /// Shows banners. + /// </summary> + Banner = 0, + + /// <summary> + /// Shows a list of content. + /// </summary> + List = 1, + + /// <summary> + /// Shows poster artwork. + /// </summary> + Poster = 2, + + /// <summary> + /// Shows poster artwork with a card containing the name and year. + /// </summary> + PosterCard = 3, + + /// <summary> + /// Shows a thumbnail. + /// </summary> + Thumb = 4, + + /// <summary> + /// Shows a thumbnail with a card containing the name and year. + /// </summary> + ThumbCard = 5 + } +} |
