From aa811eb1e3c78bdf8f4a751311c1bb6d639e851e Mon Sep 17 00:00:00 2001 From: JPVenson Date: Sun, 26 Jan 2025 20:45:28 +0000 Subject: Prepared Seperation of Database components for future multi provider support --- Jellyfin.Data/Entities/AccessSchedule.cs | 62 --- Jellyfin.Data/Entities/ActivityLog.cs | 123 ----- Jellyfin.Data/Entities/AncestorId.cs | 29 -- Jellyfin.Data/Entities/AttachmentStreamInfo.cs | 49 -- Jellyfin.Data/Entities/BaseItemEntity.cs | 186 ------- Jellyfin.Data/Entities/BaseItemExtraType.cs | 18 - Jellyfin.Data/Entities/BaseItemImageInfo.cs | 59 --- Jellyfin.Data/Entities/BaseItemMetadataField.cs | 24 - Jellyfin.Data/Entities/BaseItemProvider.cs | 32 -- Jellyfin.Data/Entities/BaseItemTrailerType.cs | 24 - Jellyfin.Data/Entities/Chapter.cs | 44 -- .../Entities/CustomItemDisplayPreferences.cs | 80 --- Jellyfin.Data/Entities/DisplayPreferences.cs | 150 ------ Jellyfin.Data/Entities/Group.cs | 80 --- Jellyfin.Data/Entities/HomeSection.cs | 44 -- Jellyfin.Data/Entities/ImageInfo.cs | 54 --- Jellyfin.Data/Entities/ImageInfoImageType.cs | 76 --- Jellyfin.Data/Entities/ItemDisplayPreferences.cs | 113 ----- Jellyfin.Data/Entities/ItemValue.cs | 37 -- Jellyfin.Data/Entities/ItemValueMap.cs | 30 -- Jellyfin.Data/Entities/ItemValueType.cs | 38 -- Jellyfin.Data/Entities/Libraries/Artwork.cs | 64 --- Jellyfin.Data/Entities/Libraries/Book.cs | 29 -- Jellyfin.Data/Entities/Libraries/BookMetadata.cs | 34 -- Jellyfin.Data/Entities/Libraries/Chapter.cs | 80 --- Jellyfin.Data/Entities/Libraries/Collection.cs | 57 --- Jellyfin.Data/Entities/Libraries/CollectionItem.cs | 64 --- Jellyfin.Data/Entities/Libraries/Company.cs | 54 --- .../Entities/Libraries/CompanyMetadata.cs | 59 --- Jellyfin.Data/Entities/Libraries/CustomItem.cs | 29 -- .../Entities/Libraries/CustomItemMetadata.cs | 17 - Jellyfin.Data/Entities/Libraries/Episode.cs | 34 -- .../Entities/Libraries/EpisodeMetadata.cs | 49 -- Jellyfin.Data/Entities/Libraries/Genre.cs | 50 -- Jellyfin.Data/Entities/Libraries/ItemMetadata.cs | 141 ------ Jellyfin.Data/Entities/Libraries/Library.cs | 60 --- Jellyfin.Data/Entities/Libraries/LibraryItem.cs | 55 --- Jellyfin.Data/Entities/Libraries/MediaFile.cs | 72 --- .../Entities/Libraries/MediaFileStream.cs | 50 -- .../Entities/Libraries/MetadataProvider.cs | 53 -- .../Entities/Libraries/MetadataProviderId.cs | 63 --- Jellyfin.Data/Entities/Libraries/Movie.cs | 29 -- Jellyfin.Data/Entities/Libraries/MovieMetadata.cs | 70 --- Jellyfin.Data/Entities/Libraries/MusicAlbum.cs | 30 -- .../Entities/Libraries/MusicAlbumMetadata.cs | 56 --- Jellyfin.Data/Entities/Libraries/Person.cs | 89 ---- Jellyfin.Data/Entities/Libraries/PersonRole.cs | 80 --- Jellyfin.Data/Entities/Libraries/Photo.cs | 29 -- Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs | 17 - Jellyfin.Data/Entities/Libraries/Rating.cs | 59 --- Jellyfin.Data/Entities/Libraries/RatingSource.cs | 73 --- Jellyfin.Data/Entities/Libraries/Release.cs | 67 --- Jellyfin.Data/Entities/Libraries/Season.cs | 35 -- Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs | 29 -- Jellyfin.Data/Entities/Libraries/Series.cs | 46 -- Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs | 70 --- Jellyfin.Data/Entities/Libraries/Track.cs | 34 -- Jellyfin.Data/Entities/Libraries/TrackMetadata.cs | 17 - Jellyfin.Data/Entities/MediaSegment.cs | 42 -- Jellyfin.Data/Entities/MediaStreamInfo.cs | 103 ---- Jellyfin.Data/Entities/MediaStreamTypeEntity.cs | 37 -- Jellyfin.Data/Entities/People.cs | 32 -- Jellyfin.Data/Entities/PeopleBaseItemMap.cs | 44 -- Jellyfin.Data/Entities/Permission.cs | 68 --- Jellyfin.Data/Entities/Preference.cs | 68 --- Jellyfin.Data/Entities/ProgramAudioEntity.cs | 37 -- Jellyfin.Data/Entities/Security/ApiKey.cs | 56 --- Jellyfin.Data/Entities/Security/Device.cs | 107 ----- Jellyfin.Data/Entities/Security/DeviceOptions.cs | 35 -- Jellyfin.Data/Entities/TrickplayInfo.cs | 75 --- Jellyfin.Data/Entities/User.cs | 534 --------------------- Jellyfin.Data/Entities/UserData.cs | 92 ---- Jellyfin.Data/Enums/ArtKind.cs | 33 -- Jellyfin.Data/Enums/ChromecastVersion.cs | 18 - Jellyfin.Data/Enums/DynamicDayOfWeek.cs | 58 --- Jellyfin.Data/Enums/HomeSectionType.cs | 58 --- Jellyfin.Data/Enums/IndexingKind.cs | 23 - Jellyfin.Data/Enums/MediaFileKind.cs | 33 -- Jellyfin.Data/Enums/MediaSegmentType.cs | 39 -- Jellyfin.Data/Enums/PermissionKind.cs | 128 ----- Jellyfin.Data/Enums/PersonRoleType.cs | 68 --- Jellyfin.Data/Enums/PreferenceKind.cs | 73 --- Jellyfin.Data/Enums/ScrollDirection.cs | 18 - Jellyfin.Data/Enums/SortOrder.cs | 18 - Jellyfin.Data/Enums/SubtitlePlaybackMode.cs | 33 -- Jellyfin.Data/Enums/SyncPlayUserAccessType.cs | 23 - Jellyfin.Data/Enums/ViewType.cs | 113 ----- Jellyfin.Data/Interfaces/IHasArtwork.cs | 16 - Jellyfin.Data/Interfaces/IHasCompanies.cs | 16 - Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs | 18 - Jellyfin.Data/Interfaces/IHasPermissions.cs | 31 -- Jellyfin.Data/Interfaces/IHasReleases.cs | 16 - Jellyfin.Data/Jellyfin.Data.csproj | 4 + Jellyfin.Data/UserEntityExtensions.cs | 220 +++++++++ 94 files changed, 224 insertions(+), 5459 deletions(-) delete mode 100644 Jellyfin.Data/Entities/AccessSchedule.cs delete mode 100644 Jellyfin.Data/Entities/ActivityLog.cs delete mode 100644 Jellyfin.Data/Entities/AncestorId.cs delete mode 100644 Jellyfin.Data/Entities/AttachmentStreamInfo.cs delete mode 100644 Jellyfin.Data/Entities/BaseItemEntity.cs delete mode 100644 Jellyfin.Data/Entities/BaseItemExtraType.cs delete mode 100644 Jellyfin.Data/Entities/BaseItemImageInfo.cs delete mode 100644 Jellyfin.Data/Entities/BaseItemMetadataField.cs delete mode 100644 Jellyfin.Data/Entities/BaseItemProvider.cs delete mode 100644 Jellyfin.Data/Entities/BaseItemTrailerType.cs delete mode 100644 Jellyfin.Data/Entities/Chapter.cs delete mode 100644 Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs delete mode 100644 Jellyfin.Data/Entities/DisplayPreferences.cs delete mode 100644 Jellyfin.Data/Entities/Group.cs delete mode 100644 Jellyfin.Data/Entities/HomeSection.cs delete mode 100644 Jellyfin.Data/Entities/ImageInfo.cs delete mode 100644 Jellyfin.Data/Entities/ImageInfoImageType.cs delete mode 100644 Jellyfin.Data/Entities/ItemDisplayPreferences.cs delete mode 100644 Jellyfin.Data/Entities/ItemValue.cs delete mode 100644 Jellyfin.Data/Entities/ItemValueMap.cs delete mode 100644 Jellyfin.Data/Entities/ItemValueType.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Artwork.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Book.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/BookMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Chapter.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Collection.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/CollectionItem.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Company.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/CustomItem.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Episode.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Genre.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/ItemMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Library.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/LibraryItem.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/MediaFile.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/MediaFileStream.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/MetadataProvider.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Movie.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/MovieMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/MusicAlbum.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Person.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/PersonRole.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Photo.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Rating.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/RatingSource.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Release.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Season.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Series.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/Track.cs delete mode 100644 Jellyfin.Data/Entities/Libraries/TrackMetadata.cs delete mode 100644 Jellyfin.Data/Entities/MediaSegment.cs delete mode 100644 Jellyfin.Data/Entities/MediaStreamInfo.cs delete mode 100644 Jellyfin.Data/Entities/MediaStreamTypeEntity.cs delete mode 100644 Jellyfin.Data/Entities/People.cs delete mode 100644 Jellyfin.Data/Entities/PeopleBaseItemMap.cs delete mode 100644 Jellyfin.Data/Entities/Permission.cs delete mode 100644 Jellyfin.Data/Entities/Preference.cs delete mode 100644 Jellyfin.Data/Entities/ProgramAudioEntity.cs delete mode 100644 Jellyfin.Data/Entities/Security/ApiKey.cs delete mode 100644 Jellyfin.Data/Entities/Security/Device.cs delete mode 100644 Jellyfin.Data/Entities/Security/DeviceOptions.cs delete mode 100644 Jellyfin.Data/Entities/TrickplayInfo.cs delete mode 100644 Jellyfin.Data/Entities/User.cs delete mode 100644 Jellyfin.Data/Entities/UserData.cs delete mode 100644 Jellyfin.Data/Enums/ArtKind.cs delete mode 100644 Jellyfin.Data/Enums/ChromecastVersion.cs delete mode 100644 Jellyfin.Data/Enums/DynamicDayOfWeek.cs delete mode 100644 Jellyfin.Data/Enums/HomeSectionType.cs delete mode 100644 Jellyfin.Data/Enums/IndexingKind.cs delete mode 100644 Jellyfin.Data/Enums/MediaFileKind.cs delete mode 100644 Jellyfin.Data/Enums/MediaSegmentType.cs delete mode 100644 Jellyfin.Data/Enums/PermissionKind.cs delete mode 100644 Jellyfin.Data/Enums/PersonRoleType.cs delete mode 100644 Jellyfin.Data/Enums/PreferenceKind.cs delete mode 100644 Jellyfin.Data/Enums/ScrollDirection.cs delete mode 100644 Jellyfin.Data/Enums/SortOrder.cs delete mode 100644 Jellyfin.Data/Enums/SubtitlePlaybackMode.cs delete mode 100644 Jellyfin.Data/Enums/SyncPlayUserAccessType.cs delete mode 100644 Jellyfin.Data/Enums/ViewType.cs delete mode 100644 Jellyfin.Data/Interfaces/IHasArtwork.cs delete mode 100644 Jellyfin.Data/Interfaces/IHasCompanies.cs delete mode 100644 Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs delete mode 100644 Jellyfin.Data/Interfaces/IHasPermissions.cs delete mode 100644 Jellyfin.Data/Interfaces/IHasReleases.cs create mode 100644 Jellyfin.Data/UserEntityExtensions.cs (limited to 'Jellyfin.Data') diff --git a/Jellyfin.Data/Entities/AccessSchedule.cs b/Jellyfin.Data/Entities/AccessSchedule.cs deleted file mode 100644 index f534e49f3..000000000 --- a/Jellyfin.Data/Entities/AccessSchedule.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations.Schema; -using System.Xml.Serialization; -using Jellyfin.Data.Enums; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity representing a user's access schedule. - /// - public class AccessSchedule - { - /// - /// Initializes a new instance of the class. - /// - /// The day of the week. - /// The start hour. - /// The end hour. - /// The associated user's id. - public AccessSchedule(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId) - { - UserId = userId; - DayOfWeek = dayOfWeek; - StartHour = startHour; - EndHour = endHour; - } - - /// - /// Gets the id of this instance. - /// - /// - /// Identity, Indexed, Required. - /// - [XmlIgnore] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets the id of the associated user. - /// - [XmlIgnore] - public Guid UserId { get; private set; } - - /// - /// Gets or sets the day of week. - /// - /// The day of week. - public DynamicDayOfWeek DayOfWeek { get; set; } - - /// - /// Gets or sets the start hour. - /// - /// The start hour. - public double StartHour { get; set; } - - /// - /// Gets or sets the end hour. - /// - /// The end hour. - public double EndHour { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/ActivityLog.cs b/Jellyfin.Data/Entities/ActivityLog.cs deleted file mode 100644 index 51dd0ffb8..000000000 --- a/Jellyfin.Data/Entities/ActivityLog.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; -using Microsoft.Extensions.Logging; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity referencing an activity log entry. - /// - public class ActivityLog : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// Public constructor with required data. - /// - /// The name. - /// The type. - /// The user id. - public ActivityLog(string name, string type, Guid userId) - { - ArgumentException.ThrowIfNullOrEmpty(name); - ArgumentException.ThrowIfNullOrEmpty(type); - - Name = name; - Type = type; - UserId = userId; - DateCreated = DateTime.UtcNow; - LogSeverity = LogLevel.Information; - } - - /// - /// Gets the identity of this instance. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Required, Max length = 512. - /// - [MaxLength(512)] - [StringLength(512)] - public string Name { get; set; } - - /// - /// Gets or sets the overview. - /// - /// - /// Max length = 512. - /// - [MaxLength(512)] - [StringLength(512)] - public string? Overview { get; set; } - - /// - /// Gets or sets the short overview. - /// - /// - /// Max length = 512. - /// - [MaxLength(512)] - [StringLength(512)] - public string? ShortOverview { get; set; } - - /// - /// Gets or sets the type. - /// - /// - /// Required, Max length = 256. - /// - [MaxLength(256)] - [StringLength(256)] - public string Type { get; set; } - - /// - /// Gets or sets the user id. - /// - /// - /// Required. - /// - public Guid UserId { get; set; } - - /// - /// Gets or sets the item id. - /// - /// - /// Max length = 256. - /// - [MaxLength(256)] - [StringLength(256)] - public string? ItemId { get; set; } - - /// - /// Gets or sets the date created. This should be in UTC. - /// - /// - /// Required. - /// - public DateTime DateCreated { get; set; } - - /// - /// Gets or sets the log severity. Default is . - /// - /// - /// Required. - /// - public LogLevel LogSeverity { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/AncestorId.cs b/Jellyfin.Data/Entities/AncestorId.cs deleted file mode 100644 index ef0fe0ba7..000000000 --- a/Jellyfin.Data/Entities/AncestorId.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace Jellyfin.Data.Entities; - -/// -/// Represents the relational informations for an . -/// -public class AncestorId -{ - /// - /// Gets or Sets the AncestorId. - /// - public required Guid ParentItemId { get; set; } - - /// - /// Gets or Sets the related BaseItem. - /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets the ParentItem. - /// - public required BaseItemEntity ParentItem { get; set; } - - /// - /// Gets or Sets the Child item. - /// - public required BaseItemEntity Item { get; set; } -} diff --git a/Jellyfin.Data/Entities/AttachmentStreamInfo.cs b/Jellyfin.Data/Entities/AttachmentStreamInfo.cs deleted file mode 100644 index 77b627f37..000000000 --- a/Jellyfin.Data/Entities/AttachmentStreamInfo.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; - -namespace Jellyfin.Data.Entities; - -/// -/// Provides informations about an Attachment to an . -/// -public class AttachmentStreamInfo -{ - /// - /// Gets or Sets the reference. - /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets the reference. - /// - public required BaseItemEntity Item { get; set; } - - /// - /// Gets or Sets The index within the source file. - /// - public required int Index { get; set; } - - /// - /// Gets or Sets the codec of the attachment. - /// - public required string Codec { get; set; } - - /// - /// Gets or Sets the codec tag of the attachment. - /// - public string? CodecTag { get; set; } - - /// - /// Gets or Sets the comment of the attachment. - /// - public string? Comment { get; set; } - - /// - /// Gets or Sets the filename of the attachment. - /// - public string? Filename { get; set; } - - /// - /// Gets or Sets the attachments mimetype. - /// - public string? MimeType { get; set; } -} diff --git a/Jellyfin.Data/Entities/BaseItemEntity.cs b/Jellyfin.Data/Entities/BaseItemEntity.cs deleted file mode 100644 index 33b2b6741..000000000 --- a/Jellyfin.Data/Entities/BaseItemEntity.cs +++ /dev/null @@ -1,186 +0,0 @@ -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member -#pragma warning disable CA2227 // Collection properties should be read only - -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Jellyfin.Data.Entities; - -public class BaseItemEntity -{ - public required Guid Id { get; set; } - - public required string Type { get; set; } - - public string? Data { get; set; } - - public string? Path { get; set; } - - public DateTime StartDate { get; set; } - - public DateTime EndDate { get; set; } - - public string? ChannelId { get; set; } - - public bool IsMovie { get; set; } - - public float? CommunityRating { get; set; } - - public string? CustomRating { get; set; } - - public int? IndexNumber { get; set; } - - public bool IsLocked { get; set; } - - public string? Name { get; set; } - - public string? OfficialRating { get; set; } - - public string? MediaType { get; set; } - - public string? Overview { get; set; } - - public int? ParentIndexNumber { get; set; } - - public DateTime? PremiereDate { get; set; } - - public int? ProductionYear { get; set; } - - public string? Genres { get; set; } - - public string? SortName { get; set; } - - public string? ForcedSortName { get; set; } - - public long? RunTimeTicks { get; set; } - - public DateTime? DateCreated { get; set; } - - public DateTime? DateModified { get; set; } - - public bool IsSeries { get; set; } - - public string? EpisodeTitle { get; set; } - - public bool IsRepeat { get; set; } - - public string? PreferredMetadataLanguage { get; set; } - - public string? PreferredMetadataCountryCode { get; set; } - - public DateTime? DateLastRefreshed { get; set; } - - public DateTime? DateLastSaved { get; set; } - - public bool IsInMixedFolder { get; set; } - - public string? Studios { get; set; } - - public string? ExternalServiceId { get; set; } - - public string? Tags { get; set; } - - public bool IsFolder { get; set; } - - public int? InheritedParentalRatingValue { get; set; } - - public string? UnratedType { get; set; } - - public float? CriticRating { get; set; } - - public string? CleanName { get; set; } - - public string? PresentationUniqueKey { get; set; } - - public string? OriginalTitle { get; set; } - - public string? PrimaryVersionId { get; set; } - - public DateTime? DateLastMediaAdded { get; set; } - - public string? Album { get; set; } - - public float? LUFS { get; set; } - - public float? NormalizationGain { get; set; } - - public bool IsVirtualItem { get; set; } - - public string? SeriesName { get; set; } - - public string? SeasonName { get; set; } - - public string? ExternalSeriesId { get; set; } - - public string? Tagline { get; set; } - - public string? ProductionLocations { get; set; } - - public string? ExtraIds { get; set; } - - public int? TotalBitrate { get; set; } - - public BaseItemExtraType? ExtraType { get; set; } - - public string? Artists { get; set; } - - public string? AlbumArtists { get; set; } - - public string? ExternalId { get; set; } - - public string? SeriesPresentationUniqueKey { get; set; } - - public string? ShowId { get; set; } - - public string? OwnerId { get; set; } - - public int? Width { get; set; } - - public int? Height { get; set; } - - public long? Size { get; set; } - - public ProgramAudioEntity? Audio { get; set; } - - public Guid? ParentId { get; set; } - - public Guid? TopParentId { get; set; } - - public Guid? SeasonId { get; set; } - - public Guid? SeriesId { get; set; } - - public ICollection? Peoples { get; set; } - - public ICollection? UserData { get; set; } - - public ICollection? ItemValues { get; set; } - - public ICollection? MediaStreams { get; set; } - - public ICollection? Chapters { get; set; } - - public ICollection? Provider { get; set; } - - public ICollection? ParentAncestors { get; set; } - - public ICollection? Children { get; set; } - - public ICollection? LockedFields { get; set; } - - public ICollection? TrailerTypes { get; set; } - - public ICollection? Images { get; set; } - - // those are references to __LOCAL__ ids not DB ids ... TODO: Bring the whole folder structure into the DB - // public ICollection? SeriesEpisodes { get; set; } - // public BaseItemEntity? Series { get; set; } - // public BaseItemEntity? Season { get; set; } - // public BaseItemEntity? Parent { get; set; } - // public ICollection? DirectChildren { get; set; } - // public BaseItemEntity? TopParent { get; set; } - // public ICollection? AllChildren { get; set; } - // public ICollection? SeasonEpisodes { get; set; } -} diff --git a/Jellyfin.Data/Entities/BaseItemExtraType.cs b/Jellyfin.Data/Entities/BaseItemExtraType.cs deleted file mode 100644 index 54aef50e4..000000000 --- a/Jellyfin.Data/Entities/BaseItemExtraType.cs +++ /dev/null @@ -1,18 +0,0 @@ -#pragma warning disable CS1591 -namespace Jellyfin.Data.Entities; - -public enum BaseItemExtraType -{ - Unknown = 0, - Clip = 1, - Trailer = 2, - BehindTheScenes = 3, - DeletedScene = 4, - Interview = 5, - Scene = 6, - Sample = 7, - ThemeSong = 8, - ThemeVideo = 9, - Featurette = 10, - Short = 11 -} diff --git a/Jellyfin.Data/Entities/BaseItemImageInfo.cs b/Jellyfin.Data/Entities/BaseItemImageInfo.cs deleted file mode 100644 index 37723df11..000000000 --- a/Jellyfin.Data/Entities/BaseItemImageInfo.cs +++ /dev/null @@ -1,59 +0,0 @@ -#pragma warning disable CA2227 - -using System; -using System.Collections.Generic; - -namespace Jellyfin.Data.Entities; - -/// -/// Enum TrailerTypes. -/// -public class BaseItemImageInfo -{ - /// - /// Gets or Sets. - /// - public required Guid Id { get; set; } - - /// - /// Gets or Sets the path to the original image. - /// - public required string Path { get; set; } - - /// - /// Gets or Sets the time the image was last modified. - /// - public DateTime DateModified { get; set; } - - /// - /// Gets or Sets the imagetype. - /// - public ImageInfoImageType ImageType { get; set; } - - /// - /// Gets or Sets the width of the original image. - /// - public int Width { get; set; } - - /// - /// Gets or Sets the height of the original image. - /// - public int Height { get; set; } - -#pragma warning disable CA1819 // Properties should not return arrays - /// - /// Gets or Sets the blurhash. - /// - public byte[]? Blurhash { get; set; } -#pragma warning restore CA1819 - - /// - /// Gets or Sets the reference id to the BaseItem. - /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets the referenced Item. - /// - public required BaseItemEntity Item { get; set; } -} diff --git a/Jellyfin.Data/Entities/BaseItemMetadataField.cs b/Jellyfin.Data/Entities/BaseItemMetadataField.cs deleted file mode 100644 index c9d44c046..000000000 --- a/Jellyfin.Data/Entities/BaseItemMetadataField.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace Jellyfin.Data.Entities; - -/// -/// Enum MetadataFields. -/// -public class BaseItemMetadataField -{ - /// - /// Gets or Sets Numerical ID of this enumeratable. - /// - public required int Id { get; set; } - - /// - /// Gets or Sets all referenced . - /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets all referenced . - /// - public required BaseItemEntity Item { get; set; } -} diff --git a/Jellyfin.Data/Entities/BaseItemProvider.cs b/Jellyfin.Data/Entities/BaseItemProvider.cs deleted file mode 100644 index 9a1565728..000000000 --- a/Jellyfin.Data/Entities/BaseItemProvider.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Jellyfin.Data.Entities; - -/// -/// Represents a Key-Value relation of an BaseItem's provider. -/// -public class BaseItemProvider -{ - /// - /// Gets or Sets the reference ItemId. - /// - public Guid ItemId { get; set; } - - /// - /// Gets or Sets the reference BaseItem. - /// - public required BaseItemEntity Item { get; set; } - - /// - /// Gets or Sets the ProvidersId. - /// - public required string ProviderId { get; set; } - - /// - /// Gets or Sets the Providers Value. - /// - public required string ProviderValue { get; set; } -} diff --git a/Jellyfin.Data/Entities/BaseItemTrailerType.cs b/Jellyfin.Data/Entities/BaseItemTrailerType.cs deleted file mode 100644 index fb31fc8a4..000000000 --- a/Jellyfin.Data/Entities/BaseItemTrailerType.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace Jellyfin.Data.Entities; - -/// -/// Enum TrailerTypes. -/// -public class BaseItemTrailerType -{ - /// - /// Gets or Sets Numerical ID of this enumeratable. - /// - public required int Id { get; set; } - - /// - /// Gets or Sets all referenced . - /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets all referenced . - /// - public required BaseItemEntity Item { get; set; } -} diff --git a/Jellyfin.Data/Entities/Chapter.cs b/Jellyfin.Data/Entities/Chapter.cs deleted file mode 100644 index 579442cdb..000000000 --- a/Jellyfin.Data/Entities/Chapter.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace Jellyfin.Data.Entities; - -/// -/// The Chapter entity. -/// -public class Chapter -{ - /// - /// Gets or Sets the reference id. - /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets the reference. - /// - public required BaseItemEntity Item { get; set; } - - /// - /// Gets or Sets the chapters index in Item. - /// - public required int ChapterIndex { get; set; } - - /// - /// Gets or Sets the position within the source file. - /// - public required long StartPositionTicks { get; set; } - - /// - /// Gets or Sets the common name. - /// - public string? Name { get; set; } - - /// - /// Gets or Sets the image path. - /// - public string? ImagePath { get; set; } - - /// - /// Gets or Sets the time the image was last modified. - /// - public DateTime? ImageDateModified { get; set; } -} diff --git a/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs b/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs deleted file mode 100644 index a60659512..000000000 --- a/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity that represents a user's custom display preferences for a specific item. - /// - public class CustomItemDisplayPreferences - { - /// - /// Initializes a new instance of the class. - /// - /// The user id. - /// The item id. - /// The client. - /// The preference key. - /// The preference value. - public CustomItemDisplayPreferences(Guid userId, Guid itemId, string client, string key, string? value) - { - UserId = userId; - ItemId = itemId; - Client = client; - Key = key; - Value = value; - } - - /// - /// Gets the Id. - /// - /// - /// Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private 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. - /// - [MaxLength(32)] - [StringLength(32)] - public string Client { get; set; } - - /// - /// Gets or sets the preference key. - /// - /// - /// Required. - /// - public string Key { get; set; } - - /// - /// Gets or sets the preference value. - /// - /// - /// Required. - /// - public string? Value { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/DisplayPreferences.cs b/Jellyfin.Data/Entities/DisplayPreferences.cs deleted file mode 100644 index f0be65769..000000000 --- a/Jellyfin.Data/Entities/DisplayPreferences.cs +++ /dev/null @@ -1,150 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity representing a user's display preferences. - /// - public class DisplayPreferences - { - /// - /// Initializes a new instance of the class. - /// - /// The user's id. - /// The item id. - /// The client string. - public DisplayPreferences(Guid userId, Guid itemId, string client) - { - UserId = userId; - ItemId = itemId; - Client = client; - ShowSidebar = false; - ShowBackdrop = true; - SkipForwardLength = 30000; - SkipBackwardLength = 10000; - ScrollDirection = ScrollDirection.Horizontal; - ChromecastVersion = ChromecastVersion.Stable; - - HomeSections = new HashSet(); - } - - /// - /// Gets the Id. - /// - /// - /// Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private 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. - /// - [MaxLength(32)] - [StringLength(32)] - public string Client { get; set; } - - /// - /// Gets or sets a value indicating whether to show the sidebar. - /// - /// - /// Required. - /// - public bool ShowSidebar { get; set; } - - /// - /// Gets or sets a value indicating whether to show the backdrop. - /// - /// - /// Required. - /// - public bool ShowBackdrop { get; set; } - - /// - /// Gets or sets the scroll direction. - /// - /// - /// Required. - /// - public ScrollDirection ScrollDirection { get; set; } - - /// - /// Gets or sets what the view should be indexed by. - /// - public IndexingKind? IndexBy { get; set; } - - /// - /// Gets or sets the length of time to skip forwards, in milliseconds. - /// - /// - /// Required. - /// - public int SkipForwardLength { get; set; } - - /// - /// Gets or sets the length of time to skip backwards, in milliseconds. - /// - /// - /// Required. - /// - public int SkipBackwardLength { get; set; } - - /// - /// Gets or sets the Chromecast Version. - /// - /// - /// Required. - /// - public ChromecastVersion ChromecastVersion { get; set; } - - /// - /// Gets or sets a value indicating whether the next video info overlay should be shown. - /// - /// - /// Required. - /// - public bool EnableNextVideoInfoOverlay { get; set; } - - /// - /// Gets or sets the dashboard theme. - /// - [MaxLength(32)] - [StringLength(32)] - public string? DashboardTheme { get; set; } - - /// - /// Gets or sets the tv home screen. - /// - [MaxLength(32)] - [StringLength(32)] - public string? TvHome { get; set; } - - /// - /// Gets the home sections. - /// - public virtual ICollection HomeSections { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Group.cs b/Jellyfin.Data/Entities/Group.cs deleted file mode 100644 index 1be6f986a..000000000 --- a/Jellyfin.Data/Entities/Group.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using Jellyfin.Data.Enums; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity representing a group. - /// - public class Group : IHasPermissions, IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The name of the group. - public Group(string name) - { - ArgumentException.ThrowIfNullOrEmpty(name); - - Name = name; - Id = Guid.NewGuid(); - - Permissions = new HashSet(); - Preferences = new HashSet(); - } - - /// - /// Gets the id of this group. - /// - /// - /// Identity, Indexed, Required. - /// - public Guid Id { get; private set; } - - /// - /// Gets or sets the group's name. - /// - /// - /// Required, Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string Name { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets a collection containing the group's permissions. - /// - public virtual ICollection Permissions { get; private set; } - - /// - /// Gets a collection containing the group's preferences. - /// - public virtual ICollection Preferences { get; private set; } - - /// - public bool HasPermission(PermissionKind kind) - { - return Permissions.First(p => p.Kind == kind).Value; - } - - /// - public void SetPermission(PermissionKind kind, bool value) - { - Permissions.First(p => p.Kind == kind).Value = value; - } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/HomeSection.cs b/Jellyfin.Data/Entities/HomeSection.cs deleted file mode 100644 index 8dd6e647e..000000000 --- a/Jellyfin.Data/Entities/HomeSection.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity representing a section on the user's home page. - /// - public class HomeSection - { - /// - /// Gets the id. - /// - /// - /// Identity. Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the Id of the associated display preferences. - /// - /// - /// Required. - /// - public int DisplayPreferencesId { get; set; } - - /// - /// Gets or sets the order. - /// - /// - /// Required. - /// - public int Order { get; set; } - - /// - /// Gets or sets the type. - /// - /// - /// Required. - /// - public HomeSectionType Type { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/ImageInfo.cs b/Jellyfin.Data/Entities/ImageInfo.cs deleted file mode 100644 index 935a53a26..000000000 --- a/Jellyfin.Data/Entities/ImageInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity representing an image. - /// - public class ImageInfo - { - /// - /// Initializes a new instance of the class. - /// - /// The path. - public ImageInfo(string path) - { - Path = path; - LastModified = DateTime.UtcNow; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets the user id. - /// - public Guid? UserId { get; private set; } - - /// - /// Gets or sets the path of the image. - /// - /// - /// Required. - /// - [MaxLength(512)] - [StringLength(512)] - public string Path { get; set; } - - /// - /// Gets or sets the date last modified. - /// - /// - /// Required. - /// - public DateTime LastModified { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/ImageInfoImageType.cs b/Jellyfin.Data/Entities/ImageInfoImageType.cs deleted file mode 100644 index f78178dd2..000000000 --- a/Jellyfin.Data/Entities/ImageInfoImageType.cs +++ /dev/null @@ -1,76 +0,0 @@ -namespace Jellyfin.Data.Entities; - -/// -/// Enum ImageType. -/// -public enum ImageInfoImageType -{ - /// - /// The primary. - /// - Primary = 0, - - /// - /// The art. - /// - Art = 1, - - /// - /// The backdrop. - /// - Backdrop = 2, - - /// - /// The banner. - /// - Banner = 3, - - /// - /// The logo. - /// - Logo = 4, - - /// - /// The thumb. - /// - Thumb = 5, - - /// - /// The disc. - /// - Disc = 6, - - /// - /// The box. - /// - Box = 7, - - /// - /// The screenshot. - /// - /// - /// This enum value is obsolete. - /// XmlSerializer does not serialize/deserialize objects that are marked as [Obsolete]. - /// - Screenshot = 8, - - /// - /// The menu. - /// - Menu = 9, - - /// - /// The chapter image. - /// - Chapter = 10, - - /// - /// The box rear. - /// - BoxRear = 11, - - /// - /// The user profile image. - /// - Profile = 12 -} diff --git a/Jellyfin.Data/Entities/ItemDisplayPreferences.cs b/Jellyfin.Data/Entities/ItemDisplayPreferences.cs deleted file mode 100644 index 93e6664ea..000000000 --- a/Jellyfin.Data/Entities/ItemDisplayPreferences.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity that represents a user's display preferences for a specific item. - /// - public class ItemDisplayPreferences - { - /// - /// Initializes a new instance of the class. - /// - /// The user id. - /// The item id. - /// The client. - public ItemDisplayPreferences(Guid userId, Guid itemId, string client) - { - UserId = userId; - ItemId = itemId; - Client = client; - - SortBy = "SortName"; - SortOrder = SortOrder.Ascending; - RememberSorting = false; - RememberIndexing = false; - } - - /// - /// Gets the id. - /// - /// - /// Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private 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. - /// - [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. - /// - [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/ItemValue.cs b/Jellyfin.Data/Entities/ItemValue.cs deleted file mode 100644 index 7b1048c10..000000000 --- a/Jellyfin.Data/Entities/ItemValue.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Jellyfin.Data.Entities; - -/// -/// Represents an ItemValue for a BaseItem. -/// -public class ItemValue -{ - /// - /// Gets or Sets the ItemValueId. - /// - public required Guid ItemValueId { get; set; } - - /// - /// Gets or Sets the Type. - /// - public required ItemValueType Type { get; set; } - - /// - /// Gets or Sets the Value. - /// - public required string Value { get; set; } - - /// - /// Gets or Sets the sanatised Value. - /// - public required string CleanValue { get; set; } - - /// - /// Gets or Sets all associated BaseItems. - /// -#pragma warning disable CA2227 // Collection properties should be read only - public ICollection? BaseItemsMap { get; set; } -#pragma warning restore CA2227 // Collection properties should be read only -} diff --git a/Jellyfin.Data/Entities/ItemValueMap.cs b/Jellyfin.Data/Entities/ItemValueMap.cs deleted file mode 100644 index 94db6a011..000000000 --- a/Jellyfin.Data/Entities/ItemValueMap.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Jellyfin.Data.Entities; - -/// -/// Mapping table for the ItemValue BaseItem relation. -/// -public class ItemValueMap -{ - /// - /// Gets or Sets the ItemId. - /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets the ItemValueId. - /// - public required Guid ItemValueId { get; set; } - - /// - /// Gets or Sets the referenced . - /// - public required BaseItemEntity Item { get; set; } - - /// - /// Gets or Sets the referenced . - /// - public required ItemValue ItemValue { get; set; } -} diff --git a/Jellyfin.Data/Entities/ItemValueType.cs b/Jellyfin.Data/Entities/ItemValueType.cs deleted file mode 100644 index 3bae3becc..000000000 --- a/Jellyfin.Data/Entities/ItemValueType.cs +++ /dev/null @@ -1,38 +0,0 @@ -#pragma warning disable CA1027 // Mark enums with FlagsAttribute -namespace Jellyfin.Data.Entities; - -/// -/// Provides the Value types for an . -/// -public enum ItemValueType -{ - /// - /// Artists. - /// - Artist = 0, - - /// - /// Album. - /// - AlbumArtist = 1, - - /// - /// Genre. - /// - Genre = 2, - - /// - /// Studios. - /// - Studios = 3, - - /// - /// Tags. - /// - Tags = 4, - - /// - /// InheritedTags. - /// - InheritedTags = 6, -} diff --git a/Jellyfin.Data/Entities/Libraries/Artwork.cs b/Jellyfin.Data/Entities/Libraries/Artwork.cs deleted file mode 100644 index fc3c1036f..000000000 --- a/Jellyfin.Data/Entities/Libraries/Artwork.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing artwork. - /// - public class Artwork : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The path. - /// The kind of art. - public Artwork(string path, ArtKind kind) - { - ArgumentException.ThrowIfNullOrEmpty(path); - - Path = path; - Kind = kind; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the path. - /// - /// - /// Required, Max length = 65535. - /// - [MaxLength(65535)] - [StringLength(65535)] - public string Path { get; set; } - - /// - /// Gets or sets the kind of artwork. - /// - /// - /// Required. - /// - public ArtKind Kind { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Book.cs b/Jellyfin.Data/Entities/Libraries/Book.cs deleted file mode 100644 index a838686d0..000000000 --- a/Jellyfin.Data/Entities/Libraries/Book.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a book. - /// - public class Book : LibraryItem, IHasReleases - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public Book(Library library) : base(library) - { - BookMetadata = new HashSet(); - Releases = new HashSet(); - } - - /// - /// Gets a collection containing the metadata for this book. - /// - public virtual ICollection BookMetadata { get; private set; } - - /// - public virtual ICollection Releases { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs deleted file mode 100644 index 4a350d200..000000000 --- a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity containing metadata for a book. - /// - public class BookMetadata : ItemMetadata, IHasCompanies - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the object. - /// ISO-639-3 3-character language codes. - public BookMetadata(string title, string language) : base(title, language) - { - Publishers = new HashSet(); - } - - /// - /// Gets or sets the ISBN. - /// - public long? Isbn { get; set; } - - /// - /// Gets a collection of the publishers for this book. - /// - public virtual ICollection Publishers { get; private set; } - - /// - public ICollection Companies => Publishers; - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Chapter.cs b/Jellyfin.Data/Entities/Libraries/Chapter.cs deleted file mode 100644 index f068338f9..000000000 --- a/Jellyfin.Data/Entities/Libraries/Chapter.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a chapter. - /// - public class Chapter : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// ISO-639-3 3-character language codes. - /// The start time for this chapter. - public Chapter(string language, long startTime) - { - ArgumentException.ThrowIfNullOrEmpty(language); - - Language = language; - StartTime = startTime; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Name { get; set; } - - /// - /// Gets or sets the language. - /// - /// - /// Required, Min length = 3, Max length = 3 - /// ISO-639-3 3-character language codes. - /// - [MinLength(3)] - [MaxLength(3)] - [StringLength(3)] - public string Language { get; set; } - - /// - /// Gets or sets the start time. - /// - /// - /// Required. - /// - public long StartTime { get; set; } - - /// - /// Gets or sets the end time. - /// - public long? EndTime { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Collection.cs b/Jellyfin.Data/Entities/Libraries/Collection.cs deleted file mode 100644 index 7de601969..000000000 --- a/Jellyfin.Data/Entities/Libraries/Collection.cs +++ /dev/null @@ -1,57 +0,0 @@ -#pragma warning disable CA1711 // Identifiers should not have incorrect suffix - -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a collection. - /// - public class Collection : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - public Collection() - { - Items = new HashSet(); - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Name { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets a collection containing this collection's items. - /// - public virtual ICollection Items { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs b/Jellyfin.Data/Entities/Libraries/CollectionItem.cs deleted file mode 100644 index 0cb4716db..000000000 --- a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a collection item. - /// - public class CollectionItem : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The library item. - public CollectionItem(LibraryItem libraryItem) - { - LibraryItem = libraryItem; - } - - /// - /// Gets or sets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets or sets the library item. - /// - /// - /// Required. - /// - public virtual LibraryItem LibraryItem { get; set; } - - /// - /// Gets or sets the next item in the collection. - /// - /// - /// TODO check if this properly updated Dependant and has the proper principal relationship. - /// - public virtual CollectionItem? Next { get; set; } - - /// - /// Gets or sets the previous item in the collection. - /// - /// - /// TODO check if this properly updated Dependant and has the proper principal relationship. - /// - public virtual CollectionItem? Previous { get; set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Company.cs b/Jellyfin.Data/Entities/Libraries/Company.cs deleted file mode 100644 index 1abbee445..000000000 --- a/Jellyfin.Data/Entities/Libraries/Company.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a company. - /// - public class Company : IHasCompanies, IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - public Company() - { - CompanyMetadata = new HashSet(); - ChildCompanies = new HashSet(); - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets a collection containing the metadata. - /// - public virtual ICollection CompanyMetadata { get; private set; } - - /// - /// Gets a collection containing this company's child companies. - /// - public virtual ICollection ChildCompanies { get; private set; } - - /// - public ICollection Companies => ChildCompanies; - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs b/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs deleted file mode 100644 index a29f08c7f..000000000 --- a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity holding metadata for a . - /// - public class CompanyMetadata : ItemMetadata - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the object. - /// ISO-639-3 3-character language codes. - public CompanyMetadata(string title, string language) : base(title, language) - { - } - - /// - /// Gets or sets the description. - /// - /// - /// Max length = 65535. - /// - [MaxLength(65535)] - [StringLength(65535)] - public string? Description { get; set; } - - /// - /// Gets or sets the headquarters. - /// - /// - /// Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string? Headquarters { get; set; } - - /// - /// Gets or sets the country code. - /// - /// - /// Max length = 2. - /// - [MaxLength(2)] - [StringLength(2)] - public string? Country { get; set; } - - /// - /// Gets or sets the homepage. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Homepage { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/CustomItem.cs b/Jellyfin.Data/Entities/Libraries/CustomItem.cs deleted file mode 100644 index e27d01d86..000000000 --- a/Jellyfin.Data/Entities/Libraries/CustomItem.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a custom item. - /// - public class CustomItem : LibraryItem, IHasReleases - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public CustomItem(Library library) : base(library) - { - CustomItemMetadata = new HashSet(); - Releases = new HashSet(); - } - - /// - /// Gets a collection containing the metadata for this item. - /// - public virtual ICollection CustomItemMetadata { get; private set; } - - /// - public virtual ICollection Releases { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs b/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs deleted file mode 100644 index af2393870..000000000 --- a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity containing metadata for a custom item. - /// - public class CustomItemMetadata : ItemMetadata - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the object. - /// ISO-639-3 3-character language codes. - public CustomItemMetadata(string title, string language) : base(title, language) - { - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Episode.cs b/Jellyfin.Data/Entities/Libraries/Episode.cs deleted file mode 100644 index ce2f0c617..000000000 --- a/Jellyfin.Data/Entities/Libraries/Episode.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing an episode. - /// - public class Episode : LibraryItem, IHasReleases - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public Episode(Library library) : base(library) - { - Releases = new HashSet(); - EpisodeMetadata = new HashSet(); - } - - /// - /// Gets or sets the episode number. - /// - public int? EpisodeNumber { get; set; } - - /// - public virtual ICollection Releases { get; private set; } - - /// - /// Gets a collection containing the metadata for this episode. - /// - public virtual ICollection EpisodeMetadata { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs b/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs deleted file mode 100644 index b0ef11e0f..000000000 --- a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity containing metadata for an . - /// - public class EpisodeMetadata : ItemMetadata - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the object. - /// ISO-639-3 3-character language codes. - public EpisodeMetadata(string title, string language) : base(title, language) - { - } - - /// - /// Gets or sets the outline. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Outline { get; set; } - - /// - /// Gets or sets the plot. - /// - /// - /// Max length = 65535. - /// - [MaxLength(65535)] - [StringLength(65535)] - public string? Plot { get; set; } - - /// - /// Gets or sets the tagline. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Tagline { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Genre.cs b/Jellyfin.Data/Entities/Libraries/Genre.cs deleted file mode 100644 index 3b822ee82..000000000 --- a/Jellyfin.Data/Entities/Libraries/Genre.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a genre. - /// - public class Genre : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The name. - public Genre(string name) - { - Name = name; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Indexed, Required, Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string Name { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs b/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs deleted file mode 100644 index fa9276c66..000000000 --- a/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An abstract class that holds metadata. - /// - public abstract class ItemMetadata : IHasArtwork, IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the object. - /// ISO-639-3 3-character language codes. - protected ItemMetadata(string title, string language) - { - ArgumentException.ThrowIfNullOrEmpty(title); - ArgumentException.ThrowIfNullOrEmpty(language); - - Title = title; - Language = language; - DateAdded = DateTime.UtcNow; - DateModified = DateAdded; - - PersonRoles = new HashSet(); - Genres = new HashSet(); - Artwork = new HashSet(); - Ratings = new HashSet(); - Sources = new HashSet(); - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the title. - /// - /// - /// Required, Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string Title { get; set; } - - /// - /// Gets or sets the original title. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? OriginalTitle { get; set; } - - /// - /// Gets or sets the sort title. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? SortTitle { get; set; } - - /// - /// Gets or sets the language. - /// - /// - /// Required, Min length = 3, Max length = 3. - /// ISO-639-3 3-character language codes. - /// - [MinLength(3)] - [MaxLength(3)] - [StringLength(3)] - public string Language { get; set; } - - /// - /// Gets or sets the release date. - /// - public DateTimeOffset? ReleaseDate { get; set; } - - /// - /// Gets the date added. - /// - /// - /// Required. - /// - public DateTime DateAdded { get; private set; } - - /// - /// Gets or sets the date modified. - /// - /// - /// Required. - /// - public DateTime DateModified { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets a collection containing the person roles for this item. - /// - public virtual ICollection PersonRoles { get; private set; } - - /// - /// Gets a collection containing the genres for this item. - /// - public virtual ICollection Genres { get; private set; } - - /// - public virtual ICollection Artwork { get; private set; } - - /// - /// Gets a collection containing the ratings for this item. - /// - public virtual ICollection Ratings { get; private set; } - - /// - /// Gets a collection containing the metadata sources for this item. - /// - public virtual ICollection Sources { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Library.cs b/Jellyfin.Data/Entities/Libraries/Library.cs deleted file mode 100644 index 0db42a1c7..000000000 --- a/Jellyfin.Data/Entities/Libraries/Library.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a library. - /// - public class Library : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The name of the library. - /// The path of the library. - public Library(string name, string path) - { - Name = name; - Path = path; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Required, Max length = 128. - /// - [MaxLength(128)] - [StringLength(128)] - public string Name { get; set; } - - /// - /// Gets or sets the root path of the library. - /// - /// - /// Required. - /// - public string Path { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs b/Jellyfin.Data/Entities/Libraries/LibraryItem.cs deleted file mode 100644 index d889b871e..000000000 --- a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a library item. - /// - public abstract class LibraryItem : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The library of this item. - protected LibraryItem(Library library) - { - DateAdded = DateTime.UtcNow; - Library = library; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets the date this library item was added. - /// - public DateTime DateAdded { get; private set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets or sets the library of this item. - /// - /// - /// Required. - /// - public virtual Library Library { get; set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/MediaFile.cs b/Jellyfin.Data/Entities/Libraries/MediaFile.cs deleted file mode 100644 index 7b5a3af64..000000000 --- a/Jellyfin.Data/Entities/Libraries/MediaFile.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a file on disk. - /// - public class MediaFile : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The path relative to the LibraryRoot. - /// The file kind. - public MediaFile(string path, MediaFileKind kind) - { - ArgumentException.ThrowIfNullOrEmpty(path); - - Path = path; - Kind = kind; - - MediaFileStreams = new HashSet(); - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the path relative to the library root. - /// - /// - /// Required, Max length = 65535. - /// - [MaxLength(65535)] - [StringLength(65535)] - public string Path { get; set; } - - /// - /// Gets or sets the kind of media file. - /// - /// - /// Required. - /// - public MediaFileKind Kind { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets a collection containing the streams in this file. - /// - public virtual ICollection MediaFileStreams { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs b/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs deleted file mode 100644 index e24e73ecb..000000000 --- a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs +++ /dev/null @@ -1,50 +0,0 @@ -#pragma warning disable CA1711 // Identifiers should not have incorrect suffix - -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a stream in a media file. - /// - public class MediaFileStream : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The number of this stream. - public MediaFileStream(int streamNumber) - { - StreamNumber = streamNumber; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the stream number. - /// - /// - /// Required. - /// - public int StreamNumber { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs deleted file mode 100644 index b38d6a4f1..000000000 --- a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a metadata provider. - /// - public class MetadataProvider : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The name of the metadata provider. - public MetadataProvider(string name) - { - ArgumentException.ThrowIfNullOrEmpty(name); - - Name = name; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Required, Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string Name { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs deleted file mode 100644 index a198f53ba..000000000 --- a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a unique identifier for a metadata provider. - /// - public class MetadataProviderId : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The provider id. - /// The metadata provider. - public MetadataProviderId(string providerId, MetadataProvider metadataProvider) - { - ArgumentException.ThrowIfNullOrEmpty(providerId); - - ProviderId = providerId; - MetadataProvider = metadataProvider; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the provider id. - /// - /// - /// Required, Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string ProviderId { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets or sets the metadata provider. - /// - /// - /// Required. - /// - public virtual MetadataProvider MetadataProvider { get; set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Movie.cs b/Jellyfin.Data/Entities/Libraries/Movie.cs deleted file mode 100644 index 499fafd0e..000000000 --- a/Jellyfin.Data/Entities/Libraries/Movie.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a movie. - /// - public class Movie : LibraryItem, IHasReleases - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public Movie(Library library) : base(library) - { - Releases = new HashSet(); - MovieMetadata = new HashSet(); - } - - /// - public virtual ICollection Releases { get; private set; } - - /// - /// Gets a collection containing the metadata for this movie. - /// - public virtual ICollection MovieMetadata { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs b/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs deleted file mode 100644 index 44b5f34d7..000000000 --- a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity holding the metadata for a movie. - /// - public class MovieMetadata : ItemMetadata, IHasCompanies - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the movie. - /// ISO-639-3 3-character language codes. - public MovieMetadata(string title, string language) : base(title, language) - { - Studios = new HashSet(); - } - - /// - /// Gets or sets the outline. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Outline { get; set; } - - /// - /// Gets or sets the tagline. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Tagline { get; set; } - - /// - /// Gets or sets the plot. - /// - /// - /// Max length = 65535. - /// - [MaxLength(65535)] - [StringLength(65535)] - public string? Plot { get; set; } - - /// - /// Gets or sets the country code. - /// - /// - /// Max length = 2. - /// - [MaxLength(2)] - [StringLength(2)] - public string? Country { get; set; } - - /// - /// Gets the studios that produced this movie. - /// - public virtual ICollection Studios { get; private set; } - - /// - public ICollection Companies => Studios; - } -} diff --git a/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs b/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs deleted file mode 100644 index d6231bbf0..000000000 --- a/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a music album. - /// - public class MusicAlbum : LibraryItem - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public MusicAlbum(Library library) : base(library) - { - MusicAlbumMetadata = new HashSet(); - Tracks = new HashSet(); - } - - /// - /// Gets a collection containing the album metadata. - /// - public virtual ICollection MusicAlbumMetadata { get; private set; } - - /// - /// Gets a collection containing the tracks. - /// - public virtual ICollection Tracks { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs b/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs deleted file mode 100644 index 691f3504f..000000000 --- a/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity holding the metadata for a music album. - /// - public class MusicAlbumMetadata : ItemMetadata - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the album. - /// ISO-639-3 3-character language codes. - public MusicAlbumMetadata(string title, string language) : base(title, language) - { - Labels = new HashSet(); - } - - /// - /// Gets or sets the barcode. - /// - /// - /// Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string? Barcode { get; set; } - - /// - /// Gets or sets the label number. - /// - /// - /// Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string? LabelNumber { get; set; } - - /// - /// Gets or sets the country code. - /// - /// - /// Max length = 2. - /// - [MaxLength(2)] - [StringLength(2)] - public string? Country { get; set; } - - /// - /// Gets a collection containing the labels. - /// - public virtual ICollection Labels { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Person.cs b/Jellyfin.Data/Entities/Libraries/Person.cs deleted file mode 100644 index 90dc55b70..000000000 --- a/Jellyfin.Data/Entities/Libraries/Person.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a person. - /// - public class Person : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The name of the person. - public Person(string name) - { - ArgumentException.ThrowIfNullOrEmpty(name); - - Name = name; - DateAdded = DateTime.UtcNow; - DateModified = DateAdded; - - Sources = new HashSet(); - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Required, Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string Name { get; set; } - - /// - /// Gets or sets the source id. - /// - /// - /// Max length = 255. - /// - [MaxLength(256)] - [StringLength(256)] - public string? SourceId { get; set; } - - /// - /// Gets the date added. - /// - /// - /// Required. - /// - public DateTime DateAdded { get; private set; } - - /// - /// Gets or sets the date modified. - /// - /// - /// Required. - /// - public DateTime DateModified { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets a list of metadata sources for this person. - /// - public virtual ICollection Sources { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/PersonRole.cs b/Jellyfin.Data/Entities/Libraries/PersonRole.cs deleted file mode 100644 index 7d40bdf44..000000000 --- a/Jellyfin.Data/Entities/Libraries/PersonRole.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a person's role in media. - /// - public class PersonRole : IHasArtwork, IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The role type. - /// The person. - public PersonRole(PersonRoleType type, Person person) - { - Type = type; - Person = person; - Artwork = new HashSet(); - Sources = new HashSet(); - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name of the person's role. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Role { get; set; } - - /// - /// Gets or sets the person's role type. - /// - /// - /// Required. - /// - public PersonRoleType Type { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets or sets the person. - /// - /// - /// Required. - /// - public virtual Person Person { get; set; } - - /// - public virtual ICollection Artwork { get; private set; } - - /// - /// Gets a collection containing the metadata sources for this person role. - /// - public virtual ICollection Sources { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Photo.cs b/Jellyfin.Data/Entities/Libraries/Photo.cs deleted file mode 100644 index 4b459432b..000000000 --- a/Jellyfin.Data/Entities/Libraries/Photo.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a photo. - /// - public class Photo : LibraryItem, IHasReleases - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public Photo(Library library) : base(library) - { - PhotoMetadata = new HashSet(); - Releases = new HashSet(); - } - - /// - /// Gets a collection containing the photo metadata. - /// - public virtual ICollection PhotoMetadata { get; private set; } - - /// - public virtual ICollection Releases { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs b/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs deleted file mode 100644 index 6c284307d..000000000 --- a/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity that holds metadata for a photo. - /// - public class PhotoMetadata : ItemMetadata - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the photo. - /// ISO-639-3 3-character language codes. - public PhotoMetadata(string title, string language) : base(title, language) - { - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Rating.cs b/Jellyfin.Data/Entities/Libraries/Rating.cs deleted file mode 100644 index 58c8fa49e..000000000 --- a/Jellyfin.Data/Entities/Libraries/Rating.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a rating for an entity. - /// - public class Rating : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The value. - public Rating(double value) - { - Value = value; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the value. - /// - /// - /// Required. - /// - public double Value { get; set; } - - /// - /// Gets or sets the number of votes. - /// - public int? Votes { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets or sets the rating type. - /// If this is null it's the internal user rating. - /// - public virtual RatingSource? RatingType { get; set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/RatingSource.cs b/Jellyfin.Data/Entities/Libraries/RatingSource.cs deleted file mode 100644 index 0f3a07324..000000000 --- a/Jellyfin.Data/Entities/Libraries/RatingSource.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// This is the entity to store review ratings, not age ratings. - /// - public class RatingSource : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The minimum value. - /// The maximum value. - public RatingSource(double minimumValue, double maximumValue) - { - MinimumValue = minimumValue; - MaximumValue = maximumValue; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Name { get; set; } - - /// - /// Gets or sets the minimum value. - /// - /// - /// Required. - /// - public double MinimumValue { get; set; } - - /// - /// Gets or sets the maximum value. - /// - /// - /// Required. - /// - public double MaximumValue { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets or sets the metadata source. - /// - public virtual MetadataProviderId? Source { get; set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Release.cs b/Jellyfin.Data/Entities/Libraries/Release.cs deleted file mode 100644 index e68ab9105..000000000 --- a/Jellyfin.Data/Entities/Libraries/Release.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a release for a library item, eg. Director's cut vs. standard. - /// - public class Release : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// - /// The name of this release. - public Release(string name) - { - ArgumentException.ThrowIfNullOrEmpty(name); - - Name = name; - - MediaFiles = new HashSet(); - Chapters = new HashSet(); - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the name. - /// - /// - /// Required, Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string Name { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets a collection containing the media files for this release. - /// - public virtual ICollection MediaFiles { get; private set; } - - /// - /// Gets a collection containing the chapters for this release. - /// - public virtual ICollection Chapters { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Season.cs b/Jellyfin.Data/Entities/Libraries/Season.cs deleted file mode 100644 index fc110b49d..000000000 --- a/Jellyfin.Data/Entities/Libraries/Season.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a season. - /// - public class Season : LibraryItem - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public Season(Library library) : base(library) - { - Episodes = new HashSet(); - SeasonMetadata = new HashSet(); - } - - /// - /// Gets or sets the season number. - /// - public int? SeasonNumber { get; set; } - - /// - /// Gets the season metadata. - /// - public virtual ICollection SeasonMetadata { get; private set; } - - /// - /// Gets a collection containing the number of episodes. - /// - public virtual ICollection Episodes { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs b/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs deleted file mode 100644 index da40a075f..000000000 --- a/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity that holds metadata for seasons. - /// - public class SeasonMetadata : ItemMetadata - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the object. - /// ISO-639-3 3-character language codes. - public SeasonMetadata(string title, string language) : base(title, language) - { - } - - /// - /// Gets or sets the outline. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Outline { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Series.cs b/Jellyfin.Data/Entities/Libraries/Series.cs deleted file mode 100644 index 0354433e0..000000000 --- a/Jellyfin.Data/Entities/Libraries/Series.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a a series. - /// - public class Series : LibraryItem - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public Series(Library library) : base(library) - { - Seasons = new HashSet(); - SeriesMetadata = new HashSet(); - } - - /// - /// Gets or sets the days of week. - /// - public DayOfWeek? AirsDayOfWeek { get; set; } - - /// - /// Gets or sets the time the show airs, ignore the date portion. - /// - public DateTimeOffset? AirsTime { get; set; } - - /// - /// Gets or sets the date the series first aired. - /// - public DateTime? FirstAired { get; set; } - - /// - /// Gets a collection containing the series metadata. - /// - public virtual ICollection SeriesMetadata { get; private set; } - - /// - /// Gets a collection containing the seasons. - /// - public virtual ICollection Seasons { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs b/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs deleted file mode 100644 index 42115802c..000000000 --- a/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing series metadata. - /// - public class SeriesMetadata : ItemMetadata, IHasCompanies - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the object. - /// ISO-639-3 3-character language codes. - public SeriesMetadata(string title, string language) : base(title, language) - { - Networks = new HashSet(); - } - - /// - /// Gets or sets the outline. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Outline { get; set; } - - /// - /// Gets or sets the plot. - /// - /// - /// Max length = 65535. - /// - [MaxLength(65535)] - [StringLength(65535)] - public string? Plot { get; set; } - - /// - /// Gets or sets the tagline. - /// - /// - /// Max length = 1024. - /// - [MaxLength(1024)] - [StringLength(1024)] - public string? Tagline { get; set; } - - /// - /// Gets or sets the country code. - /// - /// - /// Max length = 2. - /// - [MaxLength(2)] - [StringLength(2)] - public string? Country { get; set; } - - /// - /// Gets a collection containing the networks. - /// - public virtual ICollection Networks { get; private set; } - - /// - public ICollection Companies => Networks; - } -} diff --git a/Jellyfin.Data/Entities/Libraries/Track.cs b/Jellyfin.Data/Entities/Libraries/Track.cs deleted file mode 100644 index d35400033..000000000 --- a/Jellyfin.Data/Entities/Libraries/Track.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity representing a track. - /// - public class Track : LibraryItem, IHasReleases - { - /// - /// Initializes a new instance of the class. - /// - /// The library. - public Track(Library library) : base(library) - { - Releases = new HashSet(); - TrackMetadata = new HashSet(); - } - - /// - /// Gets or sets the track number. - /// - public int? TrackNumber { get; set; } - - /// - public virtual ICollection Releases { get; private set; } - - /// - /// Gets a collection containing the track metadata. - /// - public virtual ICollection TrackMetadata { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs b/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs deleted file mode 100644 index 042d2b90d..000000000 --- a/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Jellyfin.Data.Entities.Libraries -{ - /// - /// An entity holding metadata for a track. - /// - public class TrackMetadata : ItemMetadata - { - /// - /// Initializes a new instance of the class. - /// - /// The title or name of the object. - /// ISO-639-3 3-character language codes. - public TrackMetadata(string title, string language) : base(title, language) - { - } - } -} diff --git a/Jellyfin.Data/Entities/MediaSegment.cs b/Jellyfin.Data/Entities/MediaSegment.cs deleted file mode 100644 index 90120d772..000000000 --- a/Jellyfin.Data/Entities/MediaSegment.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; - -namespace Jellyfin.Data.Entities; - -/// -/// An entity representing the metadata for a group of trickplay tiles. -/// -public class MediaSegment -{ - /// - /// Gets or sets the id of the media segment. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public Guid Id { get; set; } - - /// - /// Gets or sets the id of the associated item. - /// - public Guid ItemId { get; set; } - - /// - /// Gets or sets the Type of content this segment defines. - /// - public MediaSegmentType Type { get; set; } - - /// - /// Gets or sets the end of the segment. - /// - public long EndTicks { get; set; } - - /// - /// Gets or sets the start of the segment. - /// - public long StartTicks { get; set; } - - /// - /// Gets or sets Id of the media segment provider this entry originates from. - /// - public required string SegmentProviderId { get; set; } -} diff --git a/Jellyfin.Data/Entities/MediaStreamInfo.cs b/Jellyfin.Data/Entities/MediaStreamInfo.cs deleted file mode 100644 index 77816565a..000000000 --- a/Jellyfin.Data/Entities/MediaStreamInfo.cs +++ /dev/null @@ -1,103 +0,0 @@ -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - -using System; -using System.Diagnostics.CodeAnalysis; - -namespace Jellyfin.Data.Entities; - -public class MediaStreamInfo -{ - public required Guid ItemId { get; set; } - - public required BaseItemEntity Item { get; set; } - - public int StreamIndex { get; set; } - - public required MediaStreamTypeEntity StreamType { get; set; } - - public string? Codec { get; set; } - - public string? Language { get; set; } - - public string? ChannelLayout { get; set; } - - public string? Profile { get; set; } - - public string? AspectRatio { get; set; } - - public string? Path { get; set; } - - public bool? IsInterlaced { get; set; } - - public int? BitRate { get; set; } - - public int? Channels { get; set; } - - public int? SampleRate { get; set; } - - public bool IsDefault { get; set; } - - public bool IsForced { get; set; } - - public bool IsExternal { get; set; } - - public int? Height { get; set; } - - public int? Width { get; set; } - - public float? AverageFrameRate { get; set; } - - public float? RealFrameRate { get; set; } - - public float? Level { get; set; } - - public string? PixelFormat { get; set; } - - public int? BitDepth { get; set; } - - public bool? IsAnamorphic { get; set; } - - public int? RefFrames { get; set; } - - public string? CodecTag { get; set; } - - public string? Comment { get; set; } - - public string? NalLengthSize { get; set; } - - public bool? IsAvc { get; set; } - - public string? Title { get; set; } - - public string? TimeBase { get; set; } - - public string? CodecTimeBase { get; set; } - - public string? ColorPrimaries { get; set; } - - public string? ColorSpace { get; set; } - - public string? ColorTransfer { get; set; } - - public int? DvVersionMajor { get; set; } - - public int? DvVersionMinor { get; set; } - - public int? DvProfile { get; set; } - - public int? DvLevel { get; set; } - - public int? RpuPresentFlag { get; set; } - - public int? ElPresentFlag { get; set; } - - public int? BlPresentFlag { get; set; } - - public int? DvBlSignalCompatibilityId { get; set; } - - public bool? IsHearingImpaired { get; set; } - - public int? Rotation { get; set; } - - public string? KeyFrames { get; set; } -} diff --git a/Jellyfin.Data/Entities/MediaStreamTypeEntity.cs b/Jellyfin.Data/Entities/MediaStreamTypeEntity.cs deleted file mode 100644 index f57672a2c..000000000 --- a/Jellyfin.Data/Entities/MediaStreamTypeEntity.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Jellyfin.Data.Entities; - -/// -/// Enum MediaStreamType. -/// -public enum MediaStreamTypeEntity -{ - /// - /// The audio. - /// - Audio = 0, - - /// - /// The video. - /// - Video = 1, - - /// - /// The subtitle. - /// - Subtitle = 2, - - /// - /// The embedded image. - /// - EmbeddedImage = 3, - - /// - /// The data. - /// - Data = 4, - - /// - /// The lyric. - /// - Lyric = 5 -} diff --git a/Jellyfin.Data/Entities/People.cs b/Jellyfin.Data/Entities/People.cs deleted file mode 100644 index 18c778b17..000000000 --- a/Jellyfin.Data/Entities/People.cs +++ /dev/null @@ -1,32 +0,0 @@ -#pragma warning disable CA2227 // Collection properties should be read only - -using System; -using System.Collections.Generic; - -namespace Jellyfin.Data.Entities; - -/// -/// People entity. -/// -public class People -{ - /// - /// Gets or Sets the PeopleId. - /// - public required Guid Id { get; set; } - - /// - /// Gets or Sets the Persons Name. - /// - public required string Name { get; set; } - - /// - /// Gets or Sets the Type. - /// - public string? PersonType { get; set; } - - /// - /// Gets or Sets the mapping of People to BaseItems. - /// - public ICollection? BaseItems { get; set; } -} diff --git a/Jellyfin.Data/Entities/PeopleBaseItemMap.cs b/Jellyfin.Data/Entities/PeopleBaseItemMap.cs deleted file mode 100644 index 5ce7300b5..000000000 --- a/Jellyfin.Data/Entities/PeopleBaseItemMap.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace Jellyfin.Data.Entities; - -/// -/// Mapping table for People to BaseItems. -/// -public class PeopleBaseItemMap -{ - /// - /// Gets or Sets the SortOrder. - /// - public int? SortOrder { get; set; } - - /// - /// Gets or Sets the ListOrder. - /// - public int? ListOrder { get; set; } - - /// - /// Gets or Sets the Role name the assosiated actor played in the . - /// - public string? Role { get; set; } - - /// - /// Gets or Sets The ItemId. - /// - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets Reference Item. - /// - public required BaseItemEntity Item { get; set; } - - /// - /// Gets or Sets The PeopleId. - /// - public required Guid PeopleId { get; set; } - - /// - /// Gets or Sets Reference People. - /// - public required People People { get; set; } -} diff --git a/Jellyfin.Data/Entities/Permission.cs b/Jellyfin.Data/Entities/Permission.cs deleted file mode 100644 index 6d2e68077..000000000 --- a/Jellyfin.Data/Entities/Permission.cs +++ /dev/null @@ -1,68 +0,0 @@ -#pragma warning disable CA1711 // Identifiers should not have incorrect suffix - -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity representing whether the associated user has a specific permission. - /// - public class Permission : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// Public constructor with required data. - /// - /// The permission kind. - /// The value of this permission. - public Permission(PermissionKind kind, bool value) - { - Kind = kind; - Value = value; - } - - /// - /// Gets the id of this permission. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the id of the associated user. - /// - public Guid? UserId { get; set; } - - /// - /// Gets the type of this permission. - /// - /// - /// Required. - /// - public PermissionKind Kind { get; private set; } - - /// - /// Gets or sets a value indicating whether the associated user has this permission. - /// - /// - /// Required. - /// - public bool Value { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/Preference.cs b/Jellyfin.Data/Entities/Preference.cs deleted file mode 100644 index a6ab275d3..000000000 --- a/Jellyfin.Data/Entities/Preference.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Jellyfin.Data.Enums; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity representing a preference attached to a user or group. - /// - public class Preference : IHasConcurrencyToken - { - /// - /// Initializes a new instance of the class. - /// Public constructor with required data. - /// - /// The preference kind. - /// The value. - public Preference(PreferenceKind kind, string value) - { - Kind = kind; - Value = value ?? throw new ArgumentNullException(nameof(value)); - } - - /// - /// Gets the id of this preference. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the id of the associated user. - /// - public Guid? UserId { get; set; } - - /// - /// Gets the type of this preference. - /// - /// - /// Required. - /// - public PreferenceKind Kind { get; private set; } - - /// - /// Gets or sets the value of this preference. - /// - /// - /// Required, Max length = 65535. - /// - [MaxLength(65535)] - [StringLength(65535)] - public string Value { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - } -} diff --git a/Jellyfin.Data/Entities/ProgramAudioEntity.cs b/Jellyfin.Data/Entities/ProgramAudioEntity.cs deleted file mode 100644 index 5b225a002..000000000 --- a/Jellyfin.Data/Entities/ProgramAudioEntity.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Jellyfin.Data.Entities; - -/// -/// Lists types of Audio. -/// -public enum ProgramAudioEntity -{ - /// - /// Mono. - /// - Mono = 0, - - /// - /// Sterio. - /// - Stereo = 1, - - /// - /// Dolby. - /// - Dolby = 2, - - /// - /// DolbyDigital. - /// - DolbyDigital = 3, - - /// - /// Thx. - /// - Thx = 4, - - /// - /// Atmos. - /// - Atmos = 5 -} diff --git a/Jellyfin.Data/Entities/Security/ApiKey.cs b/Jellyfin.Data/Entities/Security/ApiKey.cs deleted file mode 100644 index 1fcbe0f5e..000000000 --- a/Jellyfin.Data/Entities/Security/ApiKey.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Globalization; - -namespace Jellyfin.Data.Entities.Security -{ - /// - /// An entity representing an API key. - /// - public class ApiKey - { - /// - /// Initializes a new instance of the class. - /// - /// The name. - public ApiKey(string name) - { - Name = name; - - AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); - DateCreated = DateTime.UtcNow; - } - - /// - /// Gets the id. - /// - /// - /// Identity, Indexed, Required. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets or sets the date created. - /// - public DateTime DateCreated { get; set; } - - /// - /// Gets or sets the date of last activity. - /// - public DateTime DateLastActivity { get; set; } - - /// - /// Gets or sets the name. - /// - [MaxLength(64)] - [StringLength(64)] - public string Name { get; set; } - - /// - /// Gets or sets the access token. - /// - public string AccessToken { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/Security/Device.cs b/Jellyfin.Data/Entities/Security/Device.cs deleted file mode 100644 index 67d7f78ed..000000000 --- a/Jellyfin.Data/Entities/Security/Device.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Globalization; - -namespace Jellyfin.Data.Entities.Security -{ - /// - /// An entity representing a device. - /// - public class Device - { - /// - /// Initializes a new instance of the class. - /// - /// The user id. - /// The app name. - /// The app version. - /// The device name. - /// The device id. - public Device(Guid userId, string appName, string appVersion, string deviceName, string deviceId) - { - UserId = userId; - AppName = appName; - AppVersion = appVersion; - DeviceName = deviceName; - DeviceId = deviceId; - - AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); - DateCreated = DateTime.UtcNow; - DateModified = DateCreated; - DateLastActivity = DateCreated; - - // Non-nullable for EF Core, as this is a required relationship. - User = null!; - } - - /// - /// Gets the id. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets the user id. - /// - public Guid UserId { get; private set; } - - /// - /// Gets or sets the access token. - /// - public string AccessToken { get; set; } - - /// - /// Gets or sets the app name. - /// - [MaxLength(64)] - [StringLength(64)] - public string AppName { get; set; } - - /// - /// Gets or sets the app version. - /// - [MaxLength(32)] - [StringLength(32)] - public string AppVersion { get; set; } - - /// - /// Gets or sets the device name. - /// - [MaxLength(64)] - [StringLength(64)] - public string DeviceName { get; set; } - - /// - /// Gets or sets the device id. - /// - [MaxLength(256)] - [StringLength(256)] - public string DeviceId { get; set; } - - /// - /// Gets or sets a value indicating whether this device is active. - /// - public bool IsActive { get; set; } - - /// - /// Gets or sets the date created. - /// - public DateTime DateCreated { get; set; } - - /// - /// Gets or sets the date modified. - /// - public DateTime DateModified { get; set; } - - /// - /// Gets or sets the date of last activity. - /// - public DateTime DateLastActivity { get; set; } - - /// - /// Gets the user. - /// - public User User { get; private set; } - } -} diff --git a/Jellyfin.Data/Entities/Security/DeviceOptions.cs b/Jellyfin.Data/Entities/Security/DeviceOptions.cs deleted file mode 100644 index 531f66c62..000000000 --- a/Jellyfin.Data/Entities/Security/DeviceOptions.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Jellyfin.Data.Entities.Security -{ - /// - /// An entity representing custom options for a device. - /// - public class DeviceOptions - { - /// - /// Initializes a new instance of the class. - /// - /// The device id. - public DeviceOptions(string deviceId) - { - DeviceId = deviceId; - } - - /// - /// Gets the id. - /// - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; private set; } - - /// - /// Gets the device id. - /// - public string DeviceId { get; private set; } - - /// - /// Gets or sets the custom name. - /// - public string? CustomName { get; set; } - } -} diff --git a/Jellyfin.Data/Entities/TrickplayInfo.cs b/Jellyfin.Data/Entities/TrickplayInfo.cs deleted file mode 100644 index 64e7da1b5..000000000 --- a/Jellyfin.Data/Entities/TrickplayInfo.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace Jellyfin.Data.Entities; - -/// -/// An entity representing the metadata for a group of trickplay tiles. -/// -public class TrickplayInfo -{ - /// - /// Gets or sets the id of the associated item. - /// - /// - /// Required. - /// - [JsonIgnore] - public Guid ItemId { get; set; } - - /// - /// Gets or sets width of an individual thumbnail. - /// - /// - /// Required. - /// - public int Width { get; set; } - - /// - /// Gets or sets height of an individual thumbnail. - /// - /// - /// Required. - /// - public int Height { get; set; } - - /// - /// Gets or sets amount of thumbnails per row. - /// - /// - /// Required. - /// - public int TileWidth { get; set; } - - /// - /// Gets or sets amount of thumbnails per column. - /// - /// - /// Required. - /// - public int TileHeight { get; set; } - - /// - /// Gets or sets total amount of non-black thumbnails. - /// - /// - /// Required. - /// - public int ThumbnailCount { get; set; } - - /// - /// Gets or sets interval in milliseconds between each trickplay thumbnail. - /// - /// - /// Required. - /// - public int Interval { get; set; } - - /// - /// Gets or sets peak bandwith usage in bits per second. - /// - /// - /// Required. - /// - public int Bandwidth { get; set; } -} diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.cs deleted file mode 100644 index 9bbe9efe8..000000000 --- a/Jellyfin.Data/Entities/User.cs +++ /dev/null @@ -1,534 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text.Json.Serialization; -using Jellyfin.Data.Enums; -using Jellyfin.Data.Interfaces; - -namespace Jellyfin.Data.Entities -{ - /// - /// An entity representing a user. - /// - public class User : IHasPermissions, IHasConcurrencyToken - { - /// - /// The values being delimited here are Guids, so commas work as they do not appear in Guids. - /// - private const char Delimiter = ','; - - /// - /// Initializes a new instance of the class. - /// Public constructor with required data. - /// - /// The username for the new user. - /// The Id of the user's authentication provider. - /// The Id of the user's password reset provider. - public User(string username, string authenticationProviderId, string passwordResetProviderId) - { - ArgumentException.ThrowIfNullOrEmpty(username); - ArgumentException.ThrowIfNullOrEmpty(authenticationProviderId); - ArgumentException.ThrowIfNullOrEmpty(passwordResetProviderId); - - Username = username; - AuthenticationProviderId = authenticationProviderId; - PasswordResetProviderId = passwordResetProviderId; - - AccessSchedules = new HashSet(); - DisplayPreferences = new HashSet(); - ItemDisplayPreferences = new HashSet(); - // Groups = new HashSet(); - Permissions = new HashSet(); - Preferences = new HashSet(); - // ProviderMappings = new HashSet(); - - // Set default values - Id = Guid.NewGuid(); - InvalidLoginAttemptCount = 0; - EnableUserPreferenceAccess = true; - MustUpdatePassword = false; - DisplayMissingEpisodes = false; - DisplayCollectionsView = false; - HidePlayedInLatest = true; - RememberAudioSelections = true; - RememberSubtitleSelections = true; - EnableNextEpisodeAutoPlay = true; - EnableAutoLogin = false; - PlayDefaultAudioTrack = true; - SubtitleMode = SubtitlePlaybackMode.Default; - SyncPlayAccess = SyncPlayUserAccessType.CreateAndJoinGroups; - } - - /// - /// Gets or sets the Id of the user. - /// - /// - /// Identity, Indexed, Required. - /// - [JsonIgnore] - public Guid Id { get; set; } - - /// - /// Gets or sets the user's name. - /// - /// - /// Required, Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string Username { get; set; } - - /// - /// Gets or sets the user's password, or null if none is set. - /// - /// - /// Max length = 65535. - /// - [MaxLength(65535)] - [StringLength(65535)] - public string? Password { get; set; } - - /// - /// Gets or sets a value indicating whether the user must update their password. - /// - /// - /// Required. - /// - public bool MustUpdatePassword { get; set; } - - /// - /// Gets or sets the audio language preference. - /// - /// - /// Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string? AudioLanguagePreference { get; set; } - - /// - /// Gets or sets the authentication provider id. - /// - /// - /// Required, Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string AuthenticationProviderId { get; set; } - - /// - /// Gets or sets the password reset provider id. - /// - /// - /// Required, Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string PasswordResetProviderId { get; set; } - - /// - /// Gets or sets the invalid login attempt count. - /// - /// - /// Required. - /// - public int InvalidLoginAttemptCount { get; set; } - - /// - /// Gets or sets the last activity date. - /// - public DateTime? LastActivityDate { get; set; } - - /// - /// Gets or sets the last login date. - /// - public DateTime? LastLoginDate { get; set; } - - /// - /// Gets or sets the number of login attempts the user can make before they are locked out. - /// - public int? LoginAttemptsBeforeLockout { get; set; } - - /// - /// Gets or sets the maximum number of active sessions the user can have at once. - /// - public int MaxActiveSessions { get; set; } - - /// - /// Gets or sets the subtitle mode. - /// - /// - /// Required. - /// - public SubtitlePlaybackMode SubtitleMode { get; set; } - - /// - /// Gets or sets a value indicating whether the default audio track should be played. - /// - /// - /// Required. - /// - public bool PlayDefaultAudioTrack { get; set; } - - /// - /// Gets or sets the subtitle language preference. - /// - /// - /// Max length = 255. - /// - [MaxLength(255)] - [StringLength(255)] - public string? SubtitleLanguagePreference { get; set; } - - /// - /// Gets or sets a value indicating whether missing episodes should be displayed. - /// - /// - /// Required. - /// - public bool DisplayMissingEpisodes { get; set; } - - /// - /// Gets or sets a value indicating whether to display the collections view. - /// - /// - /// Required. - /// - public bool DisplayCollectionsView { get; set; } - - /// - /// Gets or sets a value indicating whether the user has a local password. - /// - /// - /// Required. - /// - public bool EnableLocalPassword { get; set; } - - /// - /// Gets or sets a value indicating whether the server should hide played content in "Latest". - /// - /// - /// Required. - /// - public bool HidePlayedInLatest { get; set; } - - /// - /// Gets or sets a value indicating whether to remember audio selections on played content. - /// - /// - /// Required. - /// - public bool RememberAudioSelections { get; set; } - - /// - /// Gets or sets a value indicating whether to remember subtitle selections on played content. - /// - /// - /// Required. - /// - public bool RememberSubtitleSelections { get; set; } - - /// - /// Gets or sets a value indicating whether to enable auto-play for the next episode. - /// - /// - /// Required. - /// - public bool EnableNextEpisodeAutoPlay { get; set; } - - /// - /// Gets or sets a value indicating whether the user should auto-login. - /// - /// - /// Required. - /// - public bool EnableAutoLogin { get; set; } - - /// - /// Gets or sets a value indicating whether the user can change their preferences. - /// - /// - /// Required. - /// - public bool EnableUserPreferenceAccess { get; set; } - - /// - /// Gets or sets the maximum parental age rating. - /// - public int? MaxParentalAgeRating { get; set; } - - /// - /// Gets or sets the remote client bitrate limit. - /// - public int? RemoteClientBitrateLimit { get; set; } - - /// - /// Gets or sets the internal id. - /// This is a temporary stopgap for until the library db is migrated. - /// This corresponds to the value of the index of this user in the library db. - /// - public long InternalId { get; set; } - - /// - /// Gets or sets the user's profile image. Can be null. - /// - // [ForeignKey("UserId")] - public virtual ImageInfo? ProfileImage { get; set; } - - /// - /// Gets the user's display preferences. - /// - public virtual ICollection DisplayPreferences { get; private set; } - - /// - /// Gets or sets the level of sync play permissions this user has. - /// - public SyncPlayUserAccessType SyncPlayAccess { get; set; } - - /// - /// Gets or sets the cast receiver id. - /// - [StringLength(32)] - public string? CastReceiverId { get; set; } - - /// - [ConcurrencyCheck] - public uint RowVersion { get; private set; } - - /// - /// Gets the list of access schedules this user has. - /// - public virtual ICollection AccessSchedules { get; private set; } - - /// - /// Gets the list of item display preferences. - /// - public virtual ICollection ItemDisplayPreferences { get; private set; } - - /* - /// - /// Gets the list of groups this user is a member of. - /// - public virtual ICollection Groups { get; private set; } - */ - - /// - /// Gets the list of permissions this user has. - /// - [ForeignKey("Permission_Permissions_Guid")] - public virtual ICollection Permissions { get; private set; } - - /* - /// - /// Gets the list of provider mappings this user has. - /// - public virtual ICollection ProviderMappings { get; private set; } - */ - - /// - /// Gets the list of preferences this user has. - /// - [ForeignKey("Preference_Preferences_Guid")] - public virtual ICollection Preferences { get; private set; } - - /// - public void OnSavingChanges() - { - RowVersion++; - } - - /// - /// Checks whether the user has the specified permission. - /// - /// The permission kind. - /// True if the user has the specified permission. - public bool HasPermission(PermissionKind kind) - { - return Permissions.FirstOrDefault(p => p.Kind == kind)?.Value ?? false; - } - - /// - /// Sets the given permission kind to the provided value. - /// - /// The permission kind. - /// The value to set. - public void SetPermission(PermissionKind kind, bool value) - { - var currentPermission = Permissions.FirstOrDefault(p => p.Kind == kind); - if (currentPermission is null) - { - Permissions.Add(new Permission(kind, value)); - } - else - { - currentPermission.Value = value; - } - } - - /// - /// Gets the user's preferences for the given preference kind. - /// - /// The preference kind. - /// A string array containing the user's preferences. - public string[] GetPreference(PreferenceKind preference) - { - var val = Preferences.FirstOrDefault(p => p.Kind == preference)?.Value; - - return string.IsNullOrEmpty(val) ? Array.Empty() : val.Split(Delimiter); - } - - /// - /// Gets the user's preferences for the given preference kind. - /// - /// The preference kind. - /// Type of preference. - /// A {T} array containing the user's preference. - public T[] GetPreferenceValues(PreferenceKind preference) - { - var val = Preferences.FirstOrDefault(p => p.Kind == preference)?.Value; - if (string.IsNullOrEmpty(val)) - { - return Array.Empty(); - } - - // Convert array of {string} to array of {T} - var converter = TypeDescriptor.GetConverter(typeof(T)); - var stringValues = val.Split(Delimiter); - var convertedCount = 0; - var parsedValues = new T[stringValues.Length]; - for (var i = 0; i < stringValues.Length; i++) - { - try - { - var parsedValue = converter.ConvertFromString(stringValues[i].Trim()); - if (parsedValue is not null) - { - parsedValues[convertedCount++] = (T)parsedValue; - } - } - catch (FormatException) - { - // Unable to convert value - } - } - - return parsedValues[..convertedCount]; - } - - /// - /// Sets the specified preference to the given value. - /// - /// The preference kind. - /// The values. - public void SetPreference(PreferenceKind preference, string[] values) - { - var value = string.Join(Delimiter, values); - var currentPreference = Preferences.FirstOrDefault(p => p.Kind == preference); - if (currentPreference is null) - { - Preferences.Add(new Preference(preference, value)); - } - else - { - currentPreference.Value = value; - } - } - - /// - /// Sets the specified preference to the given value. - /// - /// The preference kind. - /// The values. - /// The type of value. - public void SetPreference(PreferenceKind preference, T[] values) - { - var value = string.Join(Delimiter, values); - var currentPreference = Preferences.FirstOrDefault(p => p.Kind == preference); - if (currentPreference is null) - { - Preferences.Add(new Preference(preference, value)); - } - else - { - currentPreference.Value = value; - } - } - - /// - /// Checks whether this user is currently allowed to use the server. - /// - /// True if the current time is within an access schedule, or there are no access schedules. - public bool IsParentalScheduleAllowed() - { - return AccessSchedules.Count == 0 - || AccessSchedules.Any(i => IsParentalScheduleAllowed(i, DateTime.UtcNow)); - } - - /// - /// Checks whether the provided folder is in this user's grouped folders. - /// - /// The Guid of the folder. - /// True if the folder is in the user's grouped folders. - public bool IsFolderGrouped(Guid id) - { - return Array.IndexOf(GetPreferenceValues(PreferenceKind.GroupedFolders), id) != -1; - } - - /// - /// Initializes the default permissions for a user. Should only be called on user creation. - /// - // TODO: make these user configurable? - public void AddDefaultPermissions() - { - Permissions.Add(new Permission(PermissionKind.IsAdministrator, false)); - Permissions.Add(new Permission(PermissionKind.IsDisabled, false)); - Permissions.Add(new Permission(PermissionKind.IsHidden, true)); - Permissions.Add(new Permission(PermissionKind.EnableAllChannels, true)); - Permissions.Add(new Permission(PermissionKind.EnableAllDevices, true)); - Permissions.Add(new Permission(PermissionKind.EnableAllFolders, true)); - Permissions.Add(new Permission(PermissionKind.EnableContentDeletion, false)); - Permissions.Add(new Permission(PermissionKind.EnableContentDownloading, true)); - Permissions.Add(new Permission(PermissionKind.EnableMediaConversion, true)); - Permissions.Add(new Permission(PermissionKind.EnableMediaPlayback, true)); - Permissions.Add(new Permission(PermissionKind.EnablePlaybackRemuxing, true)); - Permissions.Add(new Permission(PermissionKind.EnablePublicSharing, true)); - Permissions.Add(new Permission(PermissionKind.EnableRemoteAccess, true)); - Permissions.Add(new Permission(PermissionKind.EnableSyncTranscoding, true)); - Permissions.Add(new Permission(PermissionKind.EnableAudioPlaybackTranscoding, true)); - Permissions.Add(new Permission(PermissionKind.EnableLiveTvAccess, true)); - Permissions.Add(new Permission(PermissionKind.EnableLiveTvManagement, true)); - Permissions.Add(new Permission(PermissionKind.EnableSharedDeviceControl, true)); - Permissions.Add(new Permission(PermissionKind.EnableVideoPlaybackTranscoding, true)); - Permissions.Add(new Permission(PermissionKind.ForceRemoteSourceTranscoding, false)); - Permissions.Add(new Permission(PermissionKind.EnableRemoteControlOfOtherUsers, false)); - Permissions.Add(new Permission(PermissionKind.EnableCollectionManagement, false)); - Permissions.Add(new Permission(PermissionKind.EnableSubtitleManagement, false)); - Permissions.Add(new Permission(PermissionKind.EnableLyricManagement, false)); - } - - /// - /// Initializes the default preferences. Should only be called on user creation. - /// - public void AddDefaultPreferences() - { - foreach (var val in Enum.GetValues()) - { - Preferences.Add(new Preference(val, string.Empty)); - } - } - - private static bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date) - { - var localTime = date.ToLocalTime(); - var hour = localTime.TimeOfDay.TotalHours; - var currentDayOfWeek = localTime.DayOfWeek; - - return schedule.DayOfWeek.Contains(currentDayOfWeek) - && hour >= schedule.StartHour - && hour <= schedule.EndHour; - } - } -} diff --git a/Jellyfin.Data/Entities/UserData.cs b/Jellyfin.Data/Entities/UserData.cs deleted file mode 100644 index 05ab6dd2d..000000000 --- a/Jellyfin.Data/Entities/UserData.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Jellyfin.Data.Entities; - -/// -/// Provides and related data. -/// -public class UserData -{ - /// - /// Gets or sets the custom data key. - /// - /// The rating. - public required string CustomDataKey { get; set; } - - /// - /// Gets or sets the users 0-10 rating. - /// - /// The rating. - public double? Rating { get; set; } - - /// - /// Gets or sets the playback position ticks. - /// - /// The playback position ticks. - public long PlaybackPositionTicks { get; set; } - - /// - /// Gets or sets the play count. - /// - /// The play count. - public int PlayCount { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is favorite. - /// - /// true if this instance is favorite; otherwise, false. - public bool IsFavorite { get; set; } - - /// - /// Gets or sets the last played date. - /// - /// The last played date. - public DateTime? LastPlayedDate { get; set; } - - /// - /// Gets or sets a value indicating whether this is played. - /// - /// true if played; otherwise, false. - public bool Played { get; set; } - - /// - /// Gets or sets the index of the audio stream. - /// - /// The index of the audio stream. - public int? AudioStreamIndex { get; set; } - - /// - /// Gets or sets the index of the subtitle stream. - /// - /// The index of the subtitle stream. - public int? SubtitleStreamIndex { get; set; } - - /// - /// Gets or sets a value indicating whether the item is liked or not. - /// This should never be serialized. - /// - /// null if [likes] contains no value, true if [likes]; otherwise, false. - public bool? Likes { get; set; } - - /// - /// Gets or sets the key. - /// - /// The key. - public required Guid ItemId { get; set; } - - /// - /// Gets or Sets the BaseItem. - /// - public required BaseItemEntity? Item { get; set; } - - /// - /// Gets or Sets the UserId. - /// - public required Guid UserId { get; set; } - - /// - /// Gets or Sets the User. - /// - public required User? User { get; set; } -} diff --git a/Jellyfin.Data/Enums/ArtKind.cs b/Jellyfin.Data/Enums/ArtKind.cs deleted file mode 100644 index f7a73848c..000000000 --- a/Jellyfin.Data/Enums/ArtKind.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing types of art. - /// - public enum ArtKind - { - /// - /// Another type of art, not covered by the other members. - /// - Other = 0, - - /// - /// A poster. - /// - Poster = 1, - - /// - /// A banner. - /// - Banner = 2, - - /// - /// A thumbnail. - /// - Thumbnail = 3, - - /// - /// A logo. - /// - Logo = 4 - } -} diff --git a/Jellyfin.Data/Enums/ChromecastVersion.cs b/Jellyfin.Data/Enums/ChromecastVersion.cs deleted file mode 100644 index c9c8a4a62..000000000 --- a/Jellyfin.Data/Enums/ChromecastVersion.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing the version of Chromecast to be used by clients. - /// - public enum ChromecastVersion - { - /// - /// Stable Chromecast version. - /// - Stable = 0, - - /// - /// Unstable Chromecast version. - /// - Unstable = 1 - } -} diff --git a/Jellyfin.Data/Enums/DynamicDayOfWeek.cs b/Jellyfin.Data/Enums/DynamicDayOfWeek.cs deleted file mode 100644 index d3d8dd822..000000000 --- a/Jellyfin.Data/Enums/DynamicDayOfWeek.cs +++ /dev/null @@ -1,58 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum that represents a day of the week, weekdays, weekends, or all days. - /// - public enum DynamicDayOfWeek - { - /// - /// Sunday. - /// - Sunday = 0, - - /// - /// Monday. - /// - Monday = 1, - - /// - /// Tuesday. - /// - Tuesday = 2, - - /// - /// Wednesday. - /// - Wednesday = 3, - - /// - /// Thursday. - /// - Thursday = 4, - - /// - /// Friday. - /// - Friday = 5, - - /// - /// Saturday. - /// - Saturday = 6, - - /// - /// All days of the week. - /// - Everyday = 7, - - /// - /// A week day, or Monday-Friday. - /// - Weekday = 8, - - /// - /// Saturday and Sunday. - /// - Weekend = 9 - } -} diff --git a/Jellyfin.Data/Enums/HomeSectionType.cs b/Jellyfin.Data/Enums/HomeSectionType.cs deleted file mode 100644 index 62da8c3ff..000000000 --- a/Jellyfin.Data/Enums/HomeSectionType.cs +++ /dev/null @@ -1,58 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing the different options for the home screen sections. - /// - public enum HomeSectionType - { - /// - /// None. - /// - None = 0, - - /// - /// My Media. - /// - SmallLibraryTiles = 1, - - /// - /// My Media Small. - /// - LibraryButtons = 2, - - /// - /// Active Recordings. - /// - ActiveRecordings = 3, - - /// - /// Continue Watching. - /// - Resume = 4, - - /// - /// Continue Listening. - /// - ResumeAudio = 5, - - /// - /// Latest Media. - /// - LatestMedia = 6, - - /// - /// Next Up. - /// - NextUp = 7, - - /// - /// Live TV. - /// - LiveTv = 8, - - /// - /// Continue Reading. - /// - ResumeBook = 9 - } -} diff --git a/Jellyfin.Data/Enums/IndexingKind.cs b/Jellyfin.Data/Enums/IndexingKind.cs deleted file mode 100644 index 3967712b0..000000000 --- a/Jellyfin.Data/Enums/IndexingKind.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing a type of indexing in a user's display preferences. - /// - public enum IndexingKind - { - /// - /// Index by the premiere date. - /// - PremiereDate = 0, - - /// - /// Index by the production year. - /// - ProductionYear = 1, - - /// - /// Index by the community rating. - /// - CommunityRating = 2 - } -} diff --git a/Jellyfin.Data/Enums/MediaFileKind.cs b/Jellyfin.Data/Enums/MediaFileKind.cs deleted file mode 100644 index 797c26ec2..000000000 --- a/Jellyfin.Data/Enums/MediaFileKind.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing the type of media file. - /// - public enum MediaFileKind - { - /// - /// The main file. - /// - Main = 0, - - /// - /// A sidecar file. - /// - Sidecar = 1, - - /// - /// An additional part to the main file. - /// - AdditionalPart = 2, - - /// - /// An alternative format to the main file. - /// - AlternativeFormat = 3, - - /// - /// An additional stream for the main file. - /// - AdditionalStream = 4 - } -} diff --git a/Jellyfin.Data/Enums/MediaSegmentType.cs b/Jellyfin.Data/Enums/MediaSegmentType.cs deleted file mode 100644 index 458635450..000000000 --- a/Jellyfin.Data/Enums/MediaSegmentType.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Jellyfin.Data.Entities; - -namespace Jellyfin.Data.Enums; - -/// -/// Defines the types of content an individual represents. -/// -public enum MediaSegmentType -{ - /// - /// Default media type or custom one. - /// - Unknown = 0, - - /// - /// Commercial. - /// - Commercial = 1, - - /// - /// Preview. - /// - Preview = 2, - - /// - /// Recap. - /// - Recap = 3, - - /// - /// Outro. - /// - Outro = 4, - - /// - /// Intro. - /// - Intro = 5 -} diff --git a/Jellyfin.Data/Enums/PermissionKind.cs b/Jellyfin.Data/Enums/PermissionKind.cs deleted file mode 100644 index c3d6705c2..000000000 --- a/Jellyfin.Data/Enums/PermissionKind.cs +++ /dev/null @@ -1,128 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// The types of user permissions. - /// - public enum PermissionKind - { - /// - /// Whether the user is an administrator. - /// - IsAdministrator = 0, - - /// - /// Whether the user is hidden. - /// - IsHidden = 1, - - /// - /// Whether the user is disabled. - /// - IsDisabled = 2, - - /// - /// Whether the user can control shared devices. - /// - EnableSharedDeviceControl = 3, - - /// - /// Whether the user can access the server remotely. - /// - EnableRemoteAccess = 4, - - /// - /// Whether the user can manage live tv. - /// - EnableLiveTvManagement = 5, - - /// - /// Whether the user can access live tv. - /// - EnableLiveTvAccess = 6, - - /// - /// Whether the user can play media. - /// - EnableMediaPlayback = 7, - - /// - /// Whether the server should transcode audio for the user if requested. - /// - EnableAudioPlaybackTranscoding = 8, - - /// - /// Whether the server should transcode video for the user if requested. - /// - EnableVideoPlaybackTranscoding = 9, - - /// - /// Whether the user can delete content. - /// - EnableContentDeletion = 10, - - /// - /// Whether the user can download content. - /// - EnableContentDownloading = 11, - - /// - /// Whether to enable sync transcoding for the user. - /// - EnableSyncTranscoding = 12, - - /// - /// Whether the user can do media conversion. - /// - EnableMediaConversion = 13, - - /// - /// Whether the user has access to all devices. - /// - EnableAllDevices = 14, - - /// - /// Whether the user has access to all channels. - /// - EnableAllChannels = 15, - - /// - /// Whether the user has access to all folders. - /// - EnableAllFolders = 16, - - /// - /// Whether to enable public sharing for the user. - /// - EnablePublicSharing = 17, - - /// - /// Whether the user can remotely control other users. - /// - EnableRemoteControlOfOtherUsers = 18, - - /// - /// Whether the user is permitted to do playback remuxing. - /// - EnablePlaybackRemuxing = 19, - - /// - /// Whether the server should force transcoding on remote connections for the user. - /// - ForceRemoteSourceTranscoding = 20, - - /// - /// Whether the user can create, modify and delete collections. - /// - EnableCollectionManagement = 21, - - /// - /// Whether the user can edit subtitles. - /// - EnableSubtitleManagement = 22, - - /// - /// Whether the user can edit lyrics. - /// - EnableLyricManagement = 23, - } -} diff --git a/Jellyfin.Data/Enums/PersonRoleType.cs b/Jellyfin.Data/Enums/PersonRoleType.cs deleted file mode 100644 index 1e619f5ee..000000000 --- a/Jellyfin.Data/Enums/PersonRoleType.cs +++ /dev/null @@ -1,68 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing a person's role in a specific media item. - /// - public enum PersonRoleType - { - /// - /// Another role, not covered by the other types. - /// - Other = 0, - - /// - /// The director of the media. - /// - Director = 1, - - /// - /// An artist. - /// - Artist = 2, - - /// - /// The original artist. - /// - OriginalArtist = 3, - - /// - /// An actor. - /// - Actor = 4, - - /// - /// A voice actor. - /// - VoiceActor = 5, - - /// - /// A producer. - /// - Producer = 6, - - /// - /// A remixer. - /// - Remixer = 7, - - /// - /// A conductor. - /// - Conductor = 8, - - /// - /// A composer. - /// - Composer = 9, - - /// - /// An author. - /// - Author = 10, - - /// - /// An editor. - /// - Editor = 11 - } -} diff --git a/Jellyfin.Data/Enums/PreferenceKind.cs b/Jellyfin.Data/Enums/PreferenceKind.cs deleted file mode 100644 index d2b412e45..000000000 --- a/Jellyfin.Data/Enums/PreferenceKind.cs +++ /dev/null @@ -1,73 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// The types of user preferences. - /// - public enum PreferenceKind - { - /// - /// A list of blocked tags. - /// - BlockedTags = 0, - - /// - /// A list of blocked channels. - /// - BlockedChannels = 1, - - /// - /// A list of blocked media folders. - /// - BlockedMediaFolders = 2, - - /// - /// A list of enabled devices. - /// - EnabledDevices = 3, - - /// - /// A list of enabled channels. - /// - EnabledChannels = 4, - - /// - /// A list of enabled folders. - /// - EnabledFolders = 5, - - /// - /// A list of folders to allow content deletion from. - /// - EnableContentDeletionFromFolders = 6, - - /// - /// A list of latest items to exclude. - /// - LatestItemExcludes = 7, - - /// - /// A list of media to exclude. - /// - MyMediaExcludes = 8, - - /// - /// A list of grouped folders. - /// - GroupedFolders = 9, - - /// - /// A list of unrated items to block. - /// - BlockUnratedItems = 10, - - /// - /// A list of ordered views. - /// - OrderedViews = 11, - - /// - /// A list of allowed tags. - /// - AllowedTags = 12 - } -} diff --git a/Jellyfin.Data/Enums/ScrollDirection.cs b/Jellyfin.Data/Enums/ScrollDirection.cs deleted file mode 100644 index 29c50e2c4..000000000 --- a/Jellyfin.Data/Enums/ScrollDirection.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing the axis that should be scrolled. - /// - public enum ScrollDirection - { - /// - /// Horizontal scrolling direction. - /// - Horizontal = 0, - - /// - /// Vertical scrolling direction. - /// - Vertical = 1 - } -} diff --git a/Jellyfin.Data/Enums/SortOrder.cs b/Jellyfin.Data/Enums/SortOrder.cs deleted file mode 100644 index 4151448e4..000000000 --- a/Jellyfin.Data/Enums/SortOrder.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing the sorting order. - /// - public enum SortOrder - { - /// - /// Sort in increasing order. - /// - Ascending = 0, - - /// - /// Sort in decreasing order. - /// - Descending = 1 - } -} diff --git a/Jellyfin.Data/Enums/SubtitlePlaybackMode.cs b/Jellyfin.Data/Enums/SubtitlePlaybackMode.cs deleted file mode 100644 index 79693d321..000000000 --- a/Jellyfin.Data/Enums/SubtitlePlaybackMode.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing a subtitle playback mode. - /// - public enum SubtitlePlaybackMode - { - /// - /// The default subtitle playback mode. - /// - Default = 0, - - /// - /// Always show subtitles. - /// - Always = 1, - - /// - /// Only show forced subtitles. - /// - OnlyForced = 2, - - /// - /// Don't show subtitles. - /// - None = 3, - - /// - /// Only show subtitles when the current audio stream is in a different language. - /// - Smart = 4 - } -} diff --git a/Jellyfin.Data/Enums/SyncPlayUserAccessType.cs b/Jellyfin.Data/Enums/SyncPlayUserAccessType.cs deleted file mode 100644 index 030d16fb9..000000000 --- a/Jellyfin.Data/Enums/SyncPlayUserAccessType.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// Enum SyncPlayUserAccessType. - /// - public enum SyncPlayUserAccessType - { - /// - /// User can create groups and join them. - /// - CreateAndJoinGroups = 0, - - /// - /// User can only join already existing groups. - /// - JoinGroups = 1, - - /// - /// SyncPlay is disabled for the user. - /// - None = 2 - } -} diff --git a/Jellyfin.Data/Enums/ViewType.cs b/Jellyfin.Data/Enums/ViewType.cs deleted file mode 100644 index c0fd7d448..000000000 --- a/Jellyfin.Data/Enums/ViewType.cs +++ /dev/null @@ -1,113 +0,0 @@ -namespace Jellyfin.Data.Enums -{ - /// - /// An enum representing the type of view for a library or collection. - /// - public enum ViewType - { - /// - /// Shows albums. - /// - Albums = 0, - - /// - /// Shows album artists. - /// - AlbumArtists = 1, - - /// - /// Shows artists. - /// - Artists = 2, - - /// - /// Shows channels. - /// - Channels = 3, - - /// - /// Shows collections. - /// - Collections = 4, - - /// - /// Shows episodes. - /// - Episodes = 5, - - /// - /// Shows favorites. - /// - Favorites = 6, - - /// - /// Shows genres. - /// - Genres = 7, - - /// - /// Shows guide. - /// - Guide = 8, - - /// - /// Shows movies. - /// - Movies = 9, - - /// - /// Shows networks. - /// - Networks = 10, - - /// - /// Shows playlists. - /// - Playlists = 11, - - /// - /// Shows programs. - /// - Programs = 12, - - /// - /// Shows recordings. - /// - Recordings = 13, - - /// - /// Shows schedule. - /// - Schedule = 14, - - /// - /// Shows series. - /// - Series = 15, - - /// - /// Shows shows. - /// - Shows = 16, - - /// - /// Shows songs. - /// - Songs = 17, - - /// - /// Shows songs. - /// - Suggestions = 18, - - /// - /// Shows trailers. - /// - Trailers = 19, - - /// - /// Shows upcoming. - /// - Upcoming = 20 - } -} diff --git a/Jellyfin.Data/Interfaces/IHasArtwork.cs b/Jellyfin.Data/Interfaces/IHasArtwork.cs deleted file mode 100644 index a4d9c54af..000000000 --- a/Jellyfin.Data/Interfaces/IHasArtwork.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Entities.Libraries; - -namespace Jellyfin.Data.Interfaces -{ - /// - /// An interface abstracting an entity that has artwork. - /// - public interface IHasArtwork - { - /// - /// Gets a collection containing this entity's artwork. - /// - ICollection Artwork { get; } - } -} diff --git a/Jellyfin.Data/Interfaces/IHasCompanies.cs b/Jellyfin.Data/Interfaces/IHasCompanies.cs deleted file mode 100644 index 8f19ce04f..000000000 --- a/Jellyfin.Data/Interfaces/IHasCompanies.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Entities.Libraries; - -namespace Jellyfin.Data.Interfaces -{ - /// - /// An abstraction representing an entity that has companies. - /// - public interface IHasCompanies - { - /// - /// Gets a collection containing this entity's companies. - /// - ICollection Companies { get; } - } -} diff --git a/Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs b/Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs deleted file mode 100644 index 2c4091493..000000000 --- a/Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Jellyfin.Data.Interfaces -{ - /// - /// An interface abstracting an entity that has a concurrency token. - /// - public interface IHasConcurrencyToken - { - /// - /// Gets the version of this row. Acts as a concurrency token. - /// - uint RowVersion { get; } - - /// - /// Called when saving changes to this entity. - /// - void OnSavingChanges(); - } -} diff --git a/Jellyfin.Data/Interfaces/IHasPermissions.cs b/Jellyfin.Data/Interfaces/IHasPermissions.cs deleted file mode 100644 index bf8ec9d88..000000000 --- a/Jellyfin.Data/Interfaces/IHasPermissions.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Entities; -using Jellyfin.Data.Enums; - -namespace Jellyfin.Data.Interfaces -{ - /// - /// An abstraction representing an entity that has permissions. - /// - public interface IHasPermissions - { - /// - /// Gets a collection containing this entity's permissions. - /// - ICollection Permissions { get; } - - /// - /// Checks whether this entity has the specified permission kind. - /// - /// The kind of permission. - /// true if this entity has the specified permission, false otherwise. - bool HasPermission(PermissionKind kind); - - /// - /// Sets the specified permission to the provided value. - /// - /// The kind of permission. - /// The value to set. - void SetPermission(PermissionKind kind, bool value); - } -} diff --git a/Jellyfin.Data/Interfaces/IHasReleases.cs b/Jellyfin.Data/Interfaces/IHasReleases.cs deleted file mode 100644 index 3b615893e..000000000 --- a/Jellyfin.Data/Interfaces/IHasReleases.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using Jellyfin.Data.Entities.Libraries; - -namespace Jellyfin.Data.Interfaces -{ - /// - /// An abstraction representing an entity that has releases. - /// - public interface IHasReleases - { - /// - /// Gets a collection containing this entity's releases. - /// - ICollection Releases { get; } - } -} diff --git a/Jellyfin.Data/Jellyfin.Data.csproj b/Jellyfin.Data/Jellyfin.Data.csproj index 921cf2d8c..432f1846e 100644 --- a/Jellyfin.Data/Jellyfin.Data.csproj +++ b/Jellyfin.Data/Jellyfin.Data.csproj @@ -38,6 +38,10 @@ + + + + diff --git a/Jellyfin.Data/UserEntityExtensions.cs b/Jellyfin.Data/UserEntityExtensions.cs new file mode 100644 index 000000000..8d84a6b6e --- /dev/null +++ b/Jellyfin.Data/UserEntityExtensions.cs @@ -0,0 +1,220 @@ +using System; +using System.ComponentModel; +using System.Linq; +using Jellyfin.Data.Entities; +using Jellyfin.Data.Enums; +using Jellyfin.Data.Interfaces; + +namespace Jellyfin.Data; + +/// +/// Contains extension methods for manipulation of entities. +/// +public static class UserEntityExtensions +{ + /// + /// The values being delimited here are Guids, so commas work as they do not appear in Guids. + /// + private const char Delimiter = ','; + + /// + /// Checks whether the user has the specified permission. + /// + /// The entity to update. + /// The permission kind. + /// True if the user has the specified permission. + public static bool HasPermission(this IHasPermissions entity, PermissionKind kind) + { + return entity.Permissions.FirstOrDefault(p => p.Kind == kind)?.Value ?? false; + } + + /// + /// Sets the given permission kind to the provided value. + /// + /// The entity to update. + /// The permission kind. + /// The value to set. + public static void SetPermission(this IHasPermissions entity, PermissionKind kind, bool value) + { + var currentPermission = entity.Permissions.FirstOrDefault(p => p.Kind == kind); + if (currentPermission is null) + { + entity.Permissions.Add(new Permission(kind, value)); + } + else + { + currentPermission.Value = value; + } + } + + /// + /// Gets the user's preferences for the given preference kind. + /// + /// The entity to update. + /// The preference kind. + /// A string array containing the user's preferences. + public static string[] GetPreference(this User entity, PreferenceKind preference) + { + var val = entity.Preferences.FirstOrDefault(p => p.Kind == preference)?.Value; + + return string.IsNullOrEmpty(val) ? Array.Empty() : val.Split(Delimiter); + } + + /// + /// Gets the user's preferences for the given preference kind. + /// + /// The entity to update. + /// The preference kind. + /// Type of preference. + /// A {T} array containing the user's preference. + public static T[] GetPreferenceValues(this User entity, PreferenceKind preference) + { + var val = entity.Preferences.FirstOrDefault(p => p.Kind == preference)?.Value; + if (string.IsNullOrEmpty(val)) + { + return Array.Empty(); + } + + // Convert array of {string} to array of {T} + var converter = TypeDescriptor.GetConverter(typeof(T)); + var stringValues = val.Split(Delimiter); + var convertedCount = 0; + var parsedValues = new T[stringValues.Length]; + for (var i = 0; i < stringValues.Length; i++) + { + try + { + var parsedValue = converter.ConvertFromString(stringValues[i].Trim()); + if (parsedValue is not null) + { + parsedValues[convertedCount++] = (T)parsedValue; + } + } + catch (FormatException) + { + // Unable to convert value + } + } + + return parsedValues[..convertedCount]; + } + + /// + /// Sets the specified preference to the given value. + /// + /// The entity to update. + /// The preference kind. + /// The values. + public static void SetPreference(this User entity, PreferenceKind preference, string[] values) + { + var value = string.Join(Delimiter, values); + var currentPreference = entity.Preferences.FirstOrDefault(p => p.Kind == preference); + if (currentPreference is null) + { + entity.Preferences.Add(new Preference(preference, value)); + } + else + { + currentPreference.Value = value; + } + } + + /// + /// Sets the specified preference to the given value. + /// + /// The entity to update. + /// The preference kind. + /// The values. + /// The type of value. + public static void SetPreference(this User entity, PreferenceKind preference, T[] values) + { + var value = string.Join(Delimiter, values); + var currentPreference = entity.Preferences.FirstOrDefault(p => p.Kind == preference); + if (currentPreference is null) + { + entity.Preferences.Add(new Preference(preference, value)); + } + else + { + currentPreference.Value = value; + } + } + + /// + /// Checks whether this user is currently allowed to use the server. + /// + /// The entity to update. + /// True if the current time is within an access schedule, or there are no access schedules. + public static bool IsParentalScheduleAllowed(this User entity) + { + return entity.AccessSchedules.Count == 0 + || entity.AccessSchedules.Any(i => IsParentalScheduleAllowed(i, DateTime.UtcNow)); + } + + /// + /// Checks whether the provided folder is in this user's grouped folders. + /// + /// The entity to update. + /// The Guid of the folder. + /// True if the folder is in the user's grouped folders. + public static bool IsFolderGrouped(this User entity, Guid id) + { + return Array.IndexOf(GetPreferenceValues(entity, PreferenceKind.GroupedFolders), id) != -1; + } + + /// + /// Initializes the default permissions for a user. Should only be called on user creation. + /// + /// The entity to update. + // TODO: make these user configurable? + public static void AddDefaultPermissions(this User entity) + { + entity.Permissions.Add(new Permission(PermissionKind.IsAdministrator, false)); + entity.Permissions.Add(new Permission(PermissionKind.IsDisabled, false)); + entity.Permissions.Add(new Permission(PermissionKind.IsHidden, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableAllChannels, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableAllDevices, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableAllFolders, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableContentDeletion, false)); + entity.Permissions.Add(new Permission(PermissionKind.EnableContentDownloading, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableMediaConversion, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableMediaPlayback, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnablePlaybackRemuxing, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnablePublicSharing, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableRemoteAccess, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableSyncTranscoding, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableAudioPlaybackTranscoding, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableLiveTvAccess, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableLiveTvManagement, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableSharedDeviceControl, true)); + entity.Permissions.Add(new Permission(PermissionKind.EnableVideoPlaybackTranscoding, true)); + entity.Permissions.Add(new Permission(PermissionKind.ForceRemoteSourceTranscoding, false)); + entity.Permissions.Add(new Permission(PermissionKind.EnableRemoteControlOfOtherUsers, false)); + entity.Permissions.Add(new Permission(PermissionKind.EnableCollectionManagement, false)); + entity.Permissions.Add(new Permission(PermissionKind.EnableSubtitleManagement, false)); + entity.Permissions.Add(new Permission(PermissionKind.EnableLyricManagement, false)); + } + + /// + /// Initializes the default preferences. Should only be called on user creation. + /// + /// The entity to update. + public static void AddDefaultPreferences(this User entity) + { + foreach (var val in Enum.GetValues()) + { + entity.Preferences.Add(new Preference(val, string.Empty)); + } + } + + private static bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date) + { + var localTime = date.ToLocalTime(); + var hour = localTime.TimeOfDay.TotalHours; + var currentDayOfWeek = localTime.DayOfWeek; + + return schedule.DayOfWeek.Contains(currentDayOfWeek) + && hour >= schedule.StartHour + && hour <= schedule.EndHour; + } +} -- cgit v1.2.3