enable plex for television (#73)

* add plex show, season sync

* sync plex episodes

* sync plex episode statistics

* update plex artwork as needed

* code cleanup

* add note about tests
This commit is contained in:
Jason Dove
2021-03-14 16:03:04 +00:00
committed by GitHub
parent d5b48d2601
commit 9ba0cbd84f
31 changed files with 2855 additions and 112 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,79 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ErsatzTV.Infrastructure.Migrations
{
public partial class Add_PlexTelevision : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
"PlexEpisode",
table => new
{
Id = table.Column<int>("INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Key = table.Column<string>("TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlexEpisode", x => x.Id);
table.ForeignKey(
"FK_PlexEpisode_Episode_Id",
x => x.Id,
"Episode",
"Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
"PlexSeason",
table => new
{
Id = table.Column<int>("INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Key = table.Column<string>("TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlexSeason", x => x.Id);
table.ForeignKey(
"FK_PlexSeason_Season_Id",
x => x.Id,
"Season",
"Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
"PlexShow",
table => new
{
Id = table.Column<int>("INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Key = table.Column<string>("TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlexShow", x => x.Id);
table.ForeignKey(
"FK_PlexShow_Show_Id",
x => x.Id,
"Show",
"Id",
onDelete: ReferentialAction.Cascade);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
"PlexEpisode");
migrationBuilder.DropTable(
"PlexSeason");
migrationBuilder.DropTable(
"PlexShow");
}
}
}
@@ -1044,6 +1044,18 @@ namespace ErsatzTV.Infrastructure.Migrations
b.ToTable("ProgramScheduleOneItem");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.PlexEpisode",
b =>
{
b.HasBaseType("ErsatzTV.Core.Domain.Episode");
b.Property<string>("Key")
.HasColumnType("TEXT");
b.ToTable("PlexEpisode");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.PlexMovie",
b =>
@@ -1056,6 +1068,30 @@ namespace ErsatzTV.Infrastructure.Migrations
b.ToTable("PlexMovie");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.PlexSeason",
b =>
{
b.HasBaseType("ErsatzTV.Core.Domain.Season");
b.Property<string>("Key")
.HasColumnType("TEXT");
b.ToTable("PlexSeason");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.PlexShow",
b =>
{
b.HasBaseType("ErsatzTV.Core.Domain.Show");
b.Property<string>("Key")
.HasColumnType("TEXT");
b.ToTable("PlexShow");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.Artwork",
b =>
@@ -1645,6 +1681,17 @@ namespace ErsatzTV.Infrastructure.Migrations
.IsRequired();
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.PlexEpisode",
b =>
{
b.HasOne("ErsatzTV.Core.Domain.Episode", null)
.WithOne()
.HasForeignKey("ErsatzTV.Core.Domain.PlexEpisode", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.PlexMovie",
b =>
@@ -1656,6 +1703,28 @@ namespace ErsatzTV.Infrastructure.Migrations
.IsRequired();
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.PlexSeason",
b =>
{
b.HasOne("ErsatzTV.Core.Domain.Season", null)
.WithOne()
.HasForeignKey("ErsatzTV.Core.Domain.PlexSeason", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.PlexShow",
b =>
{
b.HasOne("ErsatzTV.Core.Domain.Show", null)
.WithOne()
.HasForeignKey("ErsatzTV.Core.Domain.PlexShow", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.Channel",
b =>