diff --git a/back/.config/dotnet-tools.json b/back/.config/dotnet-tools.json
index 2be6730d..7076f7c1 100644
--- a/back/.config/dotnet-tools.json
+++ b/back/.config/dotnet-tools.json
@@ -7,6 +7,12 @@
"commands": [
"dotnet-ef"
]
+ },
+ "csharpier": {
+ "version": "0.26.4",
+ "commands": [
+ "dotnet-csharpier"
+ ]
}
}
}
\ No newline at end of file
diff --git a/back/src/Kyoo.Abstractions/Controllers/IRepository.cs b/back/src/Kyoo.Abstractions/Controllers/IRepository.cs
index 65f6df39..7533f43e 100644
--- a/back/src/Kyoo.Abstractions/Controllers/IRepository.cs
+++ b/back/src/Kyoo.Abstractions/Controllers/IRepository.cs
@@ -100,11 +100,13 @@ namespace Kyoo.Abstractions.Controllers
/// Reverse the sort.
/// Select the first element after this id if it was in a list.
/// The resource found
- Task GetOrDefault(Filter? filter,
+ Task GetOrDefault(
+ Filter? filter,
Include? include = default,
Sort? sortBy = default,
bool reverse = false,
- Guid? afterId = default);
+ Guid? afterId = default
+ );
///
/// Search for resources with the database.
@@ -122,10 +124,12 @@ namespace Kyoo.Abstractions.Controllers
/// The related fields to include.
/// How pagination should be done (where to start and how many to return)
/// A list of resources that match every filters
- Task> GetAll(Filter? filter = null,
+ Task> GetAll(
+ Filter? filter = null,
Sort? sort = default,
Include? include = default,
- Pagination? limit = default);
+ Pagination? limit = default
+ );
///
/// Get the number of resources that match the filter's predicate.
@@ -166,8 +170,8 @@ namespace Kyoo.Abstractions.Controllers
///
/// The resource newly created.
/// A representing the asynchronous operation.
- protected static Task OnResourceCreated(T obj)
- => OnCreated?.Invoke(obj) ?? Task.CompletedTask;
+ protected static Task OnResourceCreated(T obj) =>
+ OnCreated?.Invoke(obj) ?? Task.CompletedTask;
///
/// Edit a resource and replace every property
@@ -199,8 +203,8 @@ namespace Kyoo.Abstractions.Controllers
///
/// The resource newly edited.
/// A representing the asynchronous operation.
- protected static Task OnResourceEdited(T obj)
- => OnEdited?.Invoke(obj) ?? Task.CompletedTask;
+ protected static Task OnResourceEdited(T obj) =>
+ OnEdited?.Invoke(obj) ?? Task.CompletedTask;
///
/// Delete a resource by it's ID
@@ -243,8 +247,8 @@ namespace Kyoo.Abstractions.Controllers
///
/// The resource newly deleted.
/// A representing the asynchronous operation.
- protected static Task OnResourceDeleted(T obj)
- => OnDeleted?.Invoke(obj) ?? Task.CompletedTask;
+ protected static Task OnResourceDeleted(T obj) =>
+ OnDeleted?.Invoke(obj) ?? Task.CompletedTask;
}
///
diff --git a/back/src/Kyoo.Abstractions/Controllers/ISearchManager.cs b/back/src/Kyoo.Abstractions/Controllers/ISearchManager.cs
index 71a4656d..e6175018 100644
--- a/back/src/Kyoo.Abstractions/Controllers/ISearchManager.cs
+++ b/back/src/Kyoo.Abstractions/Controllers/ISearchManager.cs
@@ -35,10 +35,12 @@ public interface ISearchManager
/// How pagination should be done (where to start and how many to return)
/// The related fields to include.
/// A list of resources that match every filters
- public Task.SearchResult> SearchItems(string? query,
+ public Task.SearchResult> SearchItems(
+ string? query,
Sort sortBy,
SearchPagination pagination,
- Include? include = default);
+ Include? include = default
+ );
///
/// Search for movies.
@@ -48,10 +50,12 @@ public interface ISearchManager
/// How pagination should be done (where to start and how many to return)
/// The related fields to include.
/// A list of resources that match every filters
- public Task.SearchResult> SearchMovies(string? query,
+ public Task.SearchResult> SearchMovies(
+ string? query,
Sort sortBy,
SearchPagination pagination,
- Include? include = default);
+ Include? include = default
+ );
///
/// Search for shows.
@@ -61,10 +65,12 @@ public interface ISearchManager
/// How pagination should be done (where to start and how many to return)
/// The related fields to include.
/// A list of resources that match every filters
- public Task.SearchResult> SearchShows(string? query,
+ public Task.SearchResult> SearchShows(
+ string? query,
Sort sortBy,
SearchPagination pagination,
- Include? include = default);
+ Include? include = default
+ );
///
/// Search for collections.
@@ -74,10 +80,12 @@ public interface ISearchManager
/// How pagination should be done (where to start and how many to return)
/// The related fields to include.
/// A list of resources that match every filters
- public Task.SearchResult> SearchCollections(string? query,
+ public Task.SearchResult> SearchCollections(
+ string? query,
Sort sortBy,
SearchPagination pagination,
- Include? include = default);
+ Include? include = default
+ );
///
/// Search for episodes.
@@ -87,10 +95,12 @@ public interface ISearchManager
/// How pagination should be done (where to start and how many to return)
/// The related fields to include.
/// A list of resources that match every filters
- public Task.SearchResult> SearchEpisodes(string? query,
+ public Task.SearchResult> SearchEpisodes(
+ string? query,
Sort sortBy,
SearchPagination pagination,
- Include? include = default);
+ Include? include = default
+ );
///
/// Search for studios.
@@ -100,8 +110,10 @@ public interface ISearchManager
/// How pagination should be done (where to start and how many to return)
/// The related fields to include.
/// A list of resources that match every filters
- public Task.SearchResult> SearchStudios(string? query,
+ public Task.SearchResult> SearchStudios(
+ string? query,
Sort sortBy,
SearchPagination pagination,
- Include? include = default);
+ Include? include = default
+ );
}
diff --git a/back/src/Kyoo.Abstractions/Controllers/IWatchStatusRepository.cs b/back/src/Kyoo.Abstractions/Controllers/IWatchStatusRepository.cs
index b65dc794..d9d9dcbf 100644
--- a/back/src/Kyoo.Abstractions/Controllers/IWatchStatusRepository.cs
+++ b/back/src/Kyoo.Abstractions/Controllers/IWatchStatusRepository.cs
@@ -39,11 +39,17 @@ public interface IWatchStatusRepository
Task> GetAll(
Filter? filter = default,
Include? include = default,
- Pagination? limit = default);
+ Pagination? limit = default
+ );
Task GetMovieStatus(Guid movieId, Guid userId);
- Task SetMovieStatus(Guid movieId, Guid userId, WatchStatus status, int? watchedTime);
+ Task SetMovieStatus(
+ Guid movieId,
+ Guid userId,
+ WatchStatus status,
+ int? watchedTime
+ );
Task DeleteMovieStatus(Guid movieId, Guid userId);
@@ -57,7 +63,12 @@ public interface IWatchStatusRepository
/// Where the user has stopped watching. Only usable if Status
/// is
- Task SetEpisodeStatus(Guid episodeId, Guid userId, WatchStatus status, int? watchedTime);
+ Task SetEpisodeStatus(
+ Guid episodeId,
+ Guid userId,
+ WatchStatus status,
+ int? watchedTime
+ );
Task DeleteEpisodeStatus(Guid episodeId, Guid userId);
}
diff --git a/back/src/Kyoo.Abstractions/Controllers/StartupAction.cs b/back/src/Kyoo.Abstractions/Controllers/StartupAction.cs
index 279ec516..ea9d9acf 100644
--- a/back/src/Kyoo.Abstractions/Controllers/StartupAction.cs
+++ b/back/src/Kyoo.Abstractions/Controllers/StartupAction.cs
@@ -17,7 +17,6 @@
// along with Kyoo. If not, see .
using System;
-using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
namespace Kyoo.Abstractions.Controllers
@@ -26,8 +25,6 @@ namespace Kyoo.Abstractions.Controllers
/// A list of constant priorities used for 's .
/// It also contains helper methods for creating new .
///
- [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name",
- Justification = "StartupAction is nested and the name SA is short to improve readability in plugin's startup.")]
public static class SA
{
///
@@ -72,8 +69,7 @@ namespace Kyoo.Abstractions.Controllers
/// The action to run
/// The priority of the new action
/// A new
- public static StartupAction New(Action action, int priority)
- => new(action, priority);
+ public static StartupAction New(Action action, int priority) => new(action, priority);
///
/// Create a new .
@@ -83,8 +79,7 @@ namespace Kyoo.Abstractions.Controllers
/// A dependency that this action will use.
/// A new
public static StartupAction New(Action action, int priority)
- where T : notnull
- => new(action, priority);
+ where T : notnull => new(action, priority);
///
/// Create a new .
@@ -96,8 +91,7 @@ namespace Kyoo.Abstractions.Controllers
/// A new
public static StartupAction New(Action action, int priority)
where T : notnull
- where T2 : notnull
- => new(action, priority);
+ where T2 : notnull => new(action, priority);
///
/// Create a new .
@@ -108,11 +102,13 @@ namespace Kyoo.Abstractions.Controllers
/// A second dependency that this action will use.
/// A third dependency that this action will use.
/// A new
- public static StartupAction New(Action action, int priority)
+ public static StartupAction New(
+ Action action,
+ int priority
+ )
where T : notnull
where T2 : notnull
- where T3 : notnull
- => new(action, priority);
+ where T3 : notnull => new(action, priority);
///
/// A with no dependencies.
@@ -209,10 +205,7 @@ namespace Kyoo.Abstractions.Controllers
///
public void Run(IServiceProvider provider)
{
- _action.Invoke(
- provider.GetRequiredService(),
- provider.GetRequiredService()
- );
+ _action.Invoke(provider.GetRequiredService(), provider.GetRequiredService());
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
index f0aa4c1c..635d4f71 100644
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
+++ b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
@@ -48,7 +48,6 @@ namespace Kyoo.Abstractions.Models.Exceptions
/// Serialization infos
/// The serialization context
protected DuplicatedItemException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- { }
+ : base(info, context) { }
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs
index 96499762..f8a79486 100644
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs
+++ b/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs
@@ -37,8 +37,7 @@ namespace Kyoo.Abstractions.Models.Exceptions
///
/// The message of the exception
public ItemNotFoundException(string message)
- : base(message)
- { }
+ : base(message) { }
///
/// The serialization constructor
@@ -46,7 +45,6 @@ namespace Kyoo.Abstractions.Models.Exceptions
/// Serialization infos
/// The serialization context
protected ItemNotFoundException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- { }
+ : base(info, context) { }
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs
index d1d7b339..27415a97 100644
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs
+++ b/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs
@@ -25,15 +25,12 @@ namespace Kyoo.Abstractions.Models.Exceptions
public class UnauthorizedException : Exception
{
public UnauthorizedException()
- : base("User not authenticated or token invalid.")
- { }
+ : base("User not authenticated or token invalid.") { }
public UnauthorizedException(string message)
- : base(message)
- { }
+ : base(message) { }
protected UnauthorizedException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- { }
+ : base(info, context) { }
}
}
diff --git a/back/src/Kyoo.Abstractions/Models/IWatchlist.cs b/back/src/Kyoo.Abstractions/Models/IWatchlist.cs
index 8e2b76b8..03022701 100644
--- a/back/src/Kyoo.Abstractions/Models/IWatchlist.cs
+++ b/back/src/Kyoo.Abstractions/Models/IWatchlist.cs
@@ -24,5 +24,4 @@ namespace Kyoo.Abstractions.Models;
/// A watch list item.
///
[OneOf(Types = new[] { typeof(Show), typeof(Movie) })]
-public interface IWatchlist : IResource, IThumbnails, IMetadata, IAddedDate
-{ }
+public interface IWatchlist : IResource, IThumbnails, IMetadata, IAddedDate { }
diff --git a/back/src/Kyoo.Abstractions/Models/Page.cs b/back/src/Kyoo.Abstractions/Models/Page.cs
index f624370e..8f64d258 100644
--- a/back/src/Kyoo.Abstractions/Models/Page.cs
+++ b/back/src/Kyoo.Abstractions/Models/Page.cs
@@ -67,7 +67,13 @@ namespace Kyoo.Abstractions.Models
/// The link of the previous page.
/// The link of the next page.
/// The link of the first page.
- public Page(ICollection items, string @this, string? previous, string? next, string first)
+ public Page(
+ ICollection items,
+ string @this,
+ string? previous,
+ string? next,
+ string first
+ )
{
Items = items;
This = @this;
@@ -83,10 +89,7 @@ namespace Kyoo.Abstractions.Models
/// The base url of the resources available from this page.
/// The list of query strings of the current page
/// The number of items requested for the current page.
- public Page(ICollection items,
- string url,
- Dictionary query,
- int limit)
+ public Page(ICollection items, string url, Dictionary query, int limit)
{
Items = items;
This = url + query.ToQueryString();
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs b/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs
index 6634cb9e..75f8b5d9 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs
@@ -37,7 +37,8 @@ namespace Kyoo.Abstractions.Models
public Guid Id { get; set; }
///
- [MaxLength(256)] public string Slug { get; set; }
+ [MaxLength(256)]
+ public string Slug { get; set; }
///
/// The name of this collection.
@@ -64,12 +65,14 @@ namespace Kyoo.Abstractions.Models
///
/// The list of movies contained in this collection.
///
- [SerializeIgnore] public ICollection? Movies { get; set; }
+ [SerializeIgnore]
+ public ICollection? Movies { get; set; }
///
/// The list of shows contained in this collection.
///
- [SerializeIgnore] public ICollection? Shows { get; set; }
+ [SerializeIgnore]
+ public ICollection? Shows { get; set; }
///
public Dictionary ExternalId { get; set; } = new();
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs b/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs
index 23c9101b..8cd63b1a 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs
@@ -34,11 +34,12 @@ namespace Kyoo.Abstractions.Models
public class Episode : IQuery, IResource, IMetadata, IThumbnails, IAddedDate, INews
{
// Use absolute numbers by default and fallback to season/episodes if it does not exists.
- public static Sort DefaultSort => new Sort.Conglomerate(
- new Sort.By(x => x.AbsoluteNumber),
- new Sort.By(x => x.SeasonNumber),
- new Sort.By(x => x.EpisodeNumber)
- );
+ public static Sort DefaultSort =>
+ new Sort.Conglomerate(
+ new Sort.By(x => x.AbsoluteNumber),
+ new Sort.By(x => x.SeasonNumber),
+ new Sort.By(x => x.EpisodeNumber)
+ );
///
public Guid Id { get; set; }
@@ -51,10 +52,14 @@ namespace Kyoo.Abstractions.Models
get
{
if (ShowSlug != null || Show?.Slug != null)
- return GetSlug(ShowSlug ?? Show!.Slug, SeasonNumber, EpisodeNumber, AbsoluteNumber);
+ return GetSlug(
+ ShowSlug ?? Show!.Slug,
+ SeasonNumber,
+ EpisodeNumber,
+ AbsoluteNumber
+ );
return GetSlug(ShowId.ToString(), SeasonNumber, EpisodeNumber, AbsoluteNumber);
}
-
[UsedImplicitly]
private set
{
@@ -85,7 +90,8 @@ 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.
@@ -95,7 +101,8 @@ namespace Kyoo.Abstractions.Models
///
/// The show that contains this episode.
///
- [LoadableRelation(nameof(ShowId))] public Show? Show { get; set; }
+ [LoadableRelation(nameof(ShowId))]
+ public Show? Show { get; set; }
///
/// The ID of the Season containing this episode.
@@ -109,7 +116,8 @@ 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.
@@ -192,16 +200,19 @@ namespace Kyoo.Abstractions.Models
)]
public Episode? PreviousEpisode { get; set; }
- private Episode? _PreviousEpisode => Show!.Episodes!
- .OrderBy(x => x.AbsoluteNumber == null)
- .ThenByDescending(x => x.AbsoluteNumber)
- .ThenByDescending(x => x.SeasonNumber)
- .ThenByDescending(x => x.EpisodeNumber)
- .FirstOrDefault(x =>
- x.AbsoluteNumber < AbsoluteNumber
- || x.SeasonNumber < SeasonNumber
- || (x.SeasonNumber == SeasonNumber && x.EpisodeNumber < EpisodeNumber)
- );
+ private Episode? _PreviousEpisode =>
+ Show!
+ .Episodes!
+ .OrderBy(x => x.AbsoluteNumber == null)
+ .ThenByDescending(x => x.AbsoluteNumber)
+ .ThenByDescending(x => x.SeasonNumber)
+ .ThenByDescending(x => x.EpisodeNumber)
+ .FirstOrDefault(
+ x =>
+ x.AbsoluteNumber < AbsoluteNumber
+ || x.SeasonNumber < SeasonNumber
+ || (x.SeasonNumber == SeasonNumber && x.EpisodeNumber < EpisodeNumber)
+ );
///
/// The next episode to watch after this one.
@@ -229,17 +240,21 @@ namespace Kyoo.Abstractions.Models
)]
public Episode? NextEpisode { get; set; }
- private Episode? _NextEpisode => Show!.Episodes!
- .OrderBy(x => x.AbsoluteNumber)
- .ThenBy(x => x.SeasonNumber)
- .ThenBy(x => x.EpisodeNumber)
- .FirstOrDefault(x =>
- x.AbsoluteNumber > AbsoluteNumber
- || x.SeasonNumber > SeasonNumber
- || (x.SeasonNumber == SeasonNumber && x.EpisodeNumber > EpisodeNumber)
- );
+ private Episode? _NextEpisode =>
+ Show!
+ .Episodes!
+ .OrderBy(x => x.AbsoluteNumber)
+ .ThenBy(x => x.SeasonNumber)
+ .ThenBy(x => x.EpisodeNumber)
+ .FirstOrDefault(
+ x =>
+ x.AbsoluteNumber > AbsoluteNumber
+ || x.SeasonNumber > SeasonNumber
+ || (x.SeasonNumber == SeasonNumber && x.EpisodeNumber > EpisodeNumber)
+ );
- [SerializeIgnore] public ICollection? Watched { get; set; }
+ [SerializeIgnore]
+ public ICollection? Watched { get; set; }
///
/// Metadata of what an user as started/planned to watch.
@@ -257,11 +272,12 @@ namespace Kyoo.Abstractions.Models
///
/// Links to watch this episode.
///
- public VideoLinks Links => new()
- {
- Direct = $"/video/episode/{Slug}/direct",
- Hls = $"/video/episode/{Slug}/master.m3u8",
- };
+ public VideoLinks Links =>
+ new()
+ {
+ Direct = $"/video/episode/{Slug}/direct",
+ Hls = $"/video/episode/{Slug}/master.m3u8",
+ };
///
/// Get the slug of an episode.
@@ -280,10 +296,12 @@ namespace Kyoo.Abstractions.Models
/// If you don't know it or this is a movie, use null
///
/// The slug corresponding to the given arguments
- public static string GetSlug(string showSlug,
+ public static string GetSlug(
+ string showSlug,
int? seasonNumber,
int? episodeNumber,
- int? absoluteNumber = null)
+ int? absoluteNumber = null
+ )
{
return seasonNumber switch
{
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
index 057601b7..b590c98d 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
@@ -82,7 +82,11 @@ namespace Kyoo.Abstractions.Models
}
///
- public override object ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
+ public override object ConvertFrom(
+ ITypeDescriptorContext? context,
+ CultureInfo? culture,
+ object value
+ )
{
if (value is not string source)
return base.ConvertFrom(context, culture, value)!;
@@ -90,7 +94,10 @@ namespace Kyoo.Abstractions.Models
}
///
- public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)
+ public override bool CanConvertTo(
+ ITypeDescriptorContext? context,
+ Type? destinationType
+ )
{
return false;
}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs
index fff39628..bfaf4bb5 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs
@@ -31,7 +31,16 @@ namespace Kyoo.Abstractions.Models
///
/// A series or a movie.
///
- public class Movie : IQuery, IResource, IMetadata, IOnMerge, IThumbnails, IAddedDate, ILibraryItem, INews, IWatchlist
+ public class Movie
+ : IQuery,
+ IResource,
+ IMetadata,
+ IOnMerge,
+ IThumbnails,
+ IAddedDate,
+ ILibraryItem,
+ INews,
+ IWatchlist
{
public static Sort DefaultSort => new Sort.By(x => x.Name);
@@ -120,12 +129,14 @@ namespace Kyoo.Abstractions.Models
///
/// The ID of the Studio that made this show.
///
- [SerializeIgnore] public Guid? StudioId { get; set; }
+ [SerializeIgnore]
+ public Guid? StudioId { get; set; }
///
/// The Studio that made this show.
///
- [LoadableRelation(nameof(StudioId))] public Studio? Studio { get; set; }
+ [LoadableRelation(nameof(StudioId))]
+ public Studio? Studio { get; set; }
// ///
// /// The list of people that made this show.
@@ -135,18 +146,21 @@ namespace Kyoo.Abstractions.Models
///
/// The list of collections that contains this show.
///
- [SerializeIgnore] public ICollection? Collections { get; set; }
+ [SerializeIgnore]
+ public ICollection? Collections { get; set; }
///
/// Links to watch this movie.
///
- public VideoLinks Links => new()
- {
- Direct = $"/video/movie/{Slug}/direct",
- Hls = $"/video/movie/{Slug}/master.m3u8",
- };
+ public VideoLinks Links =>
+ new()
+ {
+ Direct = $"/video/movie/{Slug}/direct",
+ Hls = $"/video/movie/{Slug}/master.m3u8",
+ };
- [SerializeIgnore] public ICollection? Watched { get; set; }
+ [SerializeIgnore]
+ public ICollection? Watched { get; set; }
///
/// Metadata of what an user as started/planned to watch.
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/People.cs b/back/src/Kyoo.Abstractions/Models/Resources/People.cs
index d1412506..336b7e6b 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/People.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/People.cs
@@ -62,7 +62,8 @@ namespace Kyoo.Abstractions.Models
///
/// The list of roles this person has played in. See for more information.
///
- [SerializeIgnore] public ICollection? Roles { get; set; }
+ [SerializeIgnore]
+ public ICollection? Roles { get; set; }
public People() { }
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Season.cs b/back/src/Kyoo.Abstractions/Models/Resources/Season.cs
index 2b7d38d2..c7d4c459 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Season.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Season.cs
@@ -49,7 +49,6 @@ namespace Kyoo.Abstractions.Models
return $"{ShowId}-s{SeasonNumber}";
return $"{ShowSlug ?? Show?.Slug}-s{SeasonNumber}";
}
-
[UsedImplicitly]
[NotNull]
private set
@@ -57,7 +56,9 @@ namespace Kyoo.Abstractions.Models
Match match = Regex.Match(value, @"(?.+)-s(?\d+)");
if (!match.Success)
- throw new ArgumentException("Invalid season slug. Format: {showSlug}-s{seasonNumber}");
+ throw new ArgumentException(
+ "Invalid season slug. Format: {showSlug}-s{seasonNumber}"
+ );
ShowSlug = match.Groups["show"].Value;
SeasonNumber = int.Parse(match.Groups["season"].Value);
}
@@ -66,7 +67,8 @@ 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.
@@ -76,7 +78,8 @@ namespace Kyoo.Abstractions.Models
///
/// The show that contains this season.
///
- [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.
@@ -121,7 +124,8 @@ namespace Kyoo.Abstractions.Models
///
/// The list of episodes that this season contains.
///
- [SerializeIgnore] public ICollection? Episodes { get; set; }
+ [SerializeIgnore]
+ public ICollection? Episodes { get; set; }
///
/// The number of episodes in this season.
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Show.cs b/back/src/Kyoo.Abstractions/Models/Resources/Show.cs
index bef33e61..31a82c20 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Show.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Show.cs
@@ -32,7 +32,15 @@ namespace Kyoo.Abstractions.Models
///
/// A series or a movie.
///
- public class Show : IQuery, IResource, IMetadata, IOnMerge, IThumbnails, IAddedDate, ILibraryItem, IWatchlist
+ public class Show
+ : IQuery,
+ IResource,
+ IMetadata,
+ IOnMerge,
+ IThumbnails,
+ IAddedDate,
+ ILibraryItem,
+ IWatchlist
{
public static Sort DefaultSort => new Sort.By(x => x.Name);
@@ -121,12 +129,14 @@ namespace Kyoo.Abstractions.Models
///
/// The ID of the Studio that made this show.
///
- [SerializeIgnore] public Guid? StudioId { get; set; }
+ [SerializeIgnore]
+ public Guid? StudioId { get; set; }
///
/// The Studio that made this show.
///
- [LoadableRelation(nameof(StudioId))] public Studio? Studio { get; set; }
+ [LoadableRelation(nameof(StudioId))]
+ public Studio? Studio { get; set; }
// ///
// /// The list of people that made this show.
@@ -136,19 +146,22 @@ namespace Kyoo.Abstractions.Models
///
/// The different seasons in this show. If this is a movie, this list is always null or empty.
///
- [SerializeIgnore] public ICollection? Seasons { get; set; }
+ [SerializeIgnore]
+ 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.
///
- [SerializeIgnore] public ICollection? Episodes { get; set; }
+ [SerializeIgnore]
+ public ICollection? Episodes { get; set; }
///
/// The list of collections that contains this show.
///
- [SerializeIgnore] public ICollection? Collections { get; set; }
+ [SerializeIgnore]
+ public ICollection? Collections { get; set; }
///
/// The first episode of this show.
@@ -172,11 +185,12 @@ namespace Kyoo.Abstractions.Models
)]
public Episode? FirstEpisode { get; set; }
- private Episode? _FirstEpisode => Episodes!
- .OrderBy(x => x.AbsoluteNumber)
- .ThenBy(x => x.SeasonNumber)
- .ThenBy(x => x.EpisodeNumber)
- .FirstOrDefault();
+ private Episode? _FirstEpisode =>
+ Episodes!
+ .OrderBy(x => x.AbsoluteNumber)
+ .ThenBy(x => x.SeasonNumber)
+ .ThenBy(x => x.EpisodeNumber)
+ .FirstOrDefault();
///
/// The number of episodes in this show.
@@ -199,7 +213,8 @@ namespace Kyoo.Abstractions.Models
private int _EpisodesCount => Episodes!.Count;
- [SerializeIgnore] public ICollection? Watched { get; set; }
+ [SerializeIgnore]
+ public ICollection? Watched { get; set; }
///
/// Metadata of what an user as started/planned to watch.
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Studio.cs b/back/src/Kyoo.Abstractions/Models/Resources/Studio.cs
index 8b7094ed..2f4eef3d 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/Studio.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/Studio.cs
@@ -48,12 +48,14 @@ namespace Kyoo.Abstractions.Models
///
/// The list of shows that are made by this studio.
///
- [SerializeIgnore] public ICollection? Shows { get; set; }
+ [SerializeIgnore]
+ public ICollection? Shows { get; set; }
///
/// The list of movies that are made by this studio.
///
- [SerializeIgnore] public ICollection? Movies { get; set; }
+ [SerializeIgnore]
+ public ICollection? Movies { get; set; }
///
public Dictionary ExternalId { get; set; } = new();
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs b/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs
index 80216f2d..bc67f0bd 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs
@@ -56,22 +56,26 @@ namespace Kyoo.Abstractions.Models
///
/// The ID of the user that started watching this episode.
///
- [SerializeIgnore] public Guid UserId { get; set; }
+ [SerializeIgnore]
+ public Guid UserId { get; set; }
///
/// The user that started watching this episode.
///
- [SerializeIgnore] public User User { get; set; }
+ [SerializeIgnore]
+ public User User { get; set; }
///
/// The ID of the movie started.
///
- [SerializeIgnore] public Guid MovieId { get; set; }
+ [SerializeIgnore]
+ public Guid MovieId { get; set; }
///
/// The started.
///
- [SerializeIgnore] public Movie Movie { get; set; }
+ [SerializeIgnore]
+ public Movie Movie { get; set; }
///
public DateTime AddedDate { get; set; }
@@ -109,22 +113,26 @@ namespace Kyoo.Abstractions.Models
///
/// The ID of the user that started watching this episode.
///
- [SerializeIgnore] public Guid UserId { get; set; }
+ [SerializeIgnore]
+ public Guid UserId { get; set; }
///
/// The user that started watching this episode.
///
- [SerializeIgnore] public User User { get; set; }
+ [SerializeIgnore]
+ public User User { get; set; }
///
/// The ID of the episode started.
///
- [SerializeIgnore] public Guid? EpisodeId { get; set; }
+ [SerializeIgnore]
+ public Guid? EpisodeId { get; set; }
///
/// The started.
///
- [SerializeIgnore] public Episode Episode { get; set; }
+ [SerializeIgnore]
+ public Episode Episode { get; set; }
///
public DateTime AddedDate { get; set; }
@@ -162,22 +170,26 @@ namespace Kyoo.Abstractions.Models
///
/// The ID of the user that started watching this episode.
///
- [SerializeIgnore] public Guid UserId { get; set; }
+ [SerializeIgnore]
+ public Guid UserId { get; set; }
///
/// The user that started watching this episode.
///
- [SerializeIgnore] public User User { get; set; }
+ [SerializeIgnore]
+ public User User { get; set; }
///
/// The ID of the show started.
///
- [SerializeIgnore] public Guid ShowId { get; set; }
+ [SerializeIgnore]
+ public Guid ShowId { get; set; }
///
/// The started.
///
- [SerializeIgnore] public Show Show { get; set; }
+ [SerializeIgnore]
+ public Show Show { get; set; }
///
public DateTime AddedDate { get; set; }
@@ -200,7 +212,8 @@ namespace Kyoo.Abstractions.Models
///
/// The ID of the episode started.
///
- [SerializeIgnore] public Guid? NextEpisodeId { get; set; }
+ [SerializeIgnore]
+ public Guid? NextEpisodeId { get; set; }
///
/// The next to watch.
diff --git a/back/src/Kyoo.Abstractions/Models/SearchPage.cs b/back/src/Kyoo.Abstractions/Models/SearchPage.cs
index 27a29c0d..cf4d858d 100644
--- a/back/src/Kyoo.Abstractions/Models/SearchPage.cs
+++ b/back/src/Kyoo.Abstractions/Models/SearchPage.cs
@@ -32,7 +32,8 @@ namespace Kyoo.Abstractions.Models
string @this,
string? previous,
string? next,
- string first)
+ string first
+ )
: base(result.Items, @this, previous, next, first)
{
Query = result.Query;
diff --git a/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs b/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs
index 76c6c330..85af8072 100644
--- a/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs
+++ b/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs
@@ -53,24 +53,30 @@ public abstract record Filter
{
return filters
.Where(x => x != null)
- .Aggregate((Filter?)null, (acc, filter) =>
- {
- if (acc == null)
- return filter;
- return new Filter.And(acc, filter!);
- });
+ .Aggregate(
+ (Filter?)null,
+ (acc, filter) =>
+ {
+ if (acc == null)
+ return filter;
+ return new Filter.And(acc, filter!);
+ }
+ );
}
public static Filter? Or(params Filter?[] filters)
{
return filters
.Where(x => x != null)
- .Aggregate((Filter?)null, (acc, filter) =>
- {
- if (acc == null)
- return filter;
- return new Filter.Or(acc, filter!);
- });
+ .Aggregate(
+ (Filter?)null,
+ (acc, filter) =>
+ {
+ if (acc == null)
+ return filter;
+ return new Filter.Or(acc, filter!);
+ }
+ );
}
}
@@ -109,21 +115,21 @@ public abstract record Filter : Filter
public static class FilterParsers
{
- public static readonly Parser> Filter =
- Parse.Ref(() => Bracket)
- .Or(Parse.Ref(() => Not))
- .Or(Parse.Ref(() => Eq))
- .Or(Parse.Ref(() => Ne))
- .Or(Parse.Ref(() => Gt))
- .Or(Parse.Ref(() => Ge))
- .Or(Parse.Ref(() => Lt))
- .Or(Parse.Ref(() => Le))
- .Or(Parse.Ref(() => Has));
+ public static readonly Parser> Filter = Parse
+ .Ref(() => Bracket)
+ .Or(Parse.Ref(() => Not))
+ .Or(Parse.Ref(() => Eq))
+ .Or(Parse.Ref(() => Ne))
+ .Or(Parse.Ref(() => Gt))
+ .Or(Parse.Ref(() => Ge))
+ .Or(Parse.Ref(() => Lt))
+ .Or(Parse.Ref(() => Le))
+ .Or(Parse.Ref(() => Has));
- public static readonly Parser> CompleteFilter =
- Parse.Ref(() => Or)
- .Or(Parse.Ref(() => And))
- .Or(Filter);
+ public static readonly Parser> CompleteFilter = Parse
+ .Ref(() => Or)
+ .Or(Parse.Ref(() => And))
+ .Or(Filter);
public static readonly Parser> Bracket =
from open in Parse.Char('(').Token()
@@ -131,22 +137,30 @@ public abstract record Filter : Filter
from close in Parse.Char(')').Token()
select filter;
- public static readonly Parser> AndOperator = Parse.IgnoreCase("and")
+ public static readonly Parser> AndOperator = Parse
+ .IgnoreCase("and")
.Or(Parse.String("&&"))
.Token();
- public static readonly Parser> OrOperator = Parse.IgnoreCase("or")
+ public static readonly Parser> OrOperator = Parse
+ .IgnoreCase("or")
.Or(Parse.String("||"))
.Token();
- public static readonly Parser> And = Parse.ChainOperator(AndOperator, Filter, (_, a, b) => new And(a, b));
+ public static readonly Parser> And = Parse.ChainOperator(
+ AndOperator,
+ Filter,
+ (_, a, b) => new And(a, b)
+ );
- public static readonly Parser> Or = Parse.ChainOperator(OrOperator, And.Or(Filter), (_, a, b) => new Or(a, b));
+ public static readonly Parser> Or = Parse.ChainOperator(
+ OrOperator,
+ And.Or(Filter),
+ (_, a, b) => new Or(a, b)
+ );
public static readonly Parser> Not =
- from not in Parse.IgnoreCase("not")
- .Or(Parse.String("!"))
- .Token()
+ from not in Parse.IgnoreCase("not").Or(Parse.String("!")).Token()
from filter in CompleteFilter
select new Not(filter);
@@ -155,9 +169,7 @@ public abstract record Filter : Filter
Type? nullable = Nullable.GetUnderlyingType(type);
if (nullable != null)
{
- return
- from value in _GetValueParser(nullable)
- select value;
+ return from value in _GetValueParser(nullable) select value;
}
if (type == typeof(int))
@@ -165,8 +177,7 @@ public abstract record Filter : Filter
if (type == typeof(float))
{
- return
- from a in Parse.Number
+ return from a in Parse.Number
from dot in Parse.Char('.')
from b in Parse.Number
select float.Parse($"{a}.{b}") as object;
@@ -174,8 +185,10 @@ public abstract record Filter : Filter
if (type == typeof(Guid))
{
- return
- from guid in Parse.Regex(@"[({]?[a-fA-F0-9]{8}[-]?([a-fA-F0-9]{4}[-]?){3}[a-fA-F0-9]{12}[})]?", "Guid")
+ return from guid in Parse.Regex(
+ @"[({]?[a-fA-F0-9]{8}[-]?([a-fA-F0-9]{4}[-]?){3}[a-fA-F0-9]{12}[})]?",
+ "Guid"
+ )
select Guid.Parse(guid) as object;
}
@@ -191,18 +204,21 @@ public abstract record Filter : Filter
if (type.IsEnum)
{
- return Parse.LetterOrDigit.Many().Text().Then(x =>
- {
- if (Enum.TryParse(type, x, true, out object? value))
- return Parse.Return(value);
- return ParseHelper.Error