load embedded song metadata (#495)

* load embedded song metadata

* index song artist and song album

* reset all song metadata
This commit is contained in:
Jason Dove
2021-11-24 07:31:34 -06:00
committed by GitHub
parent fb8c3a0453
commit 8e08ff059f
22 changed files with 8131 additions and 36 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,101 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.Migrations
{
public partial class Add_SongAlbum : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Genre_SongMetadata_SongMetadataId",
table: "Genre");
migrationBuilder.DropForeignKey(
name: "FK_Studio_SongMetadata_SongMetadataId",
table: "Studio");
migrationBuilder.AddColumn<string>(
name: "Album",
table: "SongMetadata",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Artist",
table: "SongMetadata",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Date",
table: "SongMetadata",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Track",
table: "SongMetadata",
type: "TEXT",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Genre_SongMetadata_SongMetadataId",
table: "Genre",
column: "SongMetadataId",
principalTable: "SongMetadata",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Studio_SongMetadata_SongMetadataId",
table: "Studio",
column: "SongMetadataId",
principalTable: "SongMetadata",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Genre_SongMetadata_SongMetadataId",
table: "Genre");
migrationBuilder.DropForeignKey(
name: "FK_Studio_SongMetadata_SongMetadataId",
table: "Studio");
migrationBuilder.DropColumn(
name: "Album",
table: "SongMetadata");
migrationBuilder.DropColumn(
name: "Artist",
table: "SongMetadata");
migrationBuilder.DropColumn(
name: "Date",
table: "SongMetadata");
migrationBuilder.DropColumn(
name: "Track",
table: "SongMetadata");
migrationBuilder.AddForeignKey(
name: "FK_Genre_SongMetadata_SongMetadataId",
table: "Genre",
column: "SongMetadataId",
principalTable: "SongMetadata",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Studio_SongMetadata_SongMetadataId",
table: "Studio",
column: "SongMetadataId",
principalTable: "SongMetadata",
principalColumn: "Id");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.Migrations
{
public partial class Reset_SongMetadata : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(
@"UPDATE LibraryPath SET LastScan = '0001-01-01 00:00:00' WHERE Id IN
(SELECT LP.Id FROM LibraryPath LP INNER JOIN Library L on L.Id = LP.LibraryId WHERE MediaKind = 5)");
migrationBuilder.Sql(
@"UPDATE Library SET LastScan = '0001-01-01 00:00:00' WHERE MediaKind = 5");
migrationBuilder.Sql(
@"UPDATE SongMetadata SET DateUpdated = '0001-01-01 00:00:00'");
migrationBuilder.Sql(
@"UPDATE LibraryFolder SET Etag = NULL WHERE Id IN
(SELECT LF.Id FROM LibraryFolder LF INNER JOIN LibraryPath LP on LF.LibraryPathId = LP.Id INNER JOIN Library L on LP.LibraryId = L.Id WHERE MediaKind = 5)");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
@@ -1637,6 +1637,15 @@ namespace ErsatzTV.Infrastructure.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Album")
.HasColumnType("TEXT");
b.Property<string>("Artist")
.HasColumnType("TEXT");
b.Property<string>("Date")
.HasColumnType("TEXT");
b.Property<DateTime>("DateAdded")
.HasColumnType("TEXT");
@@ -1661,6 +1670,9 @@ namespace ErsatzTV.Infrastructure.Migrations
b.Property<string>("Title")
.HasColumnType("TEXT");
b.Property<string>("Track")
.HasColumnType("TEXT");
b.Property<int?>("Year")
.HasColumnType("INTEGER");
@@ -2553,7 +2565,8 @@ namespace ErsatzTV.Infrastructure.Migrations
b.HasOne("ErsatzTV.Core.Domain.SongMetadata", null)
.WithMany("Genres")
.HasForeignKey("SongMetadataId");
.HasForeignKey("SongMetadataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ErsatzTV.Core.Domain.JellyfinConnection", b =>
@@ -3116,7 +3129,8 @@ namespace ErsatzTV.Infrastructure.Migrations
b.HasOne("ErsatzTV.Core.Domain.SongMetadata", null)
.WithMany("Studios")
.HasForeignKey("SongMetadataId");
.HasForeignKey("SongMetadataId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("ErsatzTV.Core.Domain.Style", b =>