optimize local library scanning by using etags (#196)

* use etags to optimize local movie scanner

* use etags to optimize local television scanner

* use etags to optimize local music video scanner

* code cleanup
This commit is contained in:
Jason Dove
2021-05-21 06:18:07 -05:00
committed by GitHub
parent c0b5ecd388
commit 0799fe25d1
20 changed files with 2774 additions and 68 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ErsatzTV.Infrastructure.Migrations
{
public partial class Add_LibraryFolder : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
"LibraryFolder",
table => new
{
Id = table.Column<int>("INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Path = table.Column<string>("TEXT", nullable: true),
LibraryPathId = table.Column<int>("INTEGER", nullable: false),
Etag = table.Column<string>("TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LibraryFolder", x => x.Id);
table.ForeignKey(
"FK_LibraryFolder_LibraryPath_LibraryPathId",
x => x.LibraryPathId,
"LibraryPath",
"Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
"IX_LibraryFolder_LibraryPathId",
"LibraryFolder",
"LibraryPathId");
}
protected override void Down(MigrationBuilder migrationBuilder) =>
migrationBuilder.DropTable(
"LibraryFolder");
}
}
@@ -517,6 +517,30 @@ namespace ErsatzTV.Infrastructure.Migrations
b.ToTable("Library");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.LibraryFolder",
b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Etag")
.HasColumnType("TEXT");
b.Property<int>("LibraryPathId")
.HasColumnType("INTEGER");
b.Property<string>("Path")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("LibraryPathId");
b.ToTable("LibraryFolder");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.LibraryPath",
b =>
@@ -1811,6 +1835,19 @@ namespace ErsatzTV.Infrastructure.Migrations
b.Navigation("MediaSource");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.LibraryFolder",
b =>
{
b.HasOne("ErsatzTV.Core.Domain.LibraryPath", "LibraryPath")
.WithMany("LibraryFolders")
.HasForeignKey("LibraryPathId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LibraryPath");
});
modelBuilder.Entity(
"ErsatzTV.Core.Domain.LibraryPath",
b =>
@@ -2559,7 +2596,14 @@ namespace ErsatzTV.Infrastructure.Migrations
modelBuilder.Entity("ErsatzTV.Core.Domain.Library", b => { b.Navigation("Paths"); });
modelBuilder.Entity("ErsatzTV.Core.Domain.LibraryPath", b => { b.Navigation("MediaItems"); });
modelBuilder.Entity(
"ErsatzTV.Core.Domain.LibraryPath",
b =>
{
b.Navigation("LibraryFolders");
b.Navigation("MediaItems");
});
modelBuilder.Entity("ErsatzTV.Core.Domain.MediaItem", b => { b.Navigation("CollectionItems"); });