diff --git a/back/Kyoo.ruleset b/back/Kyoo.ruleset
index 13d29e23..9a9c6d14 100644
--- a/back/Kyoo.ruleset
+++ b/back/Kyoo.ruleset
@@ -33,10 +33,11 @@
+
+
-
diff --git a/back/src/Kyoo.Abstractions/Controllers/ILibraryManager.cs b/back/src/Kyoo.Abstractions/Controllers/ILibraryManager.cs
index 194fc2b4..646f44ca 100644
--- a/back/src/Kyoo.Abstractions/Controllers/ILibraryManager.cs
+++ b/back/src/Kyoo.Abstractions/Controllers/ILibraryManager.cs
@@ -20,7 +20,6 @@ using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
-using JetBrains.Annotations;
using Kyoo.Abstractions.Models;
using Kyoo.Abstractions.Models.Exceptions;
@@ -40,11 +39,6 @@ namespace Kyoo.Abstractions.Controllers
IRepository GetRepository()
where T : class, IResource;
- ///
- /// The repository that handle libraries.
- ///
- ILibraryRepository LibraryRepository { get; }
-
///
/// The repository that handle libraries items (a wrapper around shows and collections).
///
@@ -55,6 +49,11 @@ namespace Kyoo.Abstractions.Controllers
///
ICollectionRepository CollectionRepository { get; }
+ ///
+ /// The repository that handle shows.
+ ///
+ IMovieRepository MovieRepository { get; }
+
///
/// The repository that handle shows.
///
@@ -80,11 +79,6 @@ namespace Kyoo.Abstractions.Controllers
///
IStudioRepository StudioRepository { get; }
- ///
- /// The repository that handle genres.
- ///
- IGenreRepository GenreRepository { get; }
-
///
/// The repository that handle users.
///
@@ -97,7 +91,6 @@ namespace Kyoo.Abstractions.Controllers
/// The type of the resource
/// If the item is not found
/// The resource found
- [ItemNotNull]
Task Get(int id)
where T : class, IResource;
@@ -108,7 +101,6 @@ namespace Kyoo.Abstractions.Controllers
/// The type of the resource
/// If the item is not found
/// The resource found
- [ItemNotNull]
Task Get(string slug)
where T : class, IResource;
@@ -119,7 +111,6 @@ namespace Kyoo.Abstractions.Controllers
/// The type of the resource
/// If the item is not found
/// The first resource found that match the where function
- [ItemNotNull]
Task Get(Expression> where)
where T : class, IResource;
@@ -130,7 +121,6 @@ namespace Kyoo.Abstractions.Controllers
/// The season's number
/// If the item is not found
/// The season found
- [ItemNotNull]
Task Get(int showID, int seasonNumber);
///
@@ -140,7 +130,6 @@ namespace Kyoo.Abstractions.Controllers
/// The season's number
/// If the item is not found
/// The season found
- [ItemNotNull]
Task Get(string showSlug, int seasonNumber);
///
@@ -151,7 +140,6 @@ namespace Kyoo.Abstractions.Controllers
/// The episode's number
/// If the item is not found
/// The episode found
- [ItemNotNull]
Task Get(int showID, int seasonNumber, int episodeNumber);
///
@@ -162,7 +150,6 @@ namespace Kyoo.Abstractions.Controllers
/// The episode's number
/// If the item is not found
/// The episode found
- [ItemNotNull]
Task Get(string showSlug, int seasonNumber, int episodeNumber);
///
@@ -171,8 +158,7 @@ namespace Kyoo.Abstractions.Controllers
/// The id of the resource
/// The type of the resource
/// The resource found
- [ItemCanBeNull]
- Task GetOrDefault(int id)
+ Task GetOrDefault(int id)
where T : class, IResource;
///
@@ -181,8 +167,7 @@ namespace Kyoo.Abstractions.Controllers
/// The slug of the resource
/// The type of the resource
/// The resource found
- [ItemCanBeNull]
- Task GetOrDefault(string slug)
+ Task GetOrDefault(string slug)
where T : class, IResource;
///
@@ -192,8 +177,7 @@ namespace Kyoo.Abstractions.Controllers
/// A custom sort method to handle cases where multiples items match the filters.
/// The type of the resource
/// The first resource found that match the where function
- [ItemCanBeNull]
- Task GetOrDefault(Expression> where, Sort sortBy = default)
+ Task GetOrDefault(Expression> where, Sort? sortBy = default)
where T : class, IResource;
///
@@ -202,8 +186,7 @@ namespace Kyoo.Abstractions.Controllers
/// The id of the show
/// The season's number
/// The season found
- [ItemCanBeNull]
- Task GetOrDefault(int showID, int seasonNumber);
+ Task GetOrDefault(int showID, int seasonNumber);
///
/// Get a season from it's show slug and it's seasonNumber or null if it is not found.
@@ -211,8 +194,7 @@ namespace Kyoo.Abstractions.Controllers
/// The slug of the show
/// The season's number
/// The season found
- [ItemCanBeNull]
- Task GetOrDefault(string showSlug, int seasonNumber);
+ Task GetOrDefault(string showSlug, int seasonNumber);
///
/// Get a episode from it's showID, it's seasonNumber and it's episode number or null if it is not found.
@@ -221,8 +203,7 @@ namespace Kyoo.Abstractions.Controllers
/// The season's number
/// The episode's number
/// The episode found
- [ItemCanBeNull]
- Task GetOrDefault(int showID, int seasonNumber, int episodeNumber);
+ Task GetOrDefault(int showID, int seasonNumber, int episodeNumber);
///
/// Get a episode from it's show slug, it's seasonNumber and it's episode number or null if it is not found.
@@ -231,8 +212,7 @@ namespace Kyoo.Abstractions.Controllers
/// The season's number
/// The episode's number
/// The episode found
- [ItemCanBeNull]
- Task GetOrDefault(string showSlug, int seasonNumber, int episodeNumber);
+ Task GetOrDefault(string showSlug, int seasonNumber, int episodeNumber);
///
/// Load a related resource
@@ -248,7 +228,7 @@ namespace Kyoo.Abstractions.Controllers
///
///
///
- Task Load([NotNull] T obj, Expression> member, bool force = false)
+ Task Load(T obj, Expression> member, bool force = false)
where T : class, IResource
where T2 : class, IResource;
@@ -266,7 +246,7 @@ namespace Kyoo.Abstractions.Controllers
///
///
///
- Task Load([NotNull] T obj, Expression>> member, bool force = false)
+ Task Load(T obj, Expression>> member, bool force = false)
where T : class, IResource
where T2 : class;
@@ -283,7 +263,7 @@ namespace Kyoo.Abstractions.Controllers
///
///
///
- Task Load([NotNull] T obj, string memberName, bool force = false)
+ Task Load(T obj, string memberName, bool force = false)
where T : class, IResource;
///
@@ -298,35 +278,7 @@ namespace Kyoo.Abstractions.Controllers
///
///
/// A representing the asynchronous operation.
- Task Load([NotNull] IResource obj, string memberName, bool force = false);
-
- ///
- /// Get items (A wrapper around shows or collections) from a library.
- ///
- /// The ID of the library
- /// A filter function
- /// Sort information (sort order and sort by)
- /// How many items to return and where to start
- /// No library exist with the given ID.
- /// A list of items that match every filters
- Task> GetItemsFromLibrary(int id,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
-
- ///
- /// Get items (A wrapper around shows or collections) from a library.
- ///
- /// The slug of the library
- /// A filter function
- /// Sort information (sort order and sort by)
- /// How many items to return and where to start
- /// No library exist with the given slug.
- /// A list of items that match every filters
- Task> GetItemsFromLibrary(string slug,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Task Load(IResource obj, string memberName, bool force = false);
///
/// Get people's roles from a show.
@@ -338,9 +290,9 @@ namespace Kyoo.Abstractions.Controllers
/// No exist with the given ID.
/// A list of items that match every filters
Task> GetPeopleFromShow(int showID,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
///
/// Get people's roles from a show.
@@ -352,9 +304,9 @@ namespace Kyoo.Abstractions.Controllers
/// No exist with the given slug.
/// A list of items that match every filters
Task> GetPeopleFromShow(string showSlug,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
///
/// Get people's roles from a person.
@@ -366,9 +318,9 @@ namespace Kyoo.Abstractions.Controllers
/// No exist with the given ID.
/// A list of items that match every filters
Task> GetRolesFromPeople(int id,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
///
/// Get people's roles from a person.
@@ -380,27 +332,9 @@ namespace Kyoo.Abstractions.Controllers
/// No exist with the given slug.
/// A list of items that match every filters
Task> GetRolesFromPeople(string slug,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
-
- ///
- /// Setup relations between a show, a library and a collection
- ///
- /// The show's ID to setup relations with
- /// The library's ID to setup relations with (optional)
- /// The collection's ID to setup relations with (optional)
- /// A representing the asynchronous operation.
- Task AddShowLink(int showID, int? libraryID, int? collectionID);
-
- ///
- /// Setup relations between a show, a library and a collection
- ///
- /// The show to setup relations with
- /// The library to setup relations with (optional)
- /// The collection to setup relations with (optional)
- /// A representing the asynchronous operation.
- Task AddShowLink([NotNull] Show show, Library library, Collection collection);
+ Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
///
/// Get all resources with filters
@@ -410,9 +344,9 @@ namespace Kyoo.Abstractions.Controllers
/// How many items to return and where to start
/// The type of resources to load
/// A list of resources that match every filters
- Task> GetAll(Expression> where = null,
- Sort sort = default,
- Pagination limit = default)
+ Task> GetAll(Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default)
where T : class, IResource;
///
@@ -421,7 +355,7 @@ namespace Kyoo.Abstractions.Controllers
/// A filter function
/// The type of resources to load
/// A list of resources that match every filters
- Task GetCount(Expression> where = null)
+ Task GetCount(Expression>? where = null)
where T : class, IResource;
///
@@ -439,7 +373,7 @@ namespace Kyoo.Abstractions.Controllers
/// The item to register
/// The type of resource
/// The resource registers and completed by database's information (related items and so on)
- Task Create([NotNull] T item)
+ Task Create(T item)
where T : class, IResource;
///
@@ -448,7 +382,7 @@ namespace Kyoo.Abstractions.Controllers
/// The item to register
/// The type of resource
/// The newly created item or the existing value if it existed.
- Task CreateIfNotExists([NotNull] T item)
+ Task CreateIfNotExists(T item)
where T : class, IResource;
///
diff --git a/back/src/Kyoo.Abstractions/Controllers/IRepository.cs b/back/src/Kyoo.Abstractions/Controllers/IRepository.cs
index 5c8e438d..ead00dbf 100644
--- a/back/src/Kyoo.Abstractions/Controllers/IRepository.cs
+++ b/back/src/Kyoo.Abstractions/Controllers/IRepository.cs
@@ -20,7 +20,6 @@ using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
-using JetBrains.Annotations;
using Kyoo.Abstractions.Models;
using Kyoo.Abstractions.Models.Exceptions;
@@ -45,7 +44,6 @@ namespace Kyoo.Abstractions.Controllers
/// The id of the resource
/// If the item could not be found.
/// The resource found
- [ItemNotNull]
Task Get(int id);
///
@@ -54,7 +52,6 @@ namespace Kyoo.Abstractions.Controllers
/// The slug of the resource
/// If the item could not be found.
/// The resource found
- [ItemNotNull]
Task Get(string slug);
///
@@ -63,7 +60,6 @@ namespace Kyoo.Abstractions.Controllers
/// A predicate to filter the resource.
/// If the item could not be found.
/// The resource found
- [ItemNotNull]
Task Get(Expression> where);
///
@@ -71,16 +67,14 @@ namespace Kyoo.Abstractions.Controllers
///
/// The id of the resource
/// The resource found
- [ItemCanBeNull]
- Task GetOrDefault(int id);
+ Task GetOrDefault(int id);
///
/// Get a resource from it's slug or null if it is not found.
///
/// The slug of the resource
/// The resource found
- [ItemCanBeNull]
- Task GetOrDefault(string slug);
+ Task GetOrDefault(string slug);
///
/// Get the first resource that match the predicate or null if it is not found.
@@ -88,15 +82,13 @@ namespace Kyoo.Abstractions.Controllers
/// A predicate to filter the resource.
/// A custom sort method to handle cases where multiples items match the filters.
/// The resource found
- [ItemCanBeNull]
- Task GetOrDefault(Expression> where, Sort sortBy = default);
+ Task GetOrDefault(Expression> where, Sort? sortBy = default);
///
/// Search for resources.
///
/// The query string.
/// A list of resources found
- [ItemNotNull]
Task> Search(string query);
///
@@ -106,33 +98,30 @@ namespace Kyoo.Abstractions.Controllers
/// Sort information about the query (sort by, sort order)
/// How pagination should be done (where to start and how many to return)
/// A list of resources that match every filters
- [ItemNotNull]
- Task> GetAll(Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Task> GetAll(Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
///
/// Get the number of resources that match the filter's predicate.
///
/// A filter predicate
/// How many resources matched that filter
- Task GetCount(Expression> where = null);
+ Task GetCount(Expression>? where = null);
///
/// Create a new resource.
///
/// The item to register
/// The resource registers and completed by database's information (related items and so on)
- [ItemNotNull]
- Task Create([NotNull] T obj);
+ Task Create(T obj);
///
/// Create a new resource if it does not exist already. If it does, the existing value is returned instead.
///
/// The object to create
/// The newly created item or the existing value if it existed.
- [ItemNotNull]
- Task CreateIfNotExists([NotNull] T obj);
+ Task CreateIfNotExists(T obj);
///
/// Called when a resource has been created.
@@ -146,8 +135,7 @@ namespace Kyoo.Abstractions.Controllers
/// Should old properties of the resource be discarded or should null values considered as not changed?
/// If the item is not found
/// The resource edited and completed by database's information (related items and so on)
- [ItemNotNull]
- Task Edit([NotNull] T edited, bool resetOld);
+ Task Edit(T edited, bool resetOld);
///
/// Called when a resource has been edited.
@@ -176,14 +164,14 @@ namespace Kyoo.Abstractions.Controllers
/// The resource to delete
/// If the item is not found
/// A representing the asynchronous operation.
- Task Delete([NotNull] T obj);
+ Task Delete(T obj);
///
/// Delete all resources that match the predicate.
///
/// A predicate to filter resources to delete. Every resource that match this will be deleted.
/// A representing the asynchronous operation.
- Task DeleteAll([NotNull] Expression> where);
+ Task DeleteAll(Expression> where);
///
/// Called when a resource has been edited.
@@ -202,21 +190,16 @@ namespace Kyoo.Abstractions.Controllers
Type RepositoryType { get; }
}
+ ///
+ /// A repository to handle shows.
+ ///
+ public interface IMovieRepository : IRepository { }
+
///
/// A repository to handle shows.
///
public interface IShowRepository : IRepository
{
- ///
- /// Link a show to a collection and/or a library. The given show is now part of those containers.
- /// If both a library and a collection are given, the collection is added to the library too.
- ///
- /// The ID of the show
- /// The ID of the library (optional)
- /// The ID of the collection (optional)
- /// A representing the asynchronous operation.
- Task AddShowLink(int showID, int? libraryID, int? collectionID);
-
///
/// Get a show's slug from it's ID.
///
@@ -330,55 +313,16 @@ namespace Kyoo.Abstractions.Controllers
Task GetAbsolute(string showSlug, int absoluteNumber);
}
- ///
- /// A repository to handle libraries.
- ///
- public interface ILibraryRepository : IRepository { }
-
///
/// A repository to handle library items (A wrapper around shows and collections).
///
- public interface ILibraryItemRepository : IRepository
- {
- ///
- /// Get items (A wrapper around shows or collections) from a library.
- ///
- /// The ID of the library
- /// A filter function
- /// Sort information (sort order and sort by)
- /// How many items to return and where to start
- /// No library exist with the given ID.
- /// A list of items that match every filters
- public Task> GetFromLibrary(int id,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
-
- ///
- /// Get items (A wrapper around shows or collections) from a library.
- ///
- /// The slug of the library
- /// A filter function
- /// Sort information (sort order and sort by)
- /// How many items to return and where to start
- /// No library exist with the given slug.
- /// A list of items that match every filters
- public Task> GetFromLibrary(string slug,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
- }
+ public interface ILibraryItemRepository : IRepository { }
///
/// A repository for collections
///
public interface ICollectionRepository : IRepository { }
- ///
- /// A repository for genres.
- ///
- public interface IGenreRepository : IRepository { }
-
///
/// A repository for studios.
///
@@ -399,9 +343,9 @@ namespace Kyoo.Abstractions.Controllers
/// No exist with the given ID.
/// A list of items that match every filters
Task> GetFromShow(int showID,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
///
/// Get people's roles from a show.
@@ -413,9 +357,9 @@ namespace Kyoo.Abstractions.Controllers
/// No exist with the given slug.
/// A list of items that match every filters
Task> GetFromShow(string showSlug,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
///
/// Get people's roles from a person.
@@ -427,9 +371,9 @@ namespace Kyoo.Abstractions.Controllers
/// No exist with the given ID.
/// A list of items that match every filters
Task> GetFromPeople(int id,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
///
/// Get people's roles from a person.
@@ -441,9 +385,9 @@ namespace Kyoo.Abstractions.Controllers
/// No exist with the given slug.
/// A list of items that match every filters
Task> GetFromPeople(string slug,
- Expression> where = null,
- Sort sort = default,
- Pagination limit = default);
+ Expression>? where = null,
+ Sort? sort = default,
+ Pagination? limit = default);
}
///
diff --git a/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj b/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
index 9d8ddb0c..3433f9f1 100644
--- a/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
+++ b/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
@@ -3,6 +3,7 @@
Kyoo.Abstractions
Base package to create plugins for Kyoo.
Kyoo.Abstractions
+ enable
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/ApiDefinitionAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/ApiDefinitionAttribute.cs
index cd946714..228dc187 100644
--- a/back/src/Kyoo.Abstractions/Models/Attributes/ApiDefinitionAttribute.cs
+++ b/back/src/Kyoo.Abstractions/Models/Attributes/ApiDefinitionAttribute.cs
@@ -32,7 +32,7 @@ namespace Kyoo.Abstractions.Models.Attributes
///
/// The public name of this api.
///
- [NotNull] public string Name { get; }
+ public string Name { get; }
///
/// The name of the group in witch this API is. You can also specify a custom sort order using the following
@@ -45,7 +45,7 @@ namespace Kyoo.Abstractions.Models.Attributes
/// Create a new .
///
/// The name of the api that will be used on the documentation page.
- public ApiDefinitionAttribute([NotNull] string name)
+ public ApiDefinitionAttribute(string name)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
diff --git a/back/src/Kyoo.Abstractions/Models/ConfigurationReference.cs b/back/src/Kyoo.Abstractions/Models/ConfigurationReference.cs
index 635bbb97..76294ca2 100644
--- a/back/src/Kyoo.Abstractions/Models/ConfigurationReference.cs
+++ b/back/src/Kyoo.Abstractions/Models/ConfigurationReference.cs
@@ -60,7 +60,7 @@ namespace Kyoo.Abstractions.Models
///
/// The type of the object
/// The list of configuration reference a type has.
- public static IEnumerable CreateReference(string path, [NotNull] Type type)
+ public static IEnumerable CreateReference(string path, Type type)
{
if (type == null)
throw new ArgumentNullException(nameof(type));
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
index 0cd21975..c608b63a 100644
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
+++ b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
@@ -36,7 +36,7 @@ namespace Kyoo.Abstractions.Models.Exceptions
/// Create a new with the default message.
///
/// The existing object.
- public DuplicatedItemException(object existing = null)
+ public DuplicatedItemException(object? existing = null)
: base("Already exists in the database.")
{
Existing = existing;
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/ILink.cs b/back/src/Kyoo.Abstractions/Models/Genre.cs
similarity index 75%
rename from back/src/Kyoo.Abstractions/Models/Resources/Interfaces/ILink.cs
rename to back/src/Kyoo.Abstractions/Models/Genre.cs
index 5c146786..2b7e16f0 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/ILink.cs
+++ b/back/src/Kyoo.Abstractions/Models/Genre.cs
@@ -19,13 +19,27 @@
namespace Kyoo.Abstractions.Models
{
///
- /// An interface to represent resources that should have a link field in their return values (like videos).
+ /// A genre that allow one to specify categories for shows.
///
- public interface ILink
+ public enum Genre
{
- ///
- /// The link to return, in most cases this should be a string.
- ///
- public object Link { get; }
+ Action,
+ Adventure,
+ Animation,
+ Comedy,
+ Crime,
+ Documentary,
+ Drama,
+ Family,
+ Fantasy,
+ History,
+ Horror,
+ Music,
+ Mystery,
+ Romance,
+ ScienceFiction,
+ Thriller,
+ War,
+ Western,
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/LibraryItem.cs b/back/src/Kyoo.Abstractions/Models/LibraryItem.cs
index 852e48f9..0b66d2e1 100644
--- a/back/src/Kyoo.Abstractions/Models/LibraryItem.cs
+++ b/back/src/Kyoo.Abstractions/Models/LibraryItem.cs
@@ -17,16 +17,13 @@
// along with Kyoo. If not, see .
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq.Expressions;
namespace Kyoo.Abstractions.Models
{
///
/// The type of item, ether a show, a movie or a collection.
///
- public enum ItemType
+ public enum ItemKind
{
///
/// The is a .
@@ -49,138 +46,67 @@ namespace Kyoo.Abstractions.Models
/// A type union between and .
/// This is used to list content put inside a library.
///
- public class LibraryItem : CustomTypeDescriptor, IResource, IThumbnails
+ public interface ILibraryItem : IResource
{
- ///
+ ///
+ /// Is the item a collection, a movie or a show?
+ ///
+ public ItemKind Kind { get; }
+
+ public string Name { get; }
+
+ public DateTime? AirDate { get; }
+
+ public Image Poster { get; }
+ }
+
+ public class BagItem : ILibraryItem
+ {
+ public ItemKind Kind { get; }
+
public int ID { get; set; }
- ///
- public string Slug { get; set; }
+ public string Slug { get; set; }
- ///
- /// The title of the show or collection.
- ///
- public string Title { get; set; }
+ public string Name { get; set; }
- ///
- /// The summary of the show or collection.
- ///
- public string Overview { get; set; }
+ public DateTime? AirDate { get; set; }
- ///
- /// Is this show airing, not aired yet or finished? This is only applicable for shows.
- ///
- public Status? Status { get; set; }
-
- ///
- /// The date this show or collection started airing. It can be null if this is unknown.
- ///
- public DateTime? StartAir { get; set; }
-
- ///
- /// The date this show or collection finished airing.
- /// It must be after the but can be the same (example: for movies).
- /// It can also be null if this is unknown.
- ///
- public DateTime? EndAir { get; set; }
-
- ///
public Image Poster { get; set; }
- ///
- public Image Thumbnail { get; set; }
+ public object Rest { get; set; }
- ///
- public Image Logo { get; set; }
-
- ///
- /// The type of this item (ether a collection, a show or a movie).
- ///
- public ItemType Type { get; set; }
-
- ///
- /// Create a new, empty .
- ///
- public LibraryItem() { }
-
- ///
- /// Create a from a show.
- ///
- /// The show that this library item should represent.
- public LibraryItem(Show show)
+ public ILibraryItem ToItem()
{
- ID = show.ID;
- Slug = show.Slug;
- Title = show.Title;
- Overview = show.Overview;
- Status = show.Status;
- StartAir = show.StartAir;
- EndAir = show.EndAir;
- Poster = show.Poster;
- Thumbnail = show.Thumbnail;
- Logo = show.Logo;
- Type = show.IsMovie ? ItemType.Movie : ItemType.Show;
- }
-
- ///
- /// Create a from a collection
- ///
- /// The collection that this library item should represent.
- public LibraryItem(Collection collection)
- {
- ID = -collection.ID;
- Slug = collection.Slug;
- Title = collection.Name;
- Overview = collection.Overview;
- Status = Models.Status.Unknown;
- StartAir = null;
- EndAir = null;
- Poster = collection.Poster;
- Thumbnail = collection.Thumbnail;
- Logo = collection.Logo;
- Type = ItemType.Collection;
- }
-
- ///
- /// An expression to create a representing a show.
- ///
- public static Expression> FromShow => x => new LibraryItem
- {
- ID = x.ID,
- Slug = x.Slug,
- Title = x.Title,
- Overview = x.Overview,
- Status = x.Status,
- StartAir = x.StartAir,
- EndAir = x.EndAir,
- Poster = x.Poster,
- Thumbnail = x.Thumbnail,
- Logo = x.Logo,
- Type = x.IsMovie ? ItemType.Movie : ItemType.Show
- };
-
- ///
- /// An expression to create a representing a collection.
- ///
- public static Expression> FromCollection => x => new LibraryItem
- {
- ID = -x.ID,
- Slug = x.Slug,
- Title = x.Name,
- Overview = x.Overview,
- Status = Models.Status.Unknown,
- StartAir = null,
- EndAir = null,
- Poster = x.Poster,
- Thumbnail = x.Thumbnail,
- Logo = x.Logo,
- Type = ItemType.Collection
- };
-
- ///
- public override string GetClassName()
- {
- return Type.ToString();
+ return Kind switch
+ {
+ ItemKind.Movie => Rest as MovieItem,
+ ItemKind.Show => Rest as ShowItem,
+ ItemKind.Collection => Rest as CollectionItem,
+ };
}
}
+
+ public sealed class ShowItem : Show, ILibraryItem
+ {
+ ///
+ public ItemKind Kind => ItemKind.Show;
+
+ public DateTime? AirDate => StartAir;
+ }
+
+ public sealed class MovieItem : Movie, ILibraryItem
+ {
+ ///
+ public ItemKind Kind => ItemKind.Movie;
+ }
+
+ public sealed class CollectionItem : Collection, ILibraryItem
+ {
+ ///
+ public ItemKind Kind => ItemKind.Collection;
+
+ public DateTime? AirDate => null;
+ }
+
}
diff --git a/back/src/Kyoo.Abstractions/Models/PeopleRole.cs b/back/src/Kyoo.Abstractions/Models/PeopleRole.cs
index 3a416927..dab757a1 100644
--- a/back/src/Kyoo.Abstractions/Models/PeopleRole.cs
+++ b/back/src/Kyoo.Abstractions/Models/PeopleRole.cs
@@ -53,12 +53,16 @@ namespace Kyoo.Abstractions.Models
///
/// The ID of the Show where the People playing in.
///
- public int ShowID { get; set; }
+ public int? ShowID { get; set; }
///
/// The show where the People played in.
///
- public Show Show { get; set; }
+ public Show? Show { get; set; }
+
+ public int? MovieID { get; set; }
+
+ public Movie? Movie { get; set; }
///
/// The type of work the person has done for the show.
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs b/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs
index e3fa14cf..a6f3043f 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs
@@ -17,7 +17,10 @@
// along with Kyoo. If not, see .
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using Kyoo.Abstractions.Models.Attributes;
+using Kyoo.Utils;
+using Newtonsoft.Json;
namespace Kyoo.Abstractions.Models
{
@@ -31,7 +34,7 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; }
///
- public string Slug { get; set; }
+ [MaxLength(256)] public string Slug { get; set; }
///
/// The name of this collection.
@@ -39,30 +42,39 @@ namespace Kyoo.Abstractions.Models
public string Name { get; set; }
///
- public Image Poster { get; set; }
+ public Image? Poster { get; set; }
///
- public Image Thumbnail { get; set; }
+ public Image? Thumbnail { get; set; }
///
- public Image Logo { get; set; }
+ public Image? Logo { get; set; }
///
/// The description of this collection.
///
- public string Overview { get; set; }
+ public string? Overview { get; set; }
+
+ ///
+ /// The list of movies contained in this collection.
+ ///
+ [LoadableRelation] public ICollection? Movies { get; set; }
///
/// The list of shows contained in this collection.
///
- [LoadableRelation] public ICollection Shows { get; set; }
-
- ///
- /// The list of libraries that contains this collection.
- ///
- [LoadableRelation] public ICollection Libraries { get; set; }
+ [LoadableRelation] public ICollection? Shows { get; set; }
///
- public Dictionary ExternalId { get; set; }
+ public Dictionary ExternalId { get; set; } = new();
+
+ public Collection() { }
+
+ [JsonConstructor]
+ public Collection(string name)
+ {
+ Slug = Utility.ToSlug(name);
+ Name = name;
+ }
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs b/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs
index 86e11442..87b20a5e 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using JetBrains.Annotations;
using Kyoo.Abstractions.Controllers;
@@ -35,24 +36,19 @@ namespace Kyoo.Abstractions.Models
///
[Computed]
+ [MaxLength(256)]
public string Slug
{
get
{
if (ShowSlug != null || Show?.Slug != null)
return GetSlug(ShowSlug ?? Show.Slug, SeasonNumber, EpisodeNumber, AbsoluteNumber);
- return ShowID != 0
- ? GetSlug(ShowID.ToString(), SeasonNumber, EpisodeNumber, AbsoluteNumber)
- : null;
+ return GetSlug(ShowID.ToString(), SeasonNumber, EpisodeNumber, AbsoluteNumber);
}
[UsedImplicitly]
- [NotNull]
private set
{
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
Match match = Regex.Match(value, @"(?.+)-s(?\d+)e(?\d+)");
if (match.Success)
@@ -80,7 +76,7 @@ namespace Kyoo.Abstractions.Models
///
/// The slug of the Show that contain this episode. If this is not set, this episode is ill-formed.
///
- [SerializeIgnore] public string ShowSlug { private get; set; }
+ [SerializeIgnore] public string? ShowSlug { private get; set; }
///
/// The ID of the Show containing this episode.
@@ -90,7 +86,7 @@ namespace Kyoo.Abstractions.Models
///
/// The show that contains this episode. This must be explicitly loaded via a call to .
///
- [LoadableRelation(nameof(ShowID))] public Show Show { get; set; }
+ [LoadableRelation(nameof(ShowID))] public Show? Show { get; set; }
///
/// The ID of the Season containing this episode.
@@ -105,7 +101,7 @@ namespace Kyoo.Abstractions.Models
/// This can be null if the season is unknown and the episode is only identified
/// by it's .
///
- [LoadableRelation(nameof(SeasonID))] public Season Season { get; set; }
+ [LoadableRelation(nameof(SeasonID))] public Season? Season { get; set; }
///
/// The season in witch this episode is in.
@@ -130,12 +126,12 @@ namespace Kyoo.Abstractions.Models
///
/// The title of this episode.
///
- public string Title { get; set; }
+ public string? Name { get; set; }
///
/// The overview of this episode.
///
- public string Overview { get; set; }
+ public string? Overview { get; set; }
///
/// The release date of this episode. It can be null if unknown.
@@ -143,16 +139,16 @@ namespace Kyoo.Abstractions.Models
public DateTime? ReleaseDate { get; set; }
///
- public Image Poster { get; set; }
+ public Image? Poster { get; set; }
///
- public Image Thumbnail { get; set; }
+ public Image? Thumbnail { get; set; }
///
- public Image Logo { get; set; }
+ public Image? Logo { get; set; }
///
- public Dictionary ExternalId { get; set; }
+ public Dictionary ExternalId { get; set; } = new();
///
/// Get the slug of an episode.
@@ -172,7 +168,7 @@ namespace Kyoo.Abstractions.Models
///
/// The slug corresponding to the given arguments
/// The given show slug was null.
- public static string GetSlug([NotNull] string showSlug,
+ public static string GetSlug(string showSlug,
int? seasonNumber,
int? episodeNumber,
int? absoluteNumber = null)
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Genre.cs b/back/src/Kyoo.Abstractions/Models/Resources/Genre.cs
deleted file mode 100644
index 5bf8ceee..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Genre.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System.Collections.Generic;
-using Kyoo.Abstractions.Models.Attributes;
-using Kyoo.Utils;
-
-namespace Kyoo.Abstractions.Models
-{
- ///
- /// A genre that allow one to specify categories for shows.
- ///
- public class Genre : IResource
- {
- ///
- public int ID { get; set; }
-
- ///
- public string Slug { get; set; }
-
- ///
- /// The name of this genre.
- ///
- public string Name { get; set; }
-
- ///
- /// The list of shows that have this genre.
- ///
- [LoadableRelation] public ICollection Shows { get; set; }
-
- ///
- /// Create a new, empty .
- ///
- public Genre() { }
-
- ///
- /// Create a new and specify it's .
- /// The is automatically calculated from it's name.
- ///
- /// The name of this genre.
- public Genre(string name)
- {
- Slug = Utility.ToSlug(name);
- Name = name;
- }
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IResource.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IResource.cs
index 509006e5..69e77f21 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IResource.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IResource.cs
@@ -16,6 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with Kyoo. If not, see .
+using System.ComponentModel.DataAnnotations;
using Kyoo.Abstractions.Controllers;
namespace Kyoo.Abstractions.Models
@@ -42,6 +43,7 @@ namespace Kyoo.Abstractions.Models
/// There is no setter for a slug since it can be computed from other fields.
/// For example, a season slug is {ShowSlug}-s{SeasonNumber}.
///
+ [MaxLength(256)]
public string Slug { get; }
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
index c69c984d..10e1b742 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
@@ -28,18 +28,18 @@ namespace Kyoo.Abstractions.Models
///
/// A poster is a 9/16 format image with the cover of the resource.
///
- public Image Poster { get; set; }
+ public Image? Poster { get; set; }
///
/// A thumbnail is a 16/9 format image, it could ether be used as a background or as a preview but it usually
/// is not an official image.
///
- public Image Thumbnail { get; set; }
+ public Image? Thumbnail { get; set; }
///
/// A logo is a small image representing the resource.
///
- public Image Logo { get; set; }
+ public Image? Logo { get; set; }
}
public class Image
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs
new file mode 100644
index 00000000..a6f8ec27
--- /dev/null
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs
@@ -0,0 +1,140 @@
+// Kyoo - A portable and vast media library solution.
+// Copyright (c) Kyoo.
+//
+// See AUTHORS.md and LICENSE file in the project root for full license information.
+//
+// Kyoo is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// Kyoo is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Kyoo. If not, see .
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using Kyoo.Abstractions.Controllers;
+using Kyoo.Abstractions.Models.Attributes;
+using Kyoo.Utils;
+using Newtonsoft.Json;
+
+namespace Kyoo.Abstractions.Models
+{
+ ///
+ /// A series or a movie.
+ ///
+ public class Movie : IResource, IMetadata, IOnMerge, IThumbnails
+ {
+ ///
+ public int ID { get; set; }
+
+ ///
+ [MaxLength(256)]
+ public string Slug { get; set; }
+
+ ///
+ /// The title of this show.
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// A catchphrase for this movie.
+ ///
+ public string? Tagline { get; set; }
+
+ ///
+ /// The list of alternative titles of this show.
+ ///
+ public string[] Aliases { get; set; } = Array.Empty();
+
+ ///
+ /// The path of the movie video file.
+ ///
+ public string Path { get; set; }
+
+ ///
+ /// The summary of this show.
+ ///
+ public string? Overview { get; set; }
+
+ ///
+ /// A list of tags that match this movie.
+ ///
+ public string[] Tags { get; set; } = Array.Empty();
+
+ ///
+ /// The list of genres (themes) this show has.
+ ///
+ public Genre[] Genres { get; set; } = Array.Empty();
+
+ ///
+ /// Is this show airing, not aired yet or finished?
+ ///
+ public Status Status { get; set; }
+
+ ///
+ /// The date this movie aired.
+ ///
+ public DateTime? AirDate { get; set; }
+
+ ///
+ public Image? Poster { get; set; }
+
+ ///
+ public Image? Thumbnail { get; set; }
+
+ ///
+ public Image? Logo { get; set; }
+
+ ///
+ /// A video of a few minutes that tease the content.
+ ///
+ public string? Trailer { get; set; }
+
+ ///
+ public Dictionary ExternalId { get; set; } = new();
+
+ ///
+ /// The ID of the Studio that made this show.
+ ///
+ [SerializeIgnore] public int? StudioID { get; set; }
+
+ ///
+ /// The Studio that made this show.
+ /// This must be explicitly loaded via a call to .
+ ///
+ [LoadableRelation(nameof(StudioID))][EditableRelation] public Studio? Studio { get; set; }
+
+ ///
+ /// The list of people that made this show.
+ ///
+ [LoadableRelation][EditableRelation] public ICollection? People { get; set; }
+
+ ///
+ /// The list of collections that contains this show.
+ ///
+ [LoadableRelation] public ICollection? Collections { get; set; }
+
+ ///
+ public void OnMerge(object merged)
+ {
+ foreach (PeopleRole link in People)
+ link.Movie = this;
+ }
+
+ public Movie() { }
+
+ [JsonConstructor]
+ public Movie(string name)
+ {
+ Slug = Utility.ToSlug(name);
+ Name = name;
+ }
+ }
+}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/People.cs b/back/src/Kyoo.Abstractions/Models/Resources/People.cs
index c5a32429..ed56d5e5 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/People.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/People.cs
@@ -17,7 +17,10 @@
// along with Kyoo. If not, see .
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using Kyoo.Abstractions.Models.Attributes;
+using Kyoo.Utils;
+using Newtonsoft.Json;
namespace Kyoo.Abstractions.Models
{
@@ -30,6 +33,7 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; }
///
+ [MaxLength(256)]
public string Slug { get; set; }
///
@@ -38,20 +42,29 @@ namespace Kyoo.Abstractions.Models
public string Name { get; set; }
///
- public Image Poster { get; set; }
+ public Image? Poster { get; set; }
///
- public Image Thumbnail { get; set; }
+ public Image? Thumbnail { get; set; }
///
- public Image Logo { get; set; }
+ public Image? Logo { get; set; }
///
- public Dictionary ExternalId { get; set; }
+ public Dictionary ExternalId { get; set; } = new();
///
/// The list of roles this person has played in. See for more information.
///
- [EditableRelation][LoadableRelation] public ICollection Roles { get; set; }
+ [EditableRelation][LoadableRelation] public ICollection? Roles { get; set; }
+
+ public People() { }
+
+ [JsonConstructor]
+ public People(string name)
+ {
+ Slug = Utility.ToSlug(name);
+ Name = name;
+ }
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Season.cs b/back/src/Kyoo.Abstractions/Models/Resources/Season.cs
index 1b31d2c3..0d0e0130 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Season.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Season.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using JetBrains.Annotations;
using Kyoo.Abstractions.Controllers;
@@ -35,6 +36,7 @@ namespace Kyoo.Abstractions.Models
///
[Computed]
+ [MaxLength(256)]
public string Slug
{
get
@@ -48,7 +50,7 @@ namespace Kyoo.Abstractions.Models
[NotNull]
private set
{
- Match match = Regex.Match(value ?? string.Empty, @"(?.+)-s(?\d+)");
+ Match match = Regex.Match(value, @"(?.+)-s(?\d+)");
if (!match.Success)
throw new ArgumentException("Invalid season slug. Format: {showSlug}-s{seasonNumber}");
@@ -60,7 +62,7 @@ namespace Kyoo.Abstractions.Models
///
/// The slug of the Show that contain this episode. If this is not set, this season is ill-formed.
///
- [SerializeIgnore] public string ShowSlug { private get; set; }
+ [SerializeIgnore] public string? ShowSlug { private get; set; }
///
/// The ID of the Show containing this season.
@@ -71,7 +73,7 @@ namespace Kyoo.Abstractions.Models
/// The show that contains this season.
/// This must be explicitly loaded via a call to .
///
- [LoadableRelation(nameof(ShowID))] public Show Show { get; set; }
+ [LoadableRelation(nameof(ShowID))] public Show? Show { get; set; }
///
/// The number of this season. This can be set to 0 to indicate specials.
@@ -81,12 +83,12 @@ namespace Kyoo.Abstractions.Models
///
/// The title of this season.
///
- public string Title { get; set; }
+ public string? Name { get; set; }
///
/// A quick overview of this season.
///
- public string Overview { get; set; }
+ public string? Overview { get; set; }
///
/// The starting air date of this season.
@@ -99,20 +101,20 @@ namespace Kyoo.Abstractions.Models
public DateTime? EndDate { get; set; }
///
- public Image Poster { get; set; }
+ public Image? Poster { get; set; }
///
- public Image Thumbnail { get; set; }
+ public Image? Thumbnail { get; set; }
///
- public Image Logo { get; set; }
+ public Image? Logo { get; set; }
///
- public Dictionary ExternalId { get; set; }
+ public Dictionary ExternalId { get; set; } = new();
///
/// The list of episodes that this season contains.
///
- [LoadableRelation] public ICollection Episodes { get; set; }
+ [LoadableRelation] public ICollection? Episodes { get; set; }
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Show.cs b/back/src/Kyoo.Abstractions/Models/Resources/Show.cs
index 0dc30b30..30da3693 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Show.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Show.cs
@@ -18,8 +18,11 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using Kyoo.Abstractions.Controllers;
using Kyoo.Abstractions.Models.Attributes;
+using Kyoo.Utils;
+using Newtonsoft.Json;
namespace Kyoo.Abstractions.Models
{
@@ -32,27 +35,38 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; }
///
+ [MaxLength(256)]
public string Slug { get; set; }
///
/// The title of this show.
///
- public string Title { get; set; }
+ public string Name { get; set; }
+
+ ///
+ /// A catchphrase for this show.
+ ///
+ public string? Tagline { get; set; }
///
/// The list of alternative titles of this show.
///
- [EditableRelation] public string[] Aliases { get; set; }
-
- ///
- /// The path of the root directory of this show.
- ///
- [SerializeIgnore] public string Path { get; set; }
+ public string[] Aliases { get; set; } = Array.Empty();
///
/// The summary of this show.
///
- public string Overview { get; set; }
+ public string? Overview { get; set; }
+
+ ///
+ /// A list of tags that match this movie.
+ ///
+ public string[] Tags { get; set; } = Array.Empty();
+
+ ///
+ /// The list of genres (themes) this show has.
+ ///
+ public Genre[] Genres { get; set; } = Array.Empty();
///
/// Is this show airing, not aired yet or finished?
@@ -71,27 +85,22 @@ namespace Kyoo.Abstractions.Models
///
public DateTime? EndAir { get; set; }
- ///
- /// True if this show represent a movie, false otherwise.
- ///
- public bool IsMovie { get; set; }
+ ///
+ public Image? Poster { get; set; }
///
- public Image Poster { get; set; }
+ public Image? Thumbnail { get; set; }
///
- public Image Thumbnail { get; set; }
-
- ///
- public Image Logo { get; set; }
+ public Image? Logo { get; set; }
///
/// A video of a few minutes that tease the content.
///
- public string Trailer { get; set; }
+ public string? Trailer { get; set; }
///
- public Dictionary ExternalId { get; set; }
+ public Dictionary ExternalId { get; set; } = new();
///
/// The ID of the Studio that made this show.
@@ -102,39 +111,29 @@ namespace Kyoo.Abstractions.Models
/// The Studio that made this show.
/// This must be explicitly loaded via a call to .
///
- [LoadableRelation(nameof(StudioID))][EditableRelation] public Studio Studio { get; set; }
-
- ///
- /// The list of genres (themes) this show has.
- ///
- [LoadableRelation][EditableRelation] public ICollection Genres { get; set; }
+ [LoadableRelation(nameof(StudioID))][EditableRelation] public Studio? Studio { get; set; }
///
/// The list of people that made this show.
///
- [LoadableRelation][EditableRelation] public ICollection People { get; set; }
+ [LoadableRelation][EditableRelation] public ICollection? People { get; set; }
///
/// The different seasons in this show. If this is a movie, this list is always null or empty.
///
- [LoadableRelation] public ICollection Seasons { get; set; }
+ [LoadableRelation] public ICollection? Seasons { get; set; }
///
/// The list of episodes in this show.
/// If this is a movie, there will be a unique episode (with the seasonNumber and episodeNumber set to null).
/// Having an episode is necessary to store metadata and tracks.
///
- [LoadableRelation] public ICollection Episodes { get; set; }
-
- ///
- /// The list of libraries that contains this show.
- ///
- [LoadableRelation] public ICollection Libraries { get; set; }
+ [LoadableRelation] public ICollection? Episodes { get; set; }
///