Allowing custom logo extensions for providers

This commit is contained in:
Zoe Roux 2021-03-25 20:22:59 +01:00
parent a620cc1818
commit a7f3dcc341
4 changed files with 12 additions and 6 deletions

View File

@ -149,7 +149,6 @@ namespace Kyoo.Controllers
{
if (provider == null)
throw new ArgumentNullException(nameof(provider));
// TODO add a image's type on the provider to allow svg here.
// TODO fix trailer display.
string thumbPath = Path.GetFullPath(Path.Combine(_providerPath, $"{provider.Slug}.{provider.LogoExtension}"));
return Task.FromResult(thumbPath.StartsWith(_providerPath) ? thumbPath : null);

View File

@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal
{
[DbContext(typeof(DatabaseContext))]
[Migration("20210317220956_Initial")]
[Migration("20210325184215_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -19,7 +19,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
modelBuilder
.HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" })
.HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "font" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "attachment" })
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
@ -330,6 +330,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.Property<string>("Logo")
.HasColumnType("text");
b.Property<string>("LogoExtension")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");

View File

@ -11,7 +11,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:Enum:item_type", "show,movie,collection")
.Annotation("Npgsql:Enum:status", "finished,airing,planned,unknown")
.Annotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,font");
.Annotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,attachment");
migrationBuilder.CreateTable(
name: "Collections",
@ -81,7 +81,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
Logo = table.Column<string>(type: "text", nullable: true)
Logo = table.Column<string>(type: "text", nullable: true),
LogoExtension = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{

View File

@ -17,7 +17,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
modelBuilder
.HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" })
.HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "font" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "attachment" })
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
@ -328,6 +328,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.Property<string>("Logo")
.HasColumnType("text");
b.Property<string>("LogoExtension")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");