mirror of https://github.com/ErsatzTV/ErsatzTV.git
37 changed files with 3505 additions and 104 deletions
@ -1,8 +1,9 @@
@@ -1,8 +1,9 @@
|
||||
using ErsatzTV.Core; |
||||
using ErsatzTV.Core.Domain; |
||||
using LanguageExt; |
||||
using MediatR; |
||||
|
||||
namespace ErsatzTV.Application.Images.Queries |
||||
{ |
||||
public record GetImageContents(string FileName) : IRequest<Either<BaseError, ImageViewModel>>; |
||||
public record GetImageContents(string FileName, ArtworkKind ArtworkKind, int? MaxHeight = null) : IRequest<Either<BaseError, ImageViewModel>>; |
||||
} |
||||
|
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
using System; |
||||
|
||||
namespace ErsatzTV.Core.Domain |
||||
{ |
||||
public class Artwork |
||||
{ |
||||
public int Id { get; set; } |
||||
public string Path { get; set; } |
||||
public ArtworkKind ArtworkKind { get; set; } |
||||
public DateTime DateAdded { get; set; } |
||||
public DateTime DateUpdated { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
namespace ErsatzTV.Core.Domain |
||||
{ |
||||
public enum ArtworkKind |
||||
{ |
||||
Poster = 0, |
||||
Thumbnail = 1, |
||||
Logo = 2 |
||||
} |
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
namespace ErsatzTV.Core.Domain |
||||
{ |
||||
public class SeasonMetadata : Metadata |
||||
{ |
||||
public string Outline { get; set; } |
||||
public int SeasonId { get; set; } |
||||
public Season Season { get; set; } |
||||
} |
||||
} |
||||
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace ErsatzTV.Core.Interfaces.Domain |
||||
{ |
||||
public interface IHasAPoster |
||||
{ |
||||
string Path { get; set; } |
||||
string Poster { get; set; } |
||||
DateTime? PosterLastWriteTime { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
using ErsatzTV.Core.Domain; |
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
||||
|
||||
namespace ErsatzTV.Infrastructure.Data.Configurations |
||||
{ |
||||
public class ArtworkConfiguration : IEntityTypeConfiguration<Artwork> |
||||
{ |
||||
public void Configure(EntityTypeBuilder<Artwork> builder) => builder.ToTable("Artwork"); |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,89 @@
@@ -0,0 +1,89 @@
|
||||
using System; |
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations |
||||
{ |
||||
public partial class Add_Artwork : Migration |
||||
{ |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropColumn( |
||||
"Poster", |
||||
"MediaItem"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
"PosterLastWriteTime", |
||||
"MediaItem"); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
"Artwork", |
||||
table => new |
||||
{ |
||||
Id = table.Column<int>("INTEGER", nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Path = table.Column<string>("TEXT", nullable: true), |
||||
ArtworkKind = table.Column<int>("INTEGER", nullable: false), |
||||
DateAdded = table.Column<DateTime>("TEXT", nullable: false), |
||||
DateUpdated = table.Column<DateTime>("TEXT", nullable: false), |
||||
EpisodeMetadataId = table.Column<int>("INTEGER", nullable: true), |
||||
MovieMetadataId = table.Column<int>("INTEGER", nullable: true), |
||||
ShowMetadataId = table.Column<int>("INTEGER", nullable: true) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_Artwork", x => x.Id); |
||||
table.ForeignKey( |
||||
"FK_Artwork_EpisodeMetadata_EpisodeMetadataId", |
||||
x => x.EpisodeMetadataId, |
||||
"EpisodeMetadata", |
||||
"Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
"FK_Artwork_MovieMetadata_MovieMetadataId", |
||||
x => x.MovieMetadataId, |
||||
"MovieMetadata", |
||||
"Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
"FK_Artwork_ShowMetadata_ShowMetadataId", |
||||
x => x.ShowMetadataId, |
||||
"ShowMetadata", |
||||
"Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
"IX_Artwork_EpisodeMetadataId", |
||||
"Artwork", |
||||
"EpisodeMetadataId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
"IX_Artwork_MovieMetadataId", |
||||
"Artwork", |
||||
"MovieMetadataId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
"IX_Artwork_ShowMetadataId", |
||||
"Artwork", |
||||
"ShowMetadataId"); |
||||
} |
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropTable( |
||||
"Artwork"); |
||||
|
||||
migrationBuilder.AddColumn<string>( |
||||
"Poster", |
||||
"MediaItem", |
||||
"TEXT", |
||||
nullable: true); |
||||
|
||||
migrationBuilder.AddColumn<DateTime>( |
||||
"PosterLastWriteTime", |
||||
"MediaItem", |
||||
"TEXT", |
||||
nullable: true); |
||||
} |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
using System; |
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations |
||||
{ |
||||
public partial class Add_SeasonMetadata : Migration |
||||
{ |
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AddColumn<int>( |
||||
"SeasonMetadataId", |
||||
"Artwork", |
||||
"INTEGER", |
||||
nullable: true); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
"SeasonMetadata", |
||||
table => new |
||||
{ |
||||
Id = table.Column<int>("INTEGER", nullable: false) |
||||
.Annotation("Sqlite:Autoincrement", true), |
||||
Outline = table.Column<string>("TEXT", nullable: true), |
||||
SeasonId = table.Column<int>("INTEGER", nullable: false), |
||||
MetadataKind = table.Column<int>("INTEGER", nullable: false), |
||||
Title = table.Column<string>("TEXT", nullable: true), |
||||
OriginalTitle = table.Column<string>("TEXT", nullable: true), |
||||
SortTitle = table.Column<string>("TEXT", nullable: true), |
||||
ReleaseDate = table.Column<DateTime>("TEXT", nullable: true), |
||||
DateAdded = table.Column<DateTime>("TEXT", nullable: false), |
||||
DateUpdated = table.Column<DateTime>("TEXT", nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_SeasonMetadata", x => x.Id); |
||||
table.ForeignKey( |
||||
"FK_SeasonMetadata_Season_SeasonId", |
||||
x => x.SeasonId, |
||||
"Season", |
||||
"Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
"IX_Artwork_SeasonMetadataId", |
||||
"Artwork", |
||||
"SeasonMetadataId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
"IX_SeasonMetadata_SeasonId", |
||||
"SeasonMetadata", |
||||
"SeasonId"); |
||||
|
||||
migrationBuilder.AddForeignKey( |
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId", |
||||
"Artwork", |
||||
"SeasonMetadataId", |
||||
"SeasonMetadata", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
} |
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropForeignKey( |
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId", |
||||
"Artwork"); |
||||
|
||||
migrationBuilder.DropTable( |
||||
"SeasonMetadata"); |
||||
|
||||
migrationBuilder.DropIndex( |
||||
"IX_Artwork_SeasonMetadataId", |
||||
"Artwork"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
"SeasonMetadataId", |
||||
"Artwork"); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue