diff --git a/Kyoo.Abstractions/Controllers/ITranscoder.cs b/Kyoo.Abstractions/Controllers/ITranscoder.cs index d361b7d4..b500741a 100644 --- a/Kyoo.Abstractions/Controllers/ITranscoder.cs +++ b/Kyoo.Abstractions/Controllers/ITranscoder.cs @@ -6,7 +6,9 @@ namespace Kyoo.Abstractions.Controllers public interface ITranscoder { Task ExtractInfos(Episode episode, bool reextract); + Task Transmux(Episode episode); + Task Transcode(Episode episode); } } diff --git a/Kyoo.Abstractions/Controllers/StartupAction.cs b/Kyoo.Abstractions/Controllers/StartupAction.cs index dda1780e..db83c310 100644 --- a/Kyoo.Abstractions/Controllers/StartupAction.cs +++ b/Kyoo.Abstractions/Controllers/StartupAction.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.DependencyInjection; namespace Kyoo.Abstractions.Controllers @@ -7,14 +8,44 @@ 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 { + /// + /// The highest predefined priority existing for . + /// public const int Before = 5000; + + /// + /// Items defining routing (see IApplicationBuilder.UseRouting use this priority. + /// public const int Routing = 4000; + + /// + /// Actions defining new static files router use this priority. + /// public const int StaticFiles = 3000; + + /// + /// Actions calling IApplicationBuilder.UseAuthentication use this priority. + /// public const int Authentication = 2000; + + /// + /// Actions calling IApplicationBuilder.UseAuthorization use this priority. + /// public const int Authorization = 1000; + + /// + /// Action adding endpoint should use this priority (with a negative modificator if there is a catchall). + /// public const int Endpoint = 0; + + /// + /// The lowest predefined priority existing for . + /// It should run after all other actions. + /// public const int After = -1000; /// @@ -58,13 +89,150 @@ namespace Kyoo.Abstractions.Controllers /// A new public static StartupAction New(Action action, int priority) => new(action, priority); + + /// + /// A with no dependencies. + /// + public class StartupAction : IStartupAction + { + /// + /// The action to execute at startup. + /// + private readonly Action _action; + + /// + public int Priority { get; } + + /// + /// Create a new . + /// + /// The action to execute on startup. + /// The priority of this action (see ). + public StartupAction(Action action, int priority) + { + _action = action; + Priority = priority; + } + + /// + public void Run(IServiceProvider provider) + { + _action.Invoke(); + } + } + + /// + /// A with one dependencies. + /// + /// The dependency to use. + public class StartupAction : IStartupAction + { + /// + /// The action to execute at startup. + /// + private readonly Action _action; + + /// + public int Priority { get; } + + /// + /// Create a new . + /// + /// The action to execute on startup. + /// The priority of this action (see ). + public StartupAction(Action action, int priority) + { + _action = action; + Priority = priority; + } + + /// + public void Run(IServiceProvider provider) + { + _action.Invoke(provider.GetRequiredService()); + } + } + + /// + /// A with two dependencies. + /// + /// The dependency to use. + /// The second dependency to use. + public class StartupAction : IStartupAction + { + /// + /// The action to execute at startup. + /// + private readonly Action _action; + + /// + public int Priority { get; } + + /// + /// Create a new . + /// + /// The action to execute on startup. + /// The priority of this action (see ). + public StartupAction(Action action, int priority) + { + _action = action; + Priority = priority; + } + + /// + public void Run(IServiceProvider provider) + { + _action.Invoke( + provider.GetRequiredService(), + provider.GetRequiredService() + ); + } + } + + /// + /// A with three dependencies. + /// + /// The dependency to use. + /// The second dependency to use. + /// The third dependency to use. + public class StartupAction : IStartupAction + { + /// + /// The action to execute at startup. + /// + private readonly Action _action; + + /// + public int Priority { get; } + + /// + /// Create a new . + /// + /// The action to execute on startup. + /// The priority of this action (see ). + public StartupAction(Action action, int priority) + { + _action = action; + Priority = priority; + } + + /// + public void Run(IServiceProvider provider) + { + _action.Invoke( + provider.GetRequiredService(), + provider.GetRequiredService(), + provider.GetRequiredService() + ); + } + } } /// /// An action executed on kyoo's startup to initialize the asp-net container. /// /// - /// This is the base interface, see for a simpler use of this. + /// This is the base interface, see for a simpler use of this. /// public interface IStartupAction { @@ -80,141 +248,4 @@ namespace Kyoo.Abstractions.Controllers /// The service provider containing all services can be used. void Run(IServiceProvider provider); } - - /// - /// A with no dependencies. - /// - public class StartupAction : IStartupAction - { - /// - /// The action to execute at startup. - /// - private readonly Action _action; - - /// - public int Priority { get; } - - /// - /// Create a new . - /// - /// The action to execute on startup. - /// The priority of this action (see ). - public StartupAction(Action action, int priority) - { - _action = action; - Priority = priority; - } - - /// - public void Run(IServiceProvider provider) - { - _action.Invoke(); - } - } - - /// - /// A with one dependencies. - /// - /// The dependency to use. - public class StartupAction : IStartupAction - { - /// - /// The action to execute at startup. - /// - private readonly Action _action; - - /// - public int Priority { get; } - - /// - /// Create a new . - /// - /// The action to execute on startup. - /// The priority of this action (see ). - public StartupAction(Action action, int priority) - { - _action = action; - Priority = priority; - } - - /// - public void Run(IServiceProvider provider) - { - _action.Invoke(provider.GetRequiredService()); - } - } - - /// - /// A with two dependencies. - /// - /// The dependency to use. - /// The second dependency to use. - public class StartupAction : IStartupAction - { - /// - /// The action to execute at startup. - /// - private readonly Action _action; - - /// - public int Priority { get; } - - /// - /// Create a new . - /// - /// The action to execute on startup. - /// The priority of this action (see ). - public StartupAction(Action action, int priority) - { - _action = action; - Priority = priority; - } - - /// - public void Run(IServiceProvider provider) - { - _action.Invoke( - provider.GetRequiredService(), - provider.GetRequiredService() - ); - } - } - - /// - /// A with three dependencies. - /// - /// The dependency to use. - /// The second dependency to use. - /// The third dependency to use. - public class StartupAction : IStartupAction - { - /// - /// The action to execute at startup. - /// - private readonly Action _action; - - /// - public int Priority { get; } - - /// - /// Create a new . - /// - /// The action to execute on startup. - /// The priority of this action (see ). - public StartupAction(Action action, int priority) - { - _action = action; - Priority = priority; - } - - /// - public void Run(IServiceProvider provider) - { - _action.Invoke( - provider.GetRequiredService(), - provider.GetRequiredService(), - provider.GetRequiredService() - ); - } - } } diff --git a/Kyoo.Abstractions/Models/Attributes/EditableRelationAttribute.cs b/Kyoo.Abstractions/Models/Attributes/EditableRelationAttribute.cs new file mode 100644 index 00000000..4a04d79b --- /dev/null +++ b/Kyoo.Abstractions/Models/Attributes/EditableRelationAttribute.cs @@ -0,0 +1,11 @@ +using System; +using Kyoo.Abstractions.Controllers; + +namespace Kyoo.Abstractions.Models.Attributes +{ + /// + /// The targeted relation can be edited via calls to the repository's method. + /// + [AttributeUsage(AttributeTargets.Property)] + public class EditableRelationAttribute : Attribute { } +} diff --git a/Kyoo.Abstractions/Models/Attributes/RelationAttributes.cs b/Kyoo.Abstractions/Models/Attributes/LoadableRelationAttribute.cs similarity index 77% rename from Kyoo.Abstractions/Models/Attributes/RelationAttributes.cs rename to Kyoo.Abstractions/Models/Attributes/LoadableRelationAttribute.cs index d8d2c0ec..c8ec0d95 100644 --- a/Kyoo.Abstractions/Models/Attributes/RelationAttributes.cs +++ b/Kyoo.Abstractions/Models/Attributes/LoadableRelationAttribute.cs @@ -1,13 +1,8 @@ -using System; +using System; using Kyoo.Abstractions.Controllers; namespace Kyoo.Abstractions.Models.Attributes { - /// - /// The targeted relation can be edited via calls to the repository's method. - /// - [AttributeUsage(AttributeTargets.Property)] - public class EditableRelationAttribute : Attribute { } /// /// The targeted relation can be loaded via a call to . diff --git a/Kyoo.Abstractions/Models/Attributes/MergeAttributes.cs b/Kyoo.Abstractions/Models/Attributes/NotMergeableAttribute.cs similarity index 100% rename from Kyoo.Abstractions/Models/Attributes/MergeAttributes.cs rename to Kyoo.Abstractions/Models/Attributes/NotMergeableAttribute.cs diff --git a/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs b/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs index 74ceb38c..34e901bb 100644 --- a/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs +++ b/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs @@ -25,7 +25,7 @@ namespace Kyoo.Abstractions.Models.Exceptions { } /// - /// The serialization constructor + /// The serialization constructor. /// /// Serialization infos /// The serialization context diff --git a/Kyoo.Abstractions/Models/LibraryItem.cs b/Kyoo.Abstractions/Models/LibraryItem.cs index 00302bf4..3d1d4f87 100644 --- a/Kyoo.Abstractions/Models/LibraryItem.cs +++ b/Kyoo.Abstractions/Models/LibraryItem.cs @@ -10,8 +10,19 @@ namespace Kyoo.Abstractions.Models /// public enum ItemType { + /// + /// The is a . + /// Show, + + /// + /// The is a Movie (a with equals to true). + /// Movie, + + /// + /// The is a . + /// Collection } @@ -43,7 +54,7 @@ namespace Kyoo.Abstractions.Models public Status? Status { get; set; } /// - /// The date this show or collection started airing. It can be null if this is unknown. + /// The date this show or collection started airing. It can be null if this is unknown. /// public DateTime? StartAir { get; set; } diff --git a/Kyoo.Abstractions/Models/MetadataID.cs b/Kyoo.Abstractions/Models/MetadataID.cs index 87c71bfd..7837b6f7 100644 --- a/Kyoo.Abstractions/Models/MetadataID.cs +++ b/Kyoo.Abstractions/Models/MetadataID.cs @@ -9,6 +9,14 @@ namespace Kyoo.Abstractions.Models /// public class MetadataID { + /// + /// The expression to retrieve the unique ID of a MetadataID. This is an aggregate of the two resources IDs. + /// + public static Expression> PrimaryKey + { + get { return x => new { First = x.ResourceID, Second = x.ProviderID }; } + } + /// /// The ID of the resource which possess the metadata. /// @@ -33,13 +41,5 @@ namespace Kyoo.Abstractions.Models /// The URL of the resource on the external provider. /// public string Link { get; set; } - - /// - /// The expression to retrieve the unique ID of a MetadataID. This is an aggregate of the two resources IDs. - /// - public static Expression> PrimaryKey - { - get { return x => new { First = x.ResourceID, Second = x.ProviderID }; } - } } } diff --git a/Kyoo.Abstractions/Models/Page.cs b/Kyoo.Abstractions/Models/Page.cs index 710f5a49..305dfa51 100644 --- a/Kyoo.Abstractions/Models/Page.cs +++ b/Kyoo.Abstractions/Models/Page.cs @@ -9,7 +9,8 @@ namespace Kyoo.Abstractions.Models /// A page of resource that contains information about the pagination of resources. /// /// The type of resource contained in this page. - public class Page where T : IResource + public class Page + where T : IResource { /// /// The link of the current page. diff --git a/Kyoo.Abstractions/Models/PeopleRole.cs b/Kyoo.Abstractions/Models/PeopleRole.cs index f959883a..d610532c 100644 --- a/Kyoo.Abstractions/Models/PeopleRole.cs +++ b/Kyoo.Abstractions/Models/PeopleRole.cs @@ -6,7 +6,7 @@ namespace Kyoo.Abstractions.Models /// /// This class is not serialized like other classes. /// Based on the field, it is serialized like - /// a show with two extra fields ( and ). + /// a show with two extra fields ( and ). /// public class PeopleRole : IResource { @@ -44,13 +44,13 @@ namespace Kyoo.Abstractions.Models /// /// The type of work the person has done for the show. - /// That can be something like "Actor", "Writer", "Music", "Voice Actor"... + /// That can be something like "Actor", "Writer", "Music", "Voice Actor"... /// public string Type { get; set; } /// /// The role the People played. - /// This is mostly used to inform witch character was played for actor and voice actors. + /// This is mostly used to inform witch character was played for actor and voice actors. /// public string Role { get; set; } } diff --git a/Kyoo.Abstractions/Models/Resources/Genre.cs b/Kyoo.Abstractions/Models/Resources/Genre.cs index 0fc6ef32..e93331a1 100644 --- a/Kyoo.Abstractions/Models/Resources/Genre.cs +++ b/Kyoo.Abstractions/Models/Resources/Genre.cs @@ -32,7 +32,7 @@ namespace Kyoo.Abstractions.Models /// /// Create a new and specify it's . - /// The is automatically calculated from it's name. + /// The is automatically calculated from it's name. /// /// The name of this genre. public Genre(string name)