diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..50209a07 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,17 @@ + + + true + true + true + + + + + + + + + + $(MSBuildThisFileDirectory)Kyoo.ruleset + + diff --git a/Kyoo.Abstractions/Controllers/IApplication.cs b/Kyoo.Abstractions/Controllers/IApplication.cs index 8e72280e..393011a5 100644 --- a/Kyoo.Abstractions/Controllers/IApplication.cs +++ b/Kyoo.Abstractions/Controllers/IApplication.cs @@ -16,9 +16,9 @@ void Restart(); /// - /// Get the data directory + /// Get the data directory. /// - /// Retrieve the data directory where runtime data should be stored + /// Retrieve the data directory where runtime data should be stored. string GetDataDirectory(); /// @@ -28,4 +28,4 @@ /// The configuration file name. string GetConfigFile(); } -} \ No newline at end of file +} diff --git a/Kyoo.Abstractions/Controllers/IConfigurationManager.cs b/Kyoo.Abstractions/Controllers/IConfigurationManager.cs index 73c649d1..1b32a665 100644 --- a/Kyoo.Abstractions/Controllers/IConfigurationManager.cs +++ b/Kyoo.Abstractions/Controllers/IConfigurationManager.cs @@ -14,12 +14,12 @@ namespace Kyoo.Abstractions.Controllers public interface IConfigurationManager { /// - /// Add an editable configuration to the editable configuration list + /// Add an editable configuration to the editable configuration list. /// /// The root path of the editable configuration. It should not be a nested type. - /// The type of the configuration + /// The type of the configuration. void AddTyped(string path); - + /// /// Add an editable configuration to the editable configuration list. /// WARNING: this method allow you to add an unmanaged type. This type won't be editable. This can be used @@ -36,32 +36,33 @@ namespace Kyoo.Abstractions.Controllers /// The root path of the editable configuration. It should not be a nested type. /// The type of the configuration or null. void Register(string path, [CanBeNull] Type type); - + /// /// Get the value of a setting using it's path. /// - /// The path of the resource (can be separated by ':' or '__') + /// The path of the resource (can be separated by ':' or '__'). /// No setting found at the given path. - /// The value of the settings (if it's a strongly typed one, the given type is instantiated + /// The value of the settings (if it's a strongly typed one, the given type is instantiated. object GetValue(string path); - + /// /// Get the value of a setting using it's path. /// If your don't need a strongly typed value, see . /// - /// The path of the resource (can be separated by ':' or '__') + /// The path of the resource (can be separated by ':' or '__'). /// A type to strongly type your option. - /// If your type is not the same as the registered type + /// If your type is not the same as the registered type. /// No setting found at the given path. - /// The value of the settings (if it's a strongly typed one, the given type is instantiated + /// The value of the settings (if it's a strongly typed one, the given type is instantiated. T GetValue(string path); - + /// /// Edit the value of a setting using it's path. Save it to the json file. /// - /// The path of the resource (can be separated by ':' or '__') - /// The new value of the resource + /// The path of the resource (can be separated by ':' or '__'). + /// The new value of the resource. /// No setting found at the given path. + /// A representing the asynchronous operation. Task EditValue(string path, object value); } -} \ No newline at end of file +} diff --git a/Kyoo.Abstractions/Controllers/IFileSystem.cs b/Kyoo.Abstractions/Controllers/IFileSystem.cs index 36c5dd3b..5edacb50 100644 --- a/Kyoo.Abstractions/Controllers/IFileSystem.cs +++ b/Kyoo.Abstractions/Controllers/IFileSystem.cs @@ -8,7 +8,8 @@ using Microsoft.AspNetCore.Mvc; namespace Kyoo.Abstractions.Controllers { /// - /// A service to abstract the file system to allow custom file systems (like distant file systems or external providers) + /// A service to abstract the file system to allow custom file systems + /// (like distant file systems or external providers). /// public interface IFileSystem { @@ -16,10 +17,10 @@ namespace Kyoo.Abstractions.Controllers /// /// Used for http queries returning a file. This should be used to return local files - /// or proxy them from a distant server + /// or proxy them from a distant server. /// /// - /// If no file exists at the given path or if the path is null, a NotFoundResult is returned + /// If no file exists at the given path or if the path is null, a NotFoundResult is returned /// to handle it gracefully. /// /// The path of the file. @@ -42,7 +43,7 @@ namespace Kyoo.Abstractions.Controllers /// If the file could not be found. /// A reader to read the file. public Task GetReader([NotNull] string path); - + /// /// Read a file present at . The reader can be used in an arbitrary context. /// To return files from an http endpoint, use . @@ -80,7 +81,7 @@ namespace Kyoo.Abstractions.Controllers /// The path of the directory /// Should the search be recursive or not. /// A list of files's path. - public Task> ListFiles([NotNull] string path, + public Task> ListFiles([NotNull] string path, SearchOption options = SearchOption.TopDirectoryOnly); /// @@ -100,4 +101,4 @@ namespace Kyoo.Abstractions.Controllers /// The extra directory of the resource. public Task GetExtraDirectory([NotNull] T resource); } -} \ No newline at end of file +} diff --git a/Kyoo.Abstractions/Controllers/IIdentifier.cs b/Kyoo.Abstractions/Controllers/IIdentifier.cs index 8a9d07ed..cc3af0f2 100644 --- a/Kyoo.Abstractions/Controllers/IIdentifier.cs +++ b/Kyoo.Abstractions/Controllers/IIdentifier.cs @@ -21,7 +21,7 @@ namespace Kyoo.Abstractions.Controllers /// If no metadata could be parsed for a type, null can be returned. /// Task<(Collection, Show, Season, Episode)> Identify(string path); - + /// /// Identify an external subtitle or track file from it's path and return the parsed metadata. /// @@ -34,4 +34,4 @@ namespace Kyoo.Abstractions.Controllers /// Task IdentifyTrack(string path); } -} \ No newline at end of file +} diff --git a/Kyoo.Abstractions/Controllers/ITranscoder.cs b/Kyoo.Abstractions/Controllers/ITranscoder.cs index d076b9f2..d361b7d4 100644 --- a/Kyoo.Abstractions/Controllers/ITranscoder.cs +++ b/Kyoo.Abstractions/Controllers/ITranscoder.cs @@ -1,5 +1,5 @@ -using Kyoo.Abstractions.Models; using System.Threading.Tasks; +using Kyoo.Abstractions.Models; namespace Kyoo.Abstractions.Controllers { diff --git a/Kyoo.Abstractions/Models/Exceptions/IdentificationFailedException.cs b/Kyoo.Abstractions/Models/Exceptions/IdentificationFailedException.cs index 05740b42..6895edde 100644 --- a/Kyoo.Abstractions/Models/Exceptions/IdentificationFailedException.cs +++ b/Kyoo.Abstractions/Models/Exceptions/IdentificationFailedException.cs @@ -15,18 +15,18 @@ namespace Kyoo.Abstractions.Models.Exceptions /// public IdentificationFailedException() : base("An identification failed.") - {} - + { } + /// /// Create a new with a custom message. /// /// The message to use. public IdentificationFailedException(string message) : base(message) - {} - + { } + /// - /// The serialization constructor + /// The serialization constructor /// /// Serialization infos /// The serialization context @@ -34,4 +34,4 @@ namespace Kyoo.Abstractions.Models.Exceptions : base(info, context) { } } -} \ No newline at end of file +} diff --git a/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs b/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs index 5a16e62e..02928897 100644 --- a/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs +++ b/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs @@ -12,7 +12,7 @@ namespace Kyoo.Abstractions.Models.Exceptions /// /// Create a default with no message. /// - public ItemNotFoundException() {} + public ItemNotFoundException() { } /// /// Create a new with a message @@ -21,9 +21,9 @@ namespace Kyoo.Abstractions.Models.Exceptions public ItemNotFoundException(string message) : base(message) { } - + /// - /// The serialization constructor + /// The serialization constructor /// /// Serialization infos /// The serialization context @@ -31,4 +31,4 @@ namespace Kyoo.Abstractions.Models.Exceptions : base(info, context) { } } -} \ No newline at end of file +} diff --git a/Kyoo.Core/Kyoo.Core.csproj b/Kyoo.Core/Kyoo.Core.csproj index 917b5a31..f01a160a 100644 --- a/Kyoo.Core/Kyoo.Core.csproj +++ b/Kyoo.Core/Kyoo.Core.csproj @@ -9,12 +9,6 @@ https://github.com/AnonymusRaccoon/Kyoo default - - - true - true - true - transcoder.dll @@ -58,14 +52,14 @@ - + PreserveNewest false - + diff --git a/Kyoo.Core/Views/LibraryApi.cs b/Kyoo.Core/Views/LibraryApi.cs index 60991589..6dd4faba 100644 --- a/Kyoo.Core/Views/LibraryApi.cs +++ b/Kyoo.Core/Views/LibraryApi.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; using Kyoo.Abstractions.Controllers; using Kyoo.Abstractions.Models; using Kyoo.Abstractions.Models.Permissions; using Kyoo.Core.Models.Options; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; namespace Kyoo.Core.Api @@ -33,11 +33,11 @@ namespace Kyoo.Core.Api ActionResult result = await base.Create(resource); if (result.Value != null) _taskManager.StartTask("scan", - new Progress(), + new Progress(), new Dictionary {{"slug", result.Value.Slug}}); return result; } - + [HttpGet("{id:int}/show")] [HttpGet("{id:int}/shows")] [PartialPermission(Kind.Read)] @@ -89,7 +89,7 @@ namespace Kyoo.Core.Api return BadRequest(new {Error = ex.Message}); } } - + [HttpGet("{id:int}/collection")] [HttpGet("{id:int}/collections")] [PartialPermission(Kind.Read)] @@ -141,7 +141,7 @@ namespace Kyoo.Core.Api return BadRequest(new {Error = ex.Message}); } } - + [HttpGet("{id:int}/item")] [HttpGet("{id:int}/items")] [PartialPermission(Kind.Read)] @@ -167,7 +167,7 @@ namespace Kyoo.Core.Api return BadRequest(new {Error = ex.Message}); } } - + [HttpGet("{slug}/item")] [HttpGet("{slug}/items")] [PartialPermission(Kind.Read)] @@ -194,4 +194,4 @@ namespace Kyoo.Core.Api } } } -} \ No newline at end of file +} diff --git a/Kyoo.Host.WindowsTrait/Kyoo.Host.WindowsTrait.csproj b/Kyoo.Host.WindowsTrait/Kyoo.Host.WindowsTrait.csproj index 41ab83db..3c9645d5 100644 --- a/Kyoo.Host.WindowsTrait/Kyoo.Host.WindowsTrait.csproj +++ b/Kyoo.Host.WindowsTrait/Kyoo.Host.WindowsTrait.csproj @@ -1,12 +1,8 @@  - - true - - - + - \ No newline at end of file + diff --git a/Kyoo.SqLite/Migrations/20210801171534_Initial.cs b/Kyoo.SqLite/Migrations/20210801171534_Initial.cs index a7e62b03..70d605d6 100644 --- a/Kyoo.SqLite/Migrations/20210801171534_Initial.cs +++ b/Kyoo.SqLite/Migrations/20210801171534_Initial.cs @@ -3,836 +3,836 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace Kyoo.SqLite.Migrations { - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Collections", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true), - Images = table.Column(type: "TEXT", nullable: true), - Overview = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Collections", x => x.ID); - }); - - migrationBuilder.CreateTable( - name: "Genres", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Genres", x => x.ID); - }); - - migrationBuilder.CreateTable( - name: "Libraries", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true), - Paths = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Libraries", x => x.ID); - }); - - migrationBuilder.CreateTable( - name: "People", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true), - Images = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_People", x => x.ID); - }); - - migrationBuilder.CreateTable( - name: "Providers", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true), - Images = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Providers", x => x.ID); - }); - - migrationBuilder.CreateTable( - name: "Studios", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Studios", x => x.ID); - }); - - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: false), - Username = table.Column(type: "TEXT", nullable: true), - Email = table.Column(type: "TEXT", nullable: true), - Password = table.Column(type: "TEXT", nullable: true), - Permissions = table.Column(type: "TEXT", nullable: true), - ExtraData = table.Column(type: "TEXT", nullable: true), - Images = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.ID); - }); - - migrationBuilder.CreateTable( - name: "LinkLibraryCollection", - columns: table => new - { - CollectionID = table.Column(type: "INTEGER", nullable: false), - LibraryID = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_LinkLibraryCollection", x => new { x.CollectionID, x.LibraryID }); - table.ForeignKey( - name: "FK_LinkLibraryCollection_Collections_CollectionID", - column: x => x.CollectionID, - principalTable: "Collections", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_LinkLibraryCollection_Libraries_LibraryID", - column: x => x.LibraryID, - principalTable: "Libraries", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "CollectionMetadataID", - columns: table => new - { - ResourceID = table.Column(type: "INTEGER", nullable: false), - ProviderID = table.Column(type: "INTEGER", nullable: false), - DataID = table.Column(type: "TEXT", nullable: true), - Link = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CollectionMetadataID", x => new { x.ResourceID, x.ProviderID }); - table.ForeignKey( - name: "FK_CollectionMetadataID_Collections_ResourceID", - column: x => x.ResourceID, - principalTable: "Collections", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_CollectionMetadataID_Providers_ProviderID", - column: x => x.ProviderID, - principalTable: "Providers", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "LinkLibraryProvider", - columns: table => new - { - LibraryID = table.Column(type: "INTEGER", nullable: false), - ProviderID = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_LinkLibraryProvider", x => new { x.LibraryID, x.ProviderID }); - table.ForeignKey( - name: "FK_LinkLibraryProvider_Libraries_LibraryID", - column: x => x.LibraryID, - principalTable: "Libraries", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_LinkLibraryProvider_Providers_ProviderID", - column: x => x.ProviderID, - principalTable: "Providers", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "PeopleMetadataID", - columns: table => new - { - ResourceID = table.Column(type: "INTEGER", nullable: false), - ProviderID = table.Column(type: "INTEGER", nullable: false), - DataID = table.Column(type: "TEXT", nullable: true), - Link = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PeopleMetadataID", x => new { x.ResourceID, x.ProviderID }); - table.ForeignKey( - name: "FK_PeopleMetadataID_People_ResourceID", - column: x => x.ResourceID, - principalTable: "People", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_PeopleMetadataID_Providers_ProviderID", - column: x => x.ProviderID, - principalTable: "Providers", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Shows", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: false), - Title = table.Column(type: "TEXT", nullable: true), - Aliases = table.Column(type: "TEXT", nullable: true), - Path = table.Column(type: "TEXT", nullable: true), - Overview = table.Column(type: "TEXT", nullable: true), - Status = table.Column(type: "INTEGER", nullable: false), - StartAir = table.Column(type: "TEXT", nullable: true), - EndAir = table.Column(type: "TEXT", nullable: true), - Images = table.Column(type: "TEXT", nullable: true), - IsMovie = table.Column(type: "INTEGER", nullable: false), - StudioID = table.Column(type: "INTEGER", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Shows", x => x.ID); - table.ForeignKey( - name: "FK_Shows_Studios_StudioID", - column: x => x.StudioID, - principalTable: "Studios", - principalColumn: "ID", - onDelete: ReferentialAction.SetNull); - }); - - migrationBuilder.CreateTable( - name: "StudioMetadataID", - columns: table => new - { - ResourceID = table.Column(type: "INTEGER", nullable: false), - ProviderID = table.Column(type: "INTEGER", nullable: false), - DataID = table.Column(type: "TEXT", nullable: true), - Link = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_StudioMetadataID", x => new { x.ResourceID, x.ProviderID }); - table.ForeignKey( - name: "FK_StudioMetadataID_Providers_ProviderID", - column: x => x.ProviderID, - principalTable: "Providers", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_StudioMetadataID_Studios_ResourceID", - column: x => x.ResourceID, - principalTable: "Studios", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "LinkCollectionShow", - columns: table => new - { - CollectionID = table.Column(type: "INTEGER", nullable: false), - ShowID = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_LinkCollectionShow", x => new { x.CollectionID, x.ShowID }); - table.ForeignKey( - name: "FK_LinkCollectionShow_Collections_CollectionID", - column: x => x.CollectionID, - principalTable: "Collections", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_LinkCollectionShow_Shows_ShowID", - column: x => x.ShowID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "LinkLibraryShow", - columns: table => new - { - LibraryID = table.Column(type: "INTEGER", nullable: false), - ShowID = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_LinkLibraryShow", x => new { x.LibraryID, x.ShowID }); - table.ForeignKey( - name: "FK_LinkLibraryShow_Libraries_LibraryID", - column: x => x.LibraryID, - principalTable: "Libraries", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_LinkLibraryShow_Shows_ShowID", - column: x => x.ShowID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "LinkShowGenre", - columns: table => new - { - GenreID = table.Column(type: "INTEGER", nullable: false), - ShowID = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_LinkShowGenre", x => new { x.GenreID, x.ShowID }); - table.ForeignKey( - name: "FK_LinkShowGenre_Genres_GenreID", - column: x => x.GenreID, - principalTable: "Genres", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_LinkShowGenre_Shows_ShowID", - column: x => x.ShowID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "LinkUserShow", - columns: table => new - { - UsersID = table.Column(type: "INTEGER", nullable: false), - WatchedID = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_LinkUserShow", x => new { x.UsersID, x.WatchedID }); - table.ForeignKey( - name: "FK_LinkUserShow_Shows_WatchedID", - column: x => x.WatchedID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_LinkUserShow_Users_UsersID", - column: x => x.UsersID, - principalTable: "Users", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "PeopleRoles", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - PeopleID = table.Column(type: "INTEGER", nullable: false), - ShowID = table.Column(type: "INTEGER", nullable: false), - Type = table.Column(type: "TEXT", nullable: true), - Role = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PeopleRoles", x => x.ID); - table.ForeignKey( - name: "FK_PeopleRoles_People_PeopleID", - column: x => x.PeopleID, - principalTable: "People", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_PeopleRoles_Shows_ShowID", - column: x => x.ShowID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Seasons", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: true), - ShowID = table.Column(type: "INTEGER", nullable: false), - SeasonNumber = table.Column(type: "INTEGER", nullable: false), - Title = table.Column(type: "TEXT", nullable: true), - Overview = table.Column(type: "TEXT", nullable: true), - StartDate = table.Column(type: "TEXT", nullable: true), - EndDate = table.Column(type: "TEXT", nullable: true), - Images = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Seasons", x => x.ID); - table.ForeignKey( - name: "FK_Seasons_Shows_ShowID", - column: x => x.ShowID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ShowMetadataID", - columns: table => new - { - ResourceID = table.Column(type: "INTEGER", nullable: false), - ProviderID = table.Column(type: "INTEGER", nullable: false), - DataID = table.Column(type: "TEXT", nullable: true), - Link = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ShowMetadataID", x => new { x.ResourceID, x.ProviderID }); - table.ForeignKey( - name: "FK_ShowMetadataID_Providers_ProviderID", - column: x => x.ProviderID, - principalTable: "Providers", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ShowMetadataID_Shows_ResourceID", - column: x => x.ResourceID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Episodes", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: true), - ShowID = table.Column(type: "INTEGER", nullable: false), - SeasonID = table.Column(type: "INTEGER", nullable: true), - SeasonNumber = table.Column(type: "INTEGER", nullable: true), - EpisodeNumber = table.Column(type: "INTEGER", nullable: true), - AbsoluteNumber = table.Column(type: "INTEGER", nullable: true), - Path = table.Column(type: "TEXT", nullable: true), - Images = table.Column(type: "TEXT", nullable: true), - Title = table.Column(type: "TEXT", nullable: true), - Overview = table.Column(type: "TEXT", nullable: true), - ReleaseDate = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Episodes", x => x.ID); - table.ForeignKey( - name: "FK_Episodes_Seasons_SeasonID", - column: x => x.SeasonID, - principalTable: "Seasons", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Episodes_Shows_ShowID", - column: x => x.ShowID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "SeasonMetadataID", - columns: table => new - { - ResourceID = table.Column(type: "INTEGER", nullable: false), - ProviderID = table.Column(type: "INTEGER", nullable: false), - DataID = table.Column(type: "TEXT", nullable: true), - Link = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_SeasonMetadataID", x => new { x.ResourceID, x.ProviderID }); - table.ForeignKey( - name: "FK_SeasonMetadataID_Providers_ProviderID", - column: x => x.ProviderID, - principalTable: "Providers", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_SeasonMetadataID_Seasons_ResourceID", - column: x => x.ResourceID, - principalTable: "Seasons", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "EpisodeMetadataID", - columns: table => new - { - ResourceID = table.Column(type: "INTEGER", nullable: false), - ProviderID = table.Column(type: "INTEGER", nullable: false), - DataID = table.Column(type: "TEXT", nullable: true), - Link = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_EpisodeMetadataID", x => new { x.ResourceID, x.ProviderID }); - table.ForeignKey( - name: "FK_EpisodeMetadataID_Episodes_ResourceID", - column: x => x.ResourceID, - principalTable: "Episodes", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_EpisodeMetadataID_Providers_ProviderID", - column: x => x.ProviderID, - principalTable: "Providers", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Tracks", - columns: table => new - { - ID = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(type: "TEXT", nullable: true), - Title = table.Column(type: "TEXT", nullable: true), - Language = table.Column(type: "TEXT", nullable: true), - Codec = table.Column(type: "TEXT", nullable: true), - IsDefault = table.Column(type: "INTEGER", nullable: false), - IsForced = table.Column(type: "INTEGER", nullable: false), - IsExternal = table.Column(type: "INTEGER", nullable: false), - Path = table.Column(type: "TEXT", nullable: true), - Type = table.Column(type: "INTEGER", nullable: false), - EpisodeID = table.Column(type: "INTEGER", nullable: false), - TrackIndex = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Tracks", x => x.ID); - table.ForeignKey( - name: "FK_Tracks_Episodes_EpisodeID", - column: x => x.EpisodeID, - principalTable: "Episodes", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "WatchedEpisodes", - columns: table => new - { - UserID = table.Column(type: "INTEGER", nullable: false), - EpisodeID = table.Column(type: "INTEGER", nullable: false), - WatchedPercentage = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_WatchedEpisodes", x => new { x.UserID, x.EpisodeID }); - table.ForeignKey( - name: "FK_WatchedEpisodes_Episodes_EpisodeID", - column: x => x.EpisodeID, - principalTable: "Episodes", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_WatchedEpisodes_Users_UserID", - column: x => x.UserID, - principalTable: "Users", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_CollectionMetadataID_ProviderID", - table: "CollectionMetadataID", - column: "ProviderID"); - - migrationBuilder.CreateIndex( - name: "IX_Collections_Slug", - table: "Collections", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_EpisodeMetadataID_ProviderID", - table: "EpisodeMetadataID", - column: "ProviderID"); - - migrationBuilder.CreateIndex( - name: "IX_Episodes_SeasonID", - table: "Episodes", - column: "SeasonID"); - - migrationBuilder.CreateIndex( - name: "IX_Episodes_ShowID_SeasonNumber_EpisodeNumber_AbsoluteNumber", - table: "Episodes", - columns: new[] { "ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Episodes_Slug", - table: "Episodes", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Genres_Slug", - table: "Genres", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Libraries_Slug", - table: "Libraries", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_LinkCollectionShow_ShowID", - table: "LinkCollectionShow", - column: "ShowID"); - - migrationBuilder.CreateIndex( - name: "IX_LinkLibraryCollection_LibraryID", - table: "LinkLibraryCollection", - column: "LibraryID"); - - migrationBuilder.CreateIndex( - name: "IX_LinkLibraryProvider_ProviderID", - table: "LinkLibraryProvider", - column: "ProviderID"); - - migrationBuilder.CreateIndex( - name: "IX_LinkLibraryShow_ShowID", - table: "LinkLibraryShow", - column: "ShowID"); - - migrationBuilder.CreateIndex( - name: "IX_LinkShowGenre_ShowID", - table: "LinkShowGenre", - column: "ShowID"); - - migrationBuilder.CreateIndex( - name: "IX_LinkUserShow_WatchedID", - table: "LinkUserShow", - column: "WatchedID"); - - migrationBuilder.CreateIndex( - name: "IX_People_Slug", - table: "People", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_PeopleMetadataID_ProviderID", - table: "PeopleMetadataID", - column: "ProviderID"); - - migrationBuilder.CreateIndex( - name: "IX_PeopleRoles_PeopleID", - table: "PeopleRoles", - column: "PeopleID"); - - migrationBuilder.CreateIndex( - name: "IX_PeopleRoles_ShowID", - table: "PeopleRoles", - column: "ShowID"); - - migrationBuilder.CreateIndex( - name: "IX_Providers_Slug", - table: "Providers", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_SeasonMetadataID_ProviderID", - table: "SeasonMetadataID", - column: "ProviderID"); - - migrationBuilder.CreateIndex( - name: "IX_Seasons_ShowID_SeasonNumber", - table: "Seasons", - columns: new[] { "ShowID", "SeasonNumber" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Seasons_Slug", - table: "Seasons", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ShowMetadataID_ProviderID", - table: "ShowMetadataID", - column: "ProviderID"); - - migrationBuilder.CreateIndex( - name: "IX_Shows_Slug", - table: "Shows", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Shows_StudioID", - table: "Shows", - column: "StudioID"); - - migrationBuilder.CreateIndex( - name: "IX_StudioMetadataID_ProviderID", - table: "StudioMetadataID", - column: "ProviderID"); - - migrationBuilder.CreateIndex( - name: "IX_Studios_Slug", - table: "Studios", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Tracks_EpisodeID_Type_Language_TrackIndex_IsForced", - table: "Tracks", - columns: new[] { "EpisodeID", "Type", "Language", "TrackIndex", "IsForced" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Tracks_Slug", - table: "Tracks", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Users_Slug", - table: "Users", - column: "Slug", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_WatchedEpisodes_EpisodeID", - table: "WatchedEpisodes", - column: "EpisodeID"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "CollectionMetadataID"); - - migrationBuilder.DropTable( - name: "EpisodeMetadataID"); - - migrationBuilder.DropTable( - name: "LinkCollectionShow"); - - migrationBuilder.DropTable( - name: "LinkLibraryCollection"); - - migrationBuilder.DropTable( - name: "LinkLibraryProvider"); - - migrationBuilder.DropTable( - name: "LinkLibraryShow"); + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Collections", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + Images = table.Column(type: "TEXT", nullable: true), + Overview = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Collections", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "Genres", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Genres", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "Libraries", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + Paths = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Libraries", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "People", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + Images = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_People", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "Providers", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + Images = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Providers", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "Studios", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Studios", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: false), + Username = table.Column(type: "TEXT", nullable: true), + Email = table.Column(type: "TEXT", nullable: true), + Password = table.Column(type: "TEXT", nullable: true), + Permissions = table.Column(type: "TEXT", nullable: true), + ExtraData = table.Column(type: "TEXT", nullable: true), + Images = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "LinkLibraryCollection", + columns: table => new + { + CollectionID = table.Column(type: "INTEGER", nullable: false), + LibraryID = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LinkLibraryCollection", x => new { x.CollectionID, x.LibraryID }); + table.ForeignKey( + name: "FK_LinkLibraryCollection_Collections_CollectionID", + column: x => x.CollectionID, + principalTable: "Collections", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_LinkLibraryCollection_Libraries_LibraryID", + column: x => x.LibraryID, + principalTable: "Libraries", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CollectionMetadataID", + columns: table => new + { + ResourceID = table.Column(type: "INTEGER", nullable: false), + ProviderID = table.Column(type: "INTEGER", nullable: false), + DataID = table.Column(type: "TEXT", nullable: true), + Link = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CollectionMetadataID", x => new { x.ResourceID, x.ProviderID }); + table.ForeignKey( + name: "FK_CollectionMetadataID_Collections_ResourceID", + column: x => x.ResourceID, + principalTable: "Collections", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CollectionMetadataID_Providers_ProviderID", + column: x => x.ProviderID, + principalTable: "Providers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LinkLibraryProvider", + columns: table => new + { + LibraryID = table.Column(type: "INTEGER", nullable: false), + ProviderID = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LinkLibraryProvider", x => new { x.LibraryID, x.ProviderID }); + table.ForeignKey( + name: "FK_LinkLibraryProvider_Libraries_LibraryID", + column: x => x.LibraryID, + principalTable: "Libraries", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_LinkLibraryProvider_Providers_ProviderID", + column: x => x.ProviderID, + principalTable: "Providers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PeopleMetadataID", + columns: table => new + { + ResourceID = table.Column(type: "INTEGER", nullable: false), + ProviderID = table.Column(type: "INTEGER", nullable: false), + DataID = table.Column(type: "TEXT", nullable: true), + Link = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PeopleMetadataID", x => new { x.ResourceID, x.ProviderID }); + table.ForeignKey( + name: "FK_PeopleMetadataID_People_ResourceID", + column: x => x.ResourceID, + principalTable: "People", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PeopleMetadataID_Providers_ProviderID", + column: x => x.ProviderID, + principalTable: "Providers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Shows", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: false), + Title = table.Column(type: "TEXT", nullable: true), + Aliases = table.Column(type: "TEXT", nullable: true), + Path = table.Column(type: "TEXT", nullable: true), + Overview = table.Column(type: "TEXT", nullable: true), + Status = table.Column(type: "INTEGER", nullable: false), + StartAir = table.Column(type: "TEXT", nullable: true), + EndAir = table.Column(type: "TEXT", nullable: true), + Images = table.Column(type: "TEXT", nullable: true), + IsMovie = table.Column(type: "INTEGER", nullable: false), + StudioID = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Shows", x => x.ID); + table.ForeignKey( + name: "FK_Shows_Studios_StudioID", + column: x => x.StudioID, + principalTable: "Studios", + principalColumn: "ID", + onDelete: ReferentialAction.SetNull); + }); + + migrationBuilder.CreateTable( + name: "StudioMetadataID", + columns: table => new + { + ResourceID = table.Column(type: "INTEGER", nullable: false), + ProviderID = table.Column(type: "INTEGER", nullable: false), + DataID = table.Column(type: "TEXT", nullable: true), + Link = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_StudioMetadataID", x => new { x.ResourceID, x.ProviderID }); + table.ForeignKey( + name: "FK_StudioMetadataID_Providers_ProviderID", + column: x => x.ProviderID, + principalTable: "Providers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StudioMetadataID_Studios_ResourceID", + column: x => x.ResourceID, + principalTable: "Studios", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LinkCollectionShow", + columns: table => new + { + CollectionID = table.Column(type: "INTEGER", nullable: false), + ShowID = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LinkCollectionShow", x => new { x.CollectionID, x.ShowID }); + table.ForeignKey( + name: "FK_LinkCollectionShow_Collections_CollectionID", + column: x => x.CollectionID, + principalTable: "Collections", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_LinkCollectionShow_Shows_ShowID", + column: x => x.ShowID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LinkLibraryShow", + columns: table => new + { + LibraryID = table.Column(type: "INTEGER", nullable: false), + ShowID = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LinkLibraryShow", x => new { x.LibraryID, x.ShowID }); + table.ForeignKey( + name: "FK_LinkLibraryShow_Libraries_LibraryID", + column: x => x.LibraryID, + principalTable: "Libraries", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_LinkLibraryShow_Shows_ShowID", + column: x => x.ShowID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LinkShowGenre", + columns: table => new + { + GenreID = table.Column(type: "INTEGER", nullable: false), + ShowID = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LinkShowGenre", x => new { x.GenreID, x.ShowID }); + table.ForeignKey( + name: "FK_LinkShowGenre_Genres_GenreID", + column: x => x.GenreID, + principalTable: "Genres", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_LinkShowGenre_Shows_ShowID", + column: x => x.ShowID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LinkUserShow", + columns: table => new + { + UsersID = table.Column(type: "INTEGER", nullable: false), + WatchedID = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LinkUserShow", x => new { x.UsersID, x.WatchedID }); + table.ForeignKey( + name: "FK_LinkUserShow_Shows_WatchedID", + column: x => x.WatchedID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_LinkUserShow_Users_UsersID", + column: x => x.UsersID, + principalTable: "Users", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PeopleRoles", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + PeopleID = table.Column(type: "INTEGER", nullable: false), + ShowID = table.Column(type: "INTEGER", nullable: false), + Type = table.Column(type: "TEXT", nullable: true), + Role = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PeopleRoles", x => x.ID); + table.ForeignKey( + name: "FK_PeopleRoles_People_PeopleID", + column: x => x.PeopleID, + principalTable: "People", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PeopleRoles_Shows_ShowID", + column: x => x.ShowID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Seasons", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: true), + ShowID = table.Column(type: "INTEGER", nullable: false), + SeasonNumber = table.Column(type: "INTEGER", nullable: false), + Title = table.Column(type: "TEXT", nullable: true), + Overview = table.Column(type: "TEXT", nullable: true), + StartDate = table.Column(type: "TEXT", nullable: true), + EndDate = table.Column(type: "TEXT", nullable: true), + Images = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Seasons", x => x.ID); + table.ForeignKey( + name: "FK_Seasons_Shows_ShowID", + column: x => x.ShowID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ShowMetadataID", + columns: table => new + { + ResourceID = table.Column(type: "INTEGER", nullable: false), + ProviderID = table.Column(type: "INTEGER", nullable: false), + DataID = table.Column(type: "TEXT", nullable: true), + Link = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowMetadataID", x => new { x.ResourceID, x.ProviderID }); + table.ForeignKey( + name: "FK_ShowMetadataID_Providers_ProviderID", + column: x => x.ProviderID, + principalTable: "Providers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowMetadataID_Shows_ResourceID", + column: x => x.ResourceID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Episodes", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: true), + ShowID = table.Column(type: "INTEGER", nullable: false), + SeasonID = table.Column(type: "INTEGER", nullable: true), + SeasonNumber = table.Column(type: "INTEGER", nullable: true), + EpisodeNumber = table.Column(type: "INTEGER", nullable: true), + AbsoluteNumber = table.Column(type: "INTEGER", nullable: true), + Path = table.Column(type: "TEXT", nullable: true), + Images = table.Column(type: "TEXT", nullable: true), + Title = table.Column(type: "TEXT", nullable: true), + Overview = table.Column(type: "TEXT", nullable: true), + ReleaseDate = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Episodes", x => x.ID); + table.ForeignKey( + name: "FK_Episodes_Seasons_SeasonID", + column: x => x.SeasonID, + principalTable: "Seasons", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Episodes_Shows_ShowID", + column: x => x.ShowID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SeasonMetadataID", + columns: table => new + { + ResourceID = table.Column(type: "INTEGER", nullable: false), + ProviderID = table.Column(type: "INTEGER", nullable: false), + DataID = table.Column(type: "TEXT", nullable: true), + Link = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SeasonMetadataID", x => new { x.ResourceID, x.ProviderID }); + table.ForeignKey( + name: "FK_SeasonMetadataID_Providers_ProviderID", + column: x => x.ProviderID, + principalTable: "Providers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SeasonMetadataID_Seasons_ResourceID", + column: x => x.ResourceID, + principalTable: "Seasons", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "EpisodeMetadataID", + columns: table => new + { + ResourceID = table.Column(type: "INTEGER", nullable: false), + ProviderID = table.Column(type: "INTEGER", nullable: false), + DataID = table.Column(type: "TEXT", nullable: true), + Link = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_EpisodeMetadataID", x => new { x.ResourceID, x.ProviderID }); + table.ForeignKey( + name: "FK_EpisodeMetadataID_Episodes_ResourceID", + column: x => x.ResourceID, + principalTable: "Episodes", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EpisodeMetadataID_Providers_ProviderID", + column: x => x.ProviderID, + principalTable: "Providers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Tracks", + columns: table => new + { + ID = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column(type: "TEXT", nullable: true), + Title = table.Column(type: "TEXT", nullable: true), + Language = table.Column(type: "TEXT", nullable: true), + Codec = table.Column(type: "TEXT", nullable: true), + IsDefault = table.Column(type: "INTEGER", nullable: false), + IsForced = table.Column(type: "INTEGER", nullable: false), + IsExternal = table.Column(type: "INTEGER", nullable: false), + Path = table.Column(type: "TEXT", nullable: true), + Type = table.Column(type: "INTEGER", nullable: false), + EpisodeID = table.Column(type: "INTEGER", nullable: false), + TrackIndex = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Tracks", x => x.ID); + table.ForeignKey( + name: "FK_Tracks_Episodes_EpisodeID", + column: x => x.EpisodeID, + principalTable: "Episodes", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "WatchedEpisodes", + columns: table => new + { + UserID = table.Column(type: "INTEGER", nullable: false), + EpisodeID = table.Column(type: "INTEGER", nullable: false), + WatchedPercentage = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WatchedEpisodes", x => new { x.UserID, x.EpisodeID }); + table.ForeignKey( + name: "FK_WatchedEpisodes_Episodes_EpisodeID", + column: x => x.EpisodeID, + principalTable: "Episodes", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WatchedEpisodes_Users_UserID", + column: x => x.UserID, + principalTable: "Users", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_CollectionMetadataID_ProviderID", + table: "CollectionMetadataID", + column: "ProviderID"); + + migrationBuilder.CreateIndex( + name: "IX_Collections_Slug", + table: "Collections", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_EpisodeMetadataID_ProviderID", + table: "EpisodeMetadataID", + column: "ProviderID"); + + migrationBuilder.CreateIndex( + name: "IX_Episodes_SeasonID", + table: "Episodes", + column: "SeasonID"); + + migrationBuilder.CreateIndex( + name: "IX_Episodes_ShowID_SeasonNumber_EpisodeNumber_AbsoluteNumber", + table: "Episodes", + columns: new[] { "ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Episodes_Slug", + table: "Episodes", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Genres_Slug", + table: "Genres", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Libraries_Slug", + table: "Libraries", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_LinkCollectionShow_ShowID", + table: "LinkCollectionShow", + column: "ShowID"); + + migrationBuilder.CreateIndex( + name: "IX_LinkLibraryCollection_LibraryID", + table: "LinkLibraryCollection", + column: "LibraryID"); + + migrationBuilder.CreateIndex( + name: "IX_LinkLibraryProvider_ProviderID", + table: "LinkLibraryProvider", + column: "ProviderID"); + + migrationBuilder.CreateIndex( + name: "IX_LinkLibraryShow_ShowID", + table: "LinkLibraryShow", + column: "ShowID"); + + migrationBuilder.CreateIndex( + name: "IX_LinkShowGenre_ShowID", + table: "LinkShowGenre", + column: "ShowID"); + + migrationBuilder.CreateIndex( + name: "IX_LinkUserShow_WatchedID", + table: "LinkUserShow", + column: "WatchedID"); + + migrationBuilder.CreateIndex( + name: "IX_People_Slug", + table: "People", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_PeopleMetadataID_ProviderID", + table: "PeopleMetadataID", + column: "ProviderID"); + + migrationBuilder.CreateIndex( + name: "IX_PeopleRoles_PeopleID", + table: "PeopleRoles", + column: "PeopleID"); + + migrationBuilder.CreateIndex( + name: "IX_PeopleRoles_ShowID", + table: "PeopleRoles", + column: "ShowID"); + + migrationBuilder.CreateIndex( + name: "IX_Providers_Slug", + table: "Providers", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_SeasonMetadataID_ProviderID", + table: "SeasonMetadataID", + column: "ProviderID"); + + migrationBuilder.CreateIndex( + name: "IX_Seasons_ShowID_SeasonNumber", + table: "Seasons", + columns: new[] { "ShowID", "SeasonNumber" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Seasons_Slug", + table: "Seasons", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ShowMetadataID_ProviderID", + table: "ShowMetadataID", + column: "ProviderID"); + + migrationBuilder.CreateIndex( + name: "IX_Shows_Slug", + table: "Shows", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Shows_StudioID", + table: "Shows", + column: "StudioID"); + + migrationBuilder.CreateIndex( + name: "IX_StudioMetadataID_ProviderID", + table: "StudioMetadataID", + column: "ProviderID"); + + migrationBuilder.CreateIndex( + name: "IX_Studios_Slug", + table: "Studios", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Tracks_EpisodeID_Type_Language_TrackIndex_IsForced", + table: "Tracks", + columns: new[] { "EpisodeID", "Type", "Language", "TrackIndex", "IsForced" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Tracks_Slug", + table: "Tracks", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Users_Slug", + table: "Users", + column: "Slug", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_WatchedEpisodes_EpisodeID", + table: "WatchedEpisodes", + column: "EpisodeID"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CollectionMetadataID"); + + migrationBuilder.DropTable( + name: "EpisodeMetadataID"); + + migrationBuilder.DropTable( + name: "LinkCollectionShow"); + + migrationBuilder.DropTable( + name: "LinkLibraryCollection"); + + migrationBuilder.DropTable( + name: "LinkLibraryProvider"); + + migrationBuilder.DropTable( + name: "LinkLibraryShow"); - migrationBuilder.DropTable( - name: "LinkShowGenre"); - - migrationBuilder.DropTable( - name: "LinkUserShow"); + migrationBuilder.DropTable( + name: "LinkShowGenre"); + + migrationBuilder.DropTable( + name: "LinkUserShow"); - migrationBuilder.DropTable( - name: "PeopleMetadataID"); + migrationBuilder.DropTable( + name: "PeopleMetadataID"); - migrationBuilder.DropTable( - name: "PeopleRoles"); + migrationBuilder.DropTable( + name: "PeopleRoles"); - migrationBuilder.DropTable( - name: "SeasonMetadataID"); + migrationBuilder.DropTable( + name: "SeasonMetadataID"); - migrationBuilder.DropTable( - name: "ShowMetadataID"); + migrationBuilder.DropTable( + name: "ShowMetadataID"); - migrationBuilder.DropTable( - name: "StudioMetadataID"); + migrationBuilder.DropTable( + name: "StudioMetadataID"); - migrationBuilder.DropTable( - name: "Tracks"); + migrationBuilder.DropTable( + name: "Tracks"); - migrationBuilder.DropTable( - name: "WatchedEpisodes"); + migrationBuilder.DropTable( + name: "WatchedEpisodes"); - migrationBuilder.DropTable( - name: "Collections"); + migrationBuilder.DropTable( + name: "Collections"); - migrationBuilder.DropTable( - name: "Libraries"); + migrationBuilder.DropTable( + name: "Libraries"); - migrationBuilder.DropTable( - name: "Genres"); + migrationBuilder.DropTable( + name: "Genres"); - migrationBuilder.DropTable( - name: "People"); + migrationBuilder.DropTable( + name: "People"); - migrationBuilder.DropTable( - name: "Providers"); + migrationBuilder.DropTable( + name: "Providers"); - migrationBuilder.DropTable( - name: "Episodes"); + migrationBuilder.DropTable( + name: "Episodes"); - migrationBuilder.DropTable( - name: "Users"); + migrationBuilder.DropTable( + name: "Users"); - migrationBuilder.DropTable( - name: "Seasons"); + migrationBuilder.DropTable( + name: "Seasons"); - migrationBuilder.DropTable( - name: "Shows"); + migrationBuilder.DropTable( + name: "Shows"); - migrationBuilder.DropTable( - name: "Studios"); - } - } + migrationBuilder.DropTable( + name: "Studios"); + } + } } diff --git a/Kyoo.TheMovieDb/Convertors/PeopleConvertors.cs b/Kyoo.TheMovieDb/Convertors/PeopleConvertors.cs index 61c57db9..3704af60 100644 --- a/Kyoo.TheMovieDb/Convertors/PeopleConvertors.cs +++ b/Kyoo.TheMovieDb/Convertors/PeopleConvertors.cs @@ -5,8 +5,8 @@ using TMDbLib.Objects.General; using TMDbLib.Objects.People; using TMDbLib.Objects.Search; using Images = Kyoo.Abstractions.Models.Images; -using TvCast = TMDbLib.Objects.TvShows.Cast; using MovieCast = TMDbLib.Objects.Movies.Cast; +using TvCast = TMDbLib.Objects.TvShows.Cast; namespace Kyoo.TheMovieDb { @@ -31,8 +31,8 @@ namespace Kyoo.TheMovieDb Name = cast.Name, Images = new Dictionary { - [Images.Poster] = cast.ProfilePath != null - ? $"https://image.tmdb.org/t/p/original{cast.ProfilePath}" + [Images.Poster] = cast.ProfilePath != null + ? $"https://image.tmdb.org/t/p/original{cast.ProfilePath}" : null }, ExternalIDs = new[] @@ -49,7 +49,7 @@ namespace Kyoo.TheMovieDb Role = cast.Character }; } - + /// /// Convert a to a . /// @@ -66,8 +66,8 @@ namespace Kyoo.TheMovieDb Name = cast.Name, Images = new Dictionary { - [Images.Poster] = cast.ProfilePath != null - ? $"https://image.tmdb.org/t/p/original{cast.ProfilePath}" + [Images.Poster] = cast.ProfilePath != null + ? $"https://image.tmdb.org/t/p/original{cast.ProfilePath}" : null }, ExternalIDs = new[] @@ -84,7 +84,7 @@ namespace Kyoo.TheMovieDb Role = cast.Character }; } - + /// /// Convert a to a . /// @@ -101,8 +101,8 @@ namespace Kyoo.TheMovieDb Name = crew.Name, Images = new Dictionary { - [Images.Poster] = crew.ProfilePath != null - ? $"https://image.tmdb.org/t/p/original{crew.ProfilePath}" + [Images.Poster] = crew.ProfilePath != null + ? $"https://image.tmdb.org/t/p/original{crew.ProfilePath}" : null }, ExternalIDs = new[] @@ -119,7 +119,7 @@ namespace Kyoo.TheMovieDb Role = crew.Job }; } - + /// /// Convert a to a . /// @@ -134,8 +134,8 @@ namespace Kyoo.TheMovieDb Name = person.Name, Images = new Dictionary { - [Images.Poster] = person.ProfilePath != null - ? $"https://image.tmdb.org/t/p/original{person.ProfilePath}" + [Images.Poster] = person.ProfilePath != null + ? $"https://image.tmdb.org/t/p/original{person.ProfilePath}" : null }, ExternalIDs = new[] @@ -149,7 +149,7 @@ namespace Kyoo.TheMovieDb } }; } - + /// /// Convert a to a . /// @@ -164,8 +164,8 @@ namespace Kyoo.TheMovieDb Name = person.Name, Images = new Dictionary { - [Images.Poster] = person.ProfilePath != null - ? $"https://image.tmdb.org/t/p/original{person.ProfilePath}" + [Images.Poster] = person.ProfilePath != null + ? $"https://image.tmdb.org/t/p/original{person.ProfilePath}" : null }, ExternalIDs = new[] @@ -180,4 +180,4 @@ namespace Kyoo.TheMovieDb }; } } -} \ No newline at end of file +} diff --git a/Kyoo.TheMovieDb/Convertors/ShowConvertors.cs b/Kyoo.TheMovieDb/Convertors/ShowConvertors.cs index 99ccc046..04981d82 100644 --- a/Kyoo.TheMovieDb/Convertors/ShowConvertors.cs +++ b/Kyoo.TheMovieDb/Convertors/ShowConvertors.cs @@ -49,7 +49,7 @@ namespace Kyoo.TheMovieDb .Select(x => x.ToPeople(provider)) .Concat(tv.Credits.Crew.Select(x => x.ToPeople(provider))) .ToArray(), - ExternalIDs = new [] + ExternalIDs = new[] { new MetadataID { @@ -60,7 +60,7 @@ namespace Kyoo.TheMovieDb } }; } - + /// /// Convert a to a . /// @@ -75,7 +75,7 @@ namespace Kyoo.TheMovieDb Title = tv.Name, Overview = tv.Overview, StartAir = tv.FirstAirDate, - Images = new Dictionary + Images = new Dictionary { [Images.Poster] = tv.PosterPath != null ? $"https://image.tmdb.org/t/p/original{tv.PosterPath}" @@ -84,7 +84,7 @@ namespace Kyoo.TheMovieDb ? $"https://image.tmdb.org/t/p/original{tv.BackdropPath}" : null, }, - ExternalIDs = new [] + ExternalIDs = new[] { new MetadataID { @@ -96,4 +96,4 @@ namespace Kyoo.TheMovieDb }; } } -} \ No newline at end of file +} diff --git a/Kyoo.TheMovieDb/Convertors/StudioConvertors.cs b/Kyoo.TheMovieDb/Convertors/StudioConvertors.cs index 22f2ef9d..b45069f7 100644 --- a/Kyoo.TheMovieDb/Convertors/StudioConvertors.cs +++ b/Kyoo.TheMovieDb/Convertors/StudioConvertors.cs @@ -22,7 +22,7 @@ namespace Kyoo.TheMovieDb { Slug = Utility.ToSlug(company.Name), Name = company.Name, - ExternalIDs = new [] + ExternalIDs = new[] { new MetadataID { @@ -58,4 +58,4 @@ namespace Kyoo.TheMovieDb }; } } -} \ No newline at end of file +} diff --git a/Kyoo.TheMovieDb/PluginTmdb.cs b/Kyoo.TheMovieDb/PluginTmdb.cs index 9af1a267..092c5910 100644 --- a/Kyoo.TheMovieDb/PluginTmdb.cs +++ b/Kyoo.TheMovieDb/PluginTmdb.cs @@ -14,24 +14,6 @@ namespace Kyoo.TheMovieDb /// public class PluginTmdb : IPlugin { - /// - public string Slug => "the-moviedb"; - - /// - public string Name => "TheMovieDb"; - - /// - public string Description => "A metadata provider for TheMovieDB."; - - /// - public bool Enabled => !string.IsNullOrEmpty(_configuration.GetValue("the-moviedb:apikey")); - - /// - public Dictionary Configuration => new() - { - { TheMovieDbOptions.Path, typeof(TheMovieDbOptions) } - }; - /// /// The configuration used to check if the api key is present or not. /// @@ -46,14 +28,34 @@ namespace Kyoo.TheMovieDb { _configuration = configuration; if (!Enabled) + { logger.LogWarning("No API key configured for TheMovieDB provider. " + "To enable TheMovieDB, specify one in the setting the-moviedb:APIKEY "); + } } + /// + public string Slug => "the-moviedb"; + + /// + public string Name => "TheMovieDb"; + + /// + public string Description => "A metadata provider for TheMovieDB."; + + /// + public bool Enabled => !string.IsNullOrEmpty(_configuration.GetValue("the-moviedb:apikey")); + + /// + public Dictionary Configuration => new() + { + { TheMovieDbOptions.Path, typeof(TheMovieDbOptions) } + }; + /// public void Configure(ContainerBuilder builder) { builder.RegisterProvider(); } } -} \ No newline at end of file +} diff --git a/Kyoo.TheMovieDb/TheMovieDbOptions.cs b/Kyoo.TheMovieDb/TheMovieDbOptions.cs index 2387f553..433b175f 100644 --- a/Kyoo.TheMovieDb/TheMovieDbOptions.cs +++ b/Kyoo.TheMovieDb/TheMovieDbOptions.cs @@ -11,8 +11,8 @@ namespace Kyoo.TheMovieDb.Models public const string Path = "the-moviedb"; /// - /// The api key of TheMovieDb. + /// The api key of TheMovieDb. /// public string ApiKey { get; set; } } -} \ No newline at end of file +} diff --git a/Kyoo.TheTvdb/Convertors.cs b/Kyoo.TheTvdb/Convertors.cs index d53dfe62..ddce7c01 100644 --- a/Kyoo.TheTvdb/Convertors.cs +++ b/Kyoo.TheTvdb/Convertors.cs @@ -14,7 +14,7 @@ namespace Kyoo.TheTvdb public static class Convertors { /// - /// Convert the string representation of the status in the tvdb API to a Kyoo's enum. + /// Convert the string representation of the status in the tvdb API to a Kyoo's enum. /// /// The string representing the status. /// A kyoo value or null. @@ -40,9 +40,9 @@ namespace Kyoo.TheTvdb ? parsed : null; } - + /// - /// Convert a series search to a show. + /// Convert a series search to a show. /// /// The search result /// The provider representing the tvdb inside kyoo @@ -60,7 +60,7 @@ namespace Kyoo.TheTvdb Images = new Dictionary { [Images.Poster] = !string.IsNullOrEmpty(result.Poster) - ? $"https://www.thetvdb.com{result.Poster}" + ? $"https://www.thetvdb.com{result.Poster}" : null, }, ExternalIDs = new[] @@ -74,7 +74,7 @@ namespace Kyoo.TheTvdb } }; } - + /// /// Convert a tvdb series to a kyoo show. /// @@ -94,10 +94,10 @@ namespace Kyoo.TheTvdb Images = new Dictionary { [Images.Poster] = !string.IsNullOrEmpty(series.Poster) - ? $"https://www.thetvdb.com/banners/{series.Poster}" + ? $"https://www.thetvdb.com/banners/{series.Poster}" : null, [Images.Thumbnail] = !string.IsNullOrEmpty(series.FanArt) - ? $"https://www.thetvdb.com/banners/{series.FanArt}" + ? $"https://www.thetvdb.com/banners/{series.FanArt}" : null }, Genres = series.Genre.Select(y => new Genre(y)).ToList(), @@ -112,7 +112,7 @@ namespace Kyoo.TheTvdb } }; } - + /// /// Convert a tvdb actor to a kyoo . /// @@ -126,10 +126,10 @@ namespace Kyoo.TheTvdb { Slug = Utility.ToSlug(actor.Name), Name = actor.Name, - Images = new Dictionary + Images = new Dictionary { - [Images.Poster] = !string.IsNullOrEmpty(actor.Image) - ? $"https://www.thetvdb.com/banners/{actor.Image}" + [Images.Poster] = !string.IsNullOrEmpty(actor.Image) + ? $"https://www.thetvdb.com/banners/{actor.Image}" : null } }, @@ -155,8 +155,8 @@ namespace Kyoo.TheTvdb Overview = episode.Overview, Images = new Dictionary { - [Images.Thumbnail] = !string.IsNullOrEmpty(episode.Filename) - ? $"https://www.thetvdb.com/banners/{episode.Filename}" + [Images.Thumbnail] = !string.IsNullOrEmpty(episode.Filename) + ? $"https://www.thetvdb.com/banners/{episode.Filename}" : null }, ExternalIDs = new[] @@ -171,4 +171,4 @@ namespace Kyoo.TheTvdb }; } } -} \ No newline at end of file +} diff --git a/Kyoo.ruleset b/Kyoo.ruleset new file mode 100644 index 00000000..1942824c --- /dev/null +++ b/Kyoo.ruleset @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stylecop.json b/stylecop.json new file mode 100644 index 00000000..70dcd450 --- /dev/null +++ b/stylecop.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + + } +}