mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 13:58:29 +01:00
Moved Database projects under /src
removed old pgsql references
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing artwork.
|
||||
/// </summary>
|
||||
public class Artwork : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Artwork"/> class.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="kind">The kind of art.</param>
|
||||
public Artwork(string path, ArtKind kind)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
Path = path;
|
||||
Kind = kind;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the kind of artwork.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public ArtKind Kind { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a book.
|
||||
/// </summary>
|
||||
public class Book : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Book"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public Book(Library library) : base(library)
|
||||
{
|
||||
BookMetadata = new HashSet<BookMetadata>();
|
||||
Releases = new HashSet<Release>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the metadata for this book.
|
||||
/// </summary>
|
||||
public virtual ICollection<BookMetadata> BookMetadata { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity containing metadata for a book.
|
||||
/// </summary>
|
||||
public class BookMetadata : ItemMetadata, IHasCompanies
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BookMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public BookMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
Publishers = new HashSet<Company>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ISBN.
|
||||
/// </summary>
|
||||
public long? Isbn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of the publishers for this book.
|
||||
/// </summary>
|
||||
public virtual ICollection<Company> Publishers { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ICollection<Company> Companies => Publishers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a chapter.
|
||||
/// </summary>
|
||||
public class Chapter : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Chapter"/> class.
|
||||
/// </summary>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
/// <param name="startTime">The start time for this chapter.</param>
|
||||
public Chapter(string language, long startTime)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(language);
|
||||
|
||||
Language = language;
|
||||
StartTime = startTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Min length = 3, Max length = 3
|
||||
/// ISO-639-3 3-character language codes.
|
||||
/// </remarks>
|
||||
[MinLength(3)]
|
||||
[MaxLength(3)]
|
||||
[StringLength(3)]
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start time.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public long StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the end time.
|
||||
/// </summary>
|
||||
public long? EndTime { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#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
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a collection.
|
||||
/// </summary>
|
||||
public class Collection : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Collection"/> class.
|
||||
/// </summary>
|
||||
public Collection()
|
||||
{
|
||||
Items = new HashSet<CollectionItem>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing this collection's items.
|
||||
/// </summary>
|
||||
public virtual ICollection<CollectionItem> Items { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a collection item.
|
||||
/// </summary>
|
||||
public class CollectionItem : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CollectionItem"/> class.
|
||||
/// </summary>
|
||||
/// <param name="libraryItem">The library item.</param>
|
||||
public CollectionItem(LibraryItem libraryItem)
|
||||
{
|
||||
LibraryItem = libraryItem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the library item.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public virtual LibraryItem LibraryItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the next item in the collection.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO check if this properly updated Dependent and has the proper principal relationship.
|
||||
/// </remarks>
|
||||
public virtual CollectionItem? Next { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the previous item in the collection.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO check if this properly updated Dependent and has the proper principal relationship.
|
||||
/// </remarks>
|
||||
public virtual CollectionItem? Previous { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a company.
|
||||
/// </summary>
|
||||
public class Company : IHasCompanies, IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Company"/> class.
|
||||
/// </summary>
|
||||
public Company()
|
||||
{
|
||||
CompanyMetadata = new HashSet<CompanyMetadata>();
|
||||
ChildCompanies = new HashSet<Company>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the metadata.
|
||||
/// </summary>
|
||||
public virtual ICollection<CompanyMetadata> CompanyMetadata { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing this company's child companies.
|
||||
/// </summary>
|
||||
public virtual ICollection<Company> ChildCompanies { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ICollection<Company> Companies => ChildCompanies;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity holding metadata for a <see cref="Company"/>.
|
||||
/// </summary>
|
||||
public class CompanyMetadata : ItemMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CompanyMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public CompanyMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the headquarters.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 255.
|
||||
/// </remarks>
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string? Headquarters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the country code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 2.
|
||||
/// </remarks>
|
||||
[MaxLength(2)]
|
||||
[StringLength(2)]
|
||||
public string? Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the homepage.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Homepage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a custom item.
|
||||
/// </summary>
|
||||
public class CustomItem : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomItem"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public CustomItem(Library library) : base(library)
|
||||
{
|
||||
CustomItemMetadata = new HashSet<CustomItemMetadata>();
|
||||
Releases = new HashSet<Release>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the metadata for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<CustomItemMetadata> CustomItemMetadata { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity containing metadata for a custom item.
|
||||
/// </summary>
|
||||
public class CustomItemMetadata : ItemMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomItemMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public CustomItemMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing an episode.
|
||||
/// </summary>
|
||||
public class Episode : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Episode"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public Episode(Library library) : base(library)
|
||||
{
|
||||
Releases = new HashSet<Release>();
|
||||
EpisodeMetadata = new HashSet<EpisodeMetadata>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode number.
|
||||
/// </summary>
|
||||
public int? EpisodeNumber { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the metadata for this episode.
|
||||
/// </summary>
|
||||
public virtual ICollection<EpisodeMetadata> EpisodeMetadata { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity containing metadata for an <see cref="Episode"/>.
|
||||
/// </summary>
|
||||
public class EpisodeMetadata : ItemMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EpisodeMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public EpisodeMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the outline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Outline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the plot.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string? Plot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tagline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Tagline { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a genre.
|
||||
/// </summary>
|
||||
public class Genre : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Genre"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
public Genre(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Indexed, Required, Max length = 255.
|
||||
/// </remarks>
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An abstract class that holds metadata.
|
||||
/// </summary>
|
||||
public abstract class ItemMetadata : IHasArtwork, IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ItemMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
protected ItemMetadata(string title, string language)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(title);
|
||||
ArgumentException.ThrowIfNullOrEmpty(language);
|
||||
|
||||
Title = title;
|
||||
Language = language;
|
||||
DateAdded = DateTime.UtcNow;
|
||||
DateModified = DateAdded;
|
||||
|
||||
PersonRoles = new HashSet<PersonRole>();
|
||||
Genres = new HashSet<Genre>();
|
||||
Artwork = new HashSet<Artwork>();
|
||||
Ratings = new HashSet<Rating>();
|
||||
Sources = new HashSet<MetadataProviderId>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the original title.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sort title.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? SortTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Min length = 3, Max length = 3.
|
||||
/// ISO-639-3 3-character language codes.
|
||||
/// </remarks>
|
||||
[MinLength(3)]
|
||||
[MaxLength(3)]
|
||||
[StringLength(3)]
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the release date.
|
||||
/// </summary>
|
||||
public DateTimeOffset? ReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date added.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public DateTime DateAdded { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date modified.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the person roles for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<PersonRole> PersonRoles { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the genres for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<Genre> Genres { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Artwork> Artwork { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the ratings for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<Rating> Ratings { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the metadata sources for this item.
|
||||
/// </summary>
|
||||
public virtual ICollection<MetadataProviderId> Sources { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a library.
|
||||
/// </summary>
|
||||
public class Library : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Library"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the library.</param>
|
||||
/// <param name="path">The path of the library.</param>
|
||||
public Library(string name, string path)
|
||||
{
|
||||
Name = name;
|
||||
Path = path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 128.
|
||||
/// </remarks>
|
||||
[MaxLength(128)]
|
||||
[StringLength(128)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the root path of the library.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a library item.
|
||||
/// </summary>
|
||||
public abstract class LibraryItem : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryItem"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library of this item.</param>
|
||||
protected LibraryItem(Library library)
|
||||
{
|
||||
DateAdded = DateTime.UtcNow;
|
||||
Library = library;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date this library item was added.
|
||||
/// </summary>
|
||||
public DateTime DateAdded { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the library of this item.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public virtual Library Library { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a file on disk.
|
||||
/// </summary>
|
||||
public class MediaFile : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MediaFile"/> class.
|
||||
/// </summary>
|
||||
/// <param name="path">The path relative to the LibraryRoot.</param>
|
||||
/// <param name="kind">The file kind.</param>
|
||||
public MediaFile(string path, MediaFileKind kind)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
Path = path;
|
||||
Kind = kind;
|
||||
|
||||
MediaFileStreams = new HashSet<MediaFileStream>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path relative to the library root.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the kind of media file.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public MediaFileKind Kind { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the streams in this file.
|
||||
/// </summary>
|
||||
public virtual ICollection<MediaFileStream> MediaFileStreams { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#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
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a stream in a media file.
|
||||
/// </summary>
|
||||
public class MediaFileStream : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MediaFileStream"/> class.
|
||||
/// </summary>
|
||||
/// <param name="streamNumber">The number of this stream.</param>
|
||||
public MediaFileStream(int streamNumber)
|
||||
{
|
||||
StreamNumber = streamNumber;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the stream number.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public int StreamNumber { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a metadata provider.
|
||||
/// </summary>
|
||||
public class MetadataProvider : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MetadataProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the metadata provider.</param>
|
||||
public MetadataProvider(string name)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(name);
|
||||
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a unique identifier for a metadata provider.
|
||||
/// </summary>
|
||||
public class MetadataProviderId : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MetadataProviderId"/> class.
|
||||
/// </summary>
|
||||
/// <param name="providerId">The provider id.</param>
|
||||
/// <param name="metadataProvider">The metadata provider.</param>
|
||||
public MetadataProviderId(string providerId, MetadataProvider metadataProvider)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(providerId);
|
||||
|
||||
ProviderId = providerId;
|
||||
MetadataProvider = metadataProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the provider id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 255.
|
||||
/// </remarks>
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string ProviderId { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the metadata provider.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public virtual MetadataProvider MetadataProvider { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a movie.
|
||||
/// </summary>
|
||||
public class Movie : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Movie"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public Movie(Library library) : base(library)
|
||||
{
|
||||
Releases = new HashSet<Release>();
|
||||
MovieMetadata = new HashSet<MovieMetadata>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the metadata for this movie.
|
||||
/// </summary>
|
||||
public virtual ICollection<MovieMetadata> MovieMetadata { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity holding the metadata for a movie.
|
||||
/// </summary>
|
||||
public class MovieMetadata : ItemMetadata, IHasCompanies
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MovieMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the movie.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public MovieMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
Studios = new HashSet<Company>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the outline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Outline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tagline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Tagline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the plot.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string? Plot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the country code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 2.
|
||||
/// </remarks>
|
||||
[MaxLength(2)]
|
||||
[StringLength(2)]
|
||||
public string? Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the studios that produced this movie.
|
||||
/// </summary>
|
||||
public virtual ICollection<Company> Studios { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ICollection<Company> Companies => Studios;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a music album.
|
||||
/// </summary>
|
||||
public class MusicAlbum : LibraryItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MusicAlbum"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public MusicAlbum(Library library) : base(library)
|
||||
{
|
||||
MusicAlbumMetadata = new HashSet<MusicAlbumMetadata>();
|
||||
Tracks = new HashSet<Track>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the album metadata.
|
||||
/// </summary>
|
||||
public virtual ICollection<MusicAlbumMetadata> MusicAlbumMetadata { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the tracks.
|
||||
/// </summary>
|
||||
public virtual ICollection<Track> Tracks { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity holding the metadata for a music album.
|
||||
/// </summary>
|
||||
public class MusicAlbumMetadata : ItemMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MusicAlbumMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the album.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public MusicAlbumMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
Labels = new HashSet<Company>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the barcode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 255.
|
||||
/// </remarks>
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string? Barcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the label number.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 255.
|
||||
/// </remarks>
|
||||
[MaxLength(255)]
|
||||
[StringLength(255)]
|
||||
public string? LabelNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the country code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 2.
|
||||
/// </remarks>
|
||||
[MaxLength(2)]
|
||||
[StringLength(2)]
|
||||
public string? Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the labels.
|
||||
/// </summary>
|
||||
public virtual ICollection<Company> Labels { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a person.
|
||||
/// </summary>
|
||||
public class Person : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Person"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the person.</param>
|
||||
public Person(string name)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(name);
|
||||
|
||||
Name = name;
|
||||
DateAdded = DateTime.UtcNow;
|
||||
DateModified = DateAdded;
|
||||
|
||||
Sources = new HashSet<MetadataProviderId>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the source id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 255.
|
||||
/// </remarks>
|
||||
[MaxLength(256)]
|
||||
[StringLength(256)]
|
||||
public string? SourceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date added.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public DateTime DateAdded { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date modified.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of metadata sources for this person.
|
||||
/// </summary>
|
||||
public virtual ICollection<MetadataProviderId> Sources { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a person's role in media.
|
||||
/// </summary>
|
||||
public class PersonRole : IHasArtwork, IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PersonRole"/> class.
|
||||
/// </summary>
|
||||
/// <param name="type">The role type.</param>
|
||||
/// <param name="person">The person.</param>
|
||||
public PersonRole(PersonRoleType type, Person person)
|
||||
{
|
||||
Type = type;
|
||||
Person = person;
|
||||
Artwork = new HashSet<Artwork>();
|
||||
Sources = new HashSet<MetadataProviderId>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the person's role.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the person's role type.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public PersonRoleType Type { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the person.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public virtual Person Person { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Artwork> Artwork { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the metadata sources for this person role.
|
||||
/// </summary>
|
||||
public virtual ICollection<MetadataProviderId> Sources { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a photo.
|
||||
/// </summary>
|
||||
public class Photo : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Photo"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public Photo(Library library) : base(library)
|
||||
{
|
||||
PhotoMetadata = new HashSet<PhotoMetadata>();
|
||||
Releases = new HashSet<Release>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the photo metadata.
|
||||
/// </summary>
|
||||
public virtual ICollection<PhotoMetadata> PhotoMetadata { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity that holds metadata for a photo.
|
||||
/// </summary>
|
||||
public class PhotoMetadata : ItemMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PhotoMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the photo.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public PhotoMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a rating for an entity.
|
||||
/// </summary>
|
||||
public class Rating : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Rating"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
public Rating(double value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public double Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of votes.
|
||||
/// </summary>
|
||||
public int? Votes { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the rating type.
|
||||
/// If this is <c>null</c> it's the internal user rating.
|
||||
/// </summary>
|
||||
public virtual RatingSource? RatingType { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the entity to store review ratings, not age ratings.
|
||||
/// </summary>
|
||||
public class RatingSource : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RatingSource"/> class.
|
||||
/// </summary>
|
||||
/// <param name="minimumValue">The minimum value.</param>
|
||||
/// <param name="maximumValue">The maximum value.</param>
|
||||
public RatingSource(double minimumValue, double maximumValue)
|
||||
{
|
||||
MinimumValue = minimumValue;
|
||||
MaximumValue = maximumValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public double MinimumValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required.
|
||||
/// </remarks>
|
||||
public double MaximumValue { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the metadata source.
|
||||
/// </summary>
|
||||
public virtual MetadataProviderId? Source { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a release for a library item, eg. Director's cut vs. standard.
|
||||
/// </summary>
|
||||
public class Release : IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Release"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of this release.</param>
|
||||
public Release(string name)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(name);
|
||||
|
||||
Name = name;
|
||||
|
||||
MediaFiles = new HashSet<MediaFile>();
|
||||
Chapters = new HashSet<Chapter>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity, Indexed, Required.
|
||||
/// </remarks>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required, Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the media files for this release.
|
||||
/// </summary>
|
||||
public virtual ICollection<MediaFile> MediaFiles { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the chapters for this release.
|
||||
/// </summary>
|
||||
public virtual ICollection<Chapter> Chapters { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a season.
|
||||
/// </summary>
|
||||
public class Season : LibraryItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Season"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public Season(Library library) : base(library)
|
||||
{
|
||||
Episodes = new HashSet<Episode>();
|
||||
SeasonMetadata = new HashSet<SeasonMetadata>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the season number.
|
||||
/// </summary>
|
||||
public int? SeasonNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the season metadata.
|
||||
/// </summary>
|
||||
public virtual ICollection<SeasonMetadata> SeasonMetadata { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the number of episodes.
|
||||
/// </summary>
|
||||
public virtual ICollection<Episode> Episodes { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity that holds metadata for seasons.
|
||||
/// </summary>
|
||||
public class SeasonMetadata : ItemMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeasonMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public SeasonMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the outline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Outline { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a series.
|
||||
/// </summary>
|
||||
public class Series : LibraryItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Series"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public Series(Library library) : base(library)
|
||||
{
|
||||
Seasons = new HashSet<Season>();
|
||||
SeriesMetadata = new HashSet<SeriesMetadata>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the days of week.
|
||||
/// </summary>
|
||||
public DayOfWeek? AirsDayOfWeek { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time the show airs, ignore the date portion.
|
||||
/// </summary>
|
||||
public DateTimeOffset? AirsTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date the series first aired.
|
||||
/// </summary>
|
||||
public DateTime? FirstAired { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the series metadata.
|
||||
/// </summary>
|
||||
public virtual ICollection<SeriesMetadata> SeriesMetadata { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the seasons.
|
||||
/// </summary>
|
||||
public virtual ICollection<Season> Seasons { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing series metadata.
|
||||
/// </summary>
|
||||
public class SeriesMetadata : ItemMetadata, IHasCompanies
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeriesMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public SeriesMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
Networks = new HashSet<Company>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the outline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Outline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the plot.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 65535.
|
||||
/// </remarks>
|
||||
[MaxLength(65535)]
|
||||
[StringLength(65535)]
|
||||
public string? Plot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tagline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 1024.
|
||||
/// </remarks>
|
||||
[MaxLength(1024)]
|
||||
[StringLength(1024)]
|
||||
public string? Tagline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the country code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Max length = 2.
|
||||
/// </remarks>
|
||||
[MaxLength(2)]
|
||||
[StringLength(2)]
|
||||
public string? Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the networks.
|
||||
/// </summary>
|
||||
public virtual ICollection<Company> Networks { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ICollection<Company> Companies => Networks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using Jellyfin.Data.Interfaces;
|
||||
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity representing a track.
|
||||
/// </summary>
|
||||
public class Track : LibraryItem, IHasReleases
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Track"/> class.
|
||||
/// </summary>
|
||||
/// <param name="library">The library.</param>
|
||||
public Track(Library library) : base(library)
|
||||
{
|
||||
Releases = new HashSet<Release>();
|
||||
TrackMetadata = new HashSet<TrackMetadata>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the track number.
|
||||
/// </summary>
|
||||
public int? TrackNumber { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual ICollection<Release> Releases { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection containing the track metadata.
|
||||
/// </summary>
|
||||
public virtual ICollection<TrackMetadata> TrackMetadata { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace Jellyfin.Data.Entities.Libraries
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity holding metadata for a track.
|
||||
/// </summary>
|
||||
public class TrackMetadata : ItemMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TrackMetadata"/> class.
|
||||
/// </summary>
|
||||
/// <param name="title">The title or name of the object.</param>
|
||||
/// <param name="language">ISO-639-3 3-character language codes.</param>
|
||||
public TrackMetadata(string title, string language) : base(title, language)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user