#62 importing mysql music catalogue data
This commit is contained in:
parent
bdea67d1ec
commit
f75c62a40e
2065
RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.Designer.cs
generated
Normal file
2065
RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
276
RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.cs
Normal file
276
RMuseum/Migrations/20210111084102_GanjoorMusicCatalogue.cs
Normal file
@ -0,0 +1,276 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class GanjoorMusicCatalogue : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GolhaCollections",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GolhaCollections", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Singers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Url = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Singers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GolhaProgram",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
GolhaCollectionId = table.Column<int>(nullable: false),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
ProgramOrder = table.Column<int>(nullable: false),
|
||||
Url = table.Column<string>(nullable: true),
|
||||
Mp3 = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GolhaProgram", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GolhaProgram_GolhaCollections_GolhaCollectionId",
|
||||
column: x => x.GolhaCollectionId,
|
||||
principalTable: "GolhaCollections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GanjoorAlbum",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
SingerId = table.Column<int>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Url = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GanjoorAlbum", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GanjoorAlbum_Singers_SingerId",
|
||||
column: x => x.SingerId,
|
||||
principalTable: "Singers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GolhaTrack",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
GolhaProgramId = table.Column<int>(nullable: false),
|
||||
TrackNo = table.Column<int>(nullable: false),
|
||||
Timing = table.Column<string>(nullable: true),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
SingerId = table.Column<int>(nullable: true),
|
||||
Blocked = table.Column<bool>(nullable: false),
|
||||
BlockReason = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GolhaTrack", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_GolhaTrack_GolhaProgram_GolhaProgramId",
|
||||
column: x => x.GolhaProgramId,
|
||||
principalTable: "GolhaProgram",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_GolhaTrack_Singers_SingerId",
|
||||
column: x => x.SingerId,
|
||||
principalTable: "Singers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MusicTracks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
AlbumId = table.Column<int>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Url = table.Column<string>(nullable: true),
|
||||
Blocked = table.Column<bool>(nullable: false),
|
||||
BlockReason = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MusicTracks", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MusicTracks_GanjoorAlbum_AlbumId",
|
||||
column: x => x.AlbumId,
|
||||
principalTable: "GanjoorAlbum",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PoemMusicTracks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PoemId = table.Column<int>(nullable: false),
|
||||
TrackType = table.Column<int>(nullable: false),
|
||||
ArtistName = table.Column<string>(nullable: true),
|
||||
ArtistUrl = table.Column<string>(nullable: true),
|
||||
AlbumName = table.Column<string>(nullable: true),
|
||||
AlbumUrl = table.Column<string>(nullable: true),
|
||||
TrackName = table.Column<string>(nullable: true),
|
||||
TrackUrl = table.Column<string>(nullable: true),
|
||||
GanjoorTrackId = table.Column<int>(nullable: true),
|
||||
SingerId = table.Column<int>(nullable: true),
|
||||
GolhaTrackId = table.Column<int>(nullable: true),
|
||||
Description = table.Column<string>(nullable: true),
|
||||
Approved = table.Column<bool>(nullable: false),
|
||||
SuggestedById = table.Column<Guid>(nullable: true),
|
||||
ApprovalDate = table.Column<DateTime>(nullable: false),
|
||||
BrokenLink = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PoemMusicTracks", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PoemMusicTracks_MusicTracks_GanjoorTrackId",
|
||||
column: x => x.GanjoorTrackId,
|
||||
principalTable: "MusicTracks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_PoemMusicTracks_GolhaTrack_GolhaTrackId",
|
||||
column: x => x.GolhaTrackId,
|
||||
principalTable: "GolhaTrack",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_PoemMusicTracks_GanjoorPoems_PoemId",
|
||||
column: x => x.PoemId,
|
||||
principalTable: "GanjoorPoems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PoemMusicTracks_Singers_SingerId",
|
||||
column: x => x.SingerId,
|
||||
principalTable: "Singers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_PoemMusicTracks_AspNetUsers_SuggestedById",
|
||||
column: x => x.SuggestedById,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorAlbum_SingerId",
|
||||
table: "GanjoorAlbum",
|
||||
column: "SingerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GolhaProgram_GolhaCollectionId",
|
||||
table: "GolhaProgram",
|
||||
column: "GolhaCollectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GolhaTrack_GolhaProgramId",
|
||||
table: "GolhaTrack",
|
||||
column: "GolhaProgramId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GolhaTrack_SingerId",
|
||||
table: "GolhaTrack",
|
||||
column: "SingerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MusicTracks_AlbumId",
|
||||
table: "MusicTracks",
|
||||
column: "AlbumId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MusicTracks_Name",
|
||||
table: "MusicTracks",
|
||||
column: "Name");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PoemMusicTracks_GanjoorTrackId",
|
||||
table: "PoemMusicTracks",
|
||||
column: "GanjoorTrackId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PoemMusicTracks_GolhaTrackId",
|
||||
table: "PoemMusicTracks",
|
||||
column: "GolhaTrackId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PoemMusicTracks_PoemId",
|
||||
table: "PoemMusicTracks",
|
||||
column: "PoemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PoemMusicTracks_SingerId",
|
||||
table: "PoemMusicTracks",
|
||||
column: "SingerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PoemMusicTracks_SuggestedById",
|
||||
table: "PoemMusicTracks",
|
||||
column: "SuggestedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Singers_Name",
|
||||
table: "Singers",
|
||||
column: "Name");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PoemMusicTracks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MusicTracks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GolhaTrack");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GanjoorAlbum");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GolhaProgram");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Singers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GolhaCollections");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -549,6 +549,76 @@ namespace RMuseum.Migrations
|
||||
b.ToTable("GanjoorVerses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("AlbumName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("AlbumUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("ApprovalDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("Approved")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("ArtistName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ArtistUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("BrokenLink")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("GanjoorTrackId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("GolhaTrackId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PoemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("SingerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("SuggestedById")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("TrackName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("TrackType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrackUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GanjoorTrackId");
|
||||
|
||||
b.HasIndex("GolhaTrackId");
|
||||
|
||||
b.HasIndex("PoemId");
|
||||
|
||||
b.HasIndex("SingerId");
|
||||
|
||||
b.HasIndex("SuggestedById");
|
||||
|
||||
b.ToTable("PoemMusicTracks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.GanjoorAudio.Recitation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -884,6 +954,157 @@ namespace RMuseum.Migrations
|
||||
b.ToTable("ImportJobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("SingerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SingerId");
|
||||
|
||||
b.ToTable("GanjoorAlbum");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorSinger", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.ToTable("Singers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorTrack", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("AlbumId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BlockReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("Blocked")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AlbumId");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.ToTable("MusicTracks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaCollection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("GolhaCollections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("GolhaCollectionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Mp3")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ProgramOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GolhaCollectionId");
|
||||
|
||||
b.ToTable("GolhaProgram");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("BlockReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("Blocked")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("GolhaProgramId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("SingerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Timing")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("TrackNo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GolhaProgramId");
|
||||
|
||||
b.HasIndex("SingerId");
|
||||
|
||||
b.ToTable("GolhaTrack");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Note.RUserNote", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@ -1607,6 +1828,31 @@ namespace RMuseum.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorTrack", "GanjoorTrack")
|
||||
.WithMany()
|
||||
.HasForeignKey("GanjoorTrackId");
|
||||
|
||||
b.HasOne("RMuseum.Models.MusicCatalogue.GolhaTrack", "GolhaTrack")
|
||||
.WithMany()
|
||||
.HasForeignKey("GolhaTrackId");
|
||||
|
||||
b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem")
|
||||
.WithMany()
|
||||
.HasForeignKey("PoemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer")
|
||||
.WithMany()
|
||||
.HasForeignKey("SingerId");
|
||||
|
||||
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("SuggestedById");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.GanjoorAudio.Recitation", b =>
|
||||
{
|
||||
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Owner")
|
||||
@ -1687,6 +1933,46 @@ namespace RMuseum.Migrations
|
||||
.HasForeignKey("ArtifactId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer")
|
||||
.WithMany("Albums")
|
||||
.HasForeignKey("SingerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorTrack", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorAlbum", "Album")
|
||||
.WithMany("Tracks")
|
||||
.HasForeignKey("AlbumId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.MusicCatalogue.GolhaCollection", "GolhaCollection")
|
||||
.WithMany("Programs")
|
||||
.HasForeignKey("GolhaCollectionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b =>
|
||||
{
|
||||
b.HasOne("RMuseum.Models.MusicCatalogue.GolhaProgram", "GolhaProgram")
|
||||
.WithMany("Tracks")
|
||||
.HasForeignKey("GolhaProgramId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer")
|
||||
.WithMany()
|
||||
.HasForeignKey("SingerId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RMuseum.Models.Note.RUserNote", b =>
|
||||
{
|
||||
b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser")
|
||||
|
||||
@ -3780,6 +3780,16 @@
|
||||
GanjoorTrack Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.Singer">
|
||||
<summary>
|
||||
singer
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.SingerId">
|
||||
<summary>
|
||||
singer id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.GanjoorTrack">
|
||||
<summary>
|
||||
GanjoorTrack
|
||||
@ -3800,6 +3810,29 @@
|
||||
description
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.Approved">
|
||||
<summary>
|
||||
approved
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.SuggestedById">
|
||||
<summary>
|
||||
Suggested by user id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.SuggestedBy">
|
||||
<summary>
|
||||
Suggested by user
|
||||
</summary>
|
||||
<remarks>
|
||||
approval user would be extractable from AuditLogs
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.ApprovalDate">
|
||||
<summary>
|
||||
approval date
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.BrokenLink">
|
||||
<summary>
|
||||
broken link
|
||||
@ -6439,6 +6472,28 @@
|
||||
<param name="additional"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.Implementation.MusicCatalogueService">
|
||||
<summary>
|
||||
Music Catalgue Service Implementation
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.MusicCatalogueService.ImportFromMySql(RSecurityBackend.Services.Implementation.LongRunningJobProgressServiceEF,RSecurityBackend.Models.Generic.Db.RLongRunningJobStatus)">
|
||||
<summary>
|
||||
import catalogue from ganjoor.net MySql db
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:RMuseum.Services.Implementation.MusicCatalogueService.Configuration">
|
||||
<summary>
|
||||
Configuration
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.MusicCatalogueService.#ctor(Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary>
|
||||
constructor
|
||||
</summary>
|
||||
<param name="configuration"></param>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.Implementation.PictureFileService">
|
||||
<summary>
|
||||
manipulating picture files
|
||||
|
||||
@ -964,6 +964,7 @@ namespace RMuseum.Services.Implementation
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
using (MySqlConnection connection = new MySqlConnection
|
||||
(
|
||||
$"server={Configuration.GetSection("AudioMySqlServer")["Server"]};uid={Configuration.GetSection("AudioMySqlServer")["Username"]};pwd={Configuration.GetSection("AudioMySqlServer")["Password"]};database={Configuration.GetSection("AudioMySqlServer")["Database"]};charset=utf8;convert zero datetime=True"
|
||||
@ -1212,6 +1213,10 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MusicCatalogueService catalogueService = new MusicCatalogueService(Configuration);
|
||||
await catalogueService.ImportFromMySql(jobProgressServiceEF, job);
|
||||
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 100, "Finished", true);
|
||||
}
|
||||
catch(Exception jobExp)
|
||||
|
||||
236
RMuseum/Services/Implementation/MusicCatalogueService.cs
Normal file
236
RMuseum/Services/Implementation/MusicCatalogueService.cs
Normal file
@ -0,0 +1,236 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MySql.Data.MySqlClient;
|
||||
using RMuseum.DbContext;
|
||||
using RMuseum.Models.MusicCatalogue;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using RSecurityBackend.Models.Generic.Db;
|
||||
using RSecurityBackend.Services.Implementation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RMuseum.Services.Implementation
|
||||
{
|
||||
/// <summary>
|
||||
/// Music Catalgue Service Implementation
|
||||
/// </summary>
|
||||
public class MusicCatalogueService
|
||||
{
|
||||
/// <summary>
|
||||
/// import catalogue from ganjoor.net MySql db
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> ImportFromMySql(LongRunningJobProgressServiceEF jobProgressServiceEF, RLongRunningJobStatus job)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
using (RMuseumDbContext context = new RMuseumDbContext(Configuration)) //this is long running job, so _context might be already been freed/collected by GC
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection
|
||||
(
|
||||
$"server={Configuration.GetSection("AudioMySqlServer")["Server"]};uid={Configuration.GetSection("AudioMySqlServer")["SongsUsername"]};pwd={Configuration.GetSection("AudioMySqlServer")["SongsPassword"]};database={Configuration.GetSection("AudioMySqlServer")["SongsDatabase"]};charset=utf8;convert zero datetime=True"
|
||||
))
|
||||
{
|
||||
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, "phase 4 - import golha data - pre open connection")).Result;
|
||||
|
||||
connection.Open();
|
||||
|
||||
using (MySqlDataAdapter src = new MySqlDataAdapter(
|
||||
"SELECT col_id, name FROM golha_collections ORDER BY col_id",
|
||||
connection))
|
||||
{
|
||||
using (DataTable data = new DataTable())
|
||||
{
|
||||
await src.FillAsync(data);
|
||||
|
||||
foreach (DataRow row in data.Rows)
|
||||
{
|
||||
|
||||
|
||||
GolhaCollection collection = new GolhaCollection()
|
||||
{
|
||||
Id = int.Parse(row["col_id"].ToString()),
|
||||
Name = row["name"].ToString(),
|
||||
Programs = new List<GolhaProgram>()
|
||||
};
|
||||
|
||||
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, $"phase 4 - import golha data - golha_collections: {collection.Id}")).Result;
|
||||
|
||||
|
||||
using (MySqlDataAdapter srcPrograms = new MySqlDataAdapter(
|
||||
$"SELECT program_id, title, progarm_order, url, mp3 FROM golha_programs WHERE col_id = {collection.Id} ORDER BY program_id",
|
||||
connection))
|
||||
{
|
||||
using (DataTable programData = new DataTable())
|
||||
{
|
||||
await srcPrograms.FillAsync(programData);
|
||||
|
||||
|
||||
foreach (DataRow golhaProgram in programData.Rows)
|
||||
{
|
||||
GolhaProgram program = new GolhaProgram()
|
||||
{
|
||||
Id = int.Parse(golhaProgram["program_id"].ToString()),
|
||||
Title = golhaProgram["title"].ToString(),
|
||||
ProgramOrder = int.Parse(golhaProgram["progarm_order"].ToString()),
|
||||
Url = golhaProgram["url"].ToString(),
|
||||
Mp3 = golhaProgram["mp3"].ToString(),
|
||||
Tracks = new List<GolhaTrack>()
|
||||
};
|
||||
|
||||
using (MySqlDataAdapter srcTracks = new MySqlDataAdapter(
|
||||
$"SELECT track_no, timing, title FROM golha_tracks WHERE program_id = {program.Id} ORDER BY track_no",
|
||||
connection))
|
||||
{
|
||||
using (DataTable trackData = new DataTable())
|
||||
{
|
||||
await srcTracks.FillAsync(trackData);
|
||||
|
||||
foreach (DataRow golhaTrack in trackData.Rows)
|
||||
{
|
||||
program.Tracks.Add
|
||||
(
|
||||
new GolhaTrack()
|
||||
{
|
||||
TrackNo = int.Parse(golhaTrack["track_no"].ToString()),
|
||||
Timing = golhaTrack["timing"].ToString(),
|
||||
Title = golhaTrack["title"].ToString(),
|
||||
Blocked = false,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
collection.Programs.Add(program);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
context.GolhaCollections.Add(collection);
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, "phase 4 - import singers data")).Result;
|
||||
|
||||
using (MySqlDataAdapter src = new MySqlDataAdapter(
|
||||
"SELECT artist_id, artist_name, artist_beeptunesurl FROM ganja_artists ORDER BY artist_id",
|
||||
connection))
|
||||
{
|
||||
using (DataTable data = new DataTable())
|
||||
{
|
||||
await src.FillAsync(data);
|
||||
|
||||
foreach (DataRow row in data.Rows)
|
||||
{
|
||||
int artistId = int.Parse(row["artist_id"].ToString());
|
||||
|
||||
GanjoorSinger singer = new GanjoorSinger()
|
||||
{
|
||||
Name = row["artist_name"].ToString(),
|
||||
Url = row["artist_beeptunesurl"].ToString(),
|
||||
Albums = new List<GanjoorAlbum>()
|
||||
};
|
||||
|
||||
using (MySqlDataAdapter srcAlbums = new MySqlDataAdapter(
|
||||
$"SELECT album_id, album_name, album_beeptunesurl FROM ganja_albums WHERE album_artistid = {artistId} ORDER BY album_id",
|
||||
connection))
|
||||
{
|
||||
using (DataTable dataAlbums = new DataTable())
|
||||
{
|
||||
await srcAlbums.FillAsync(dataAlbums);
|
||||
|
||||
foreach (DataRow rowAlbum in dataAlbums.Rows)
|
||||
{
|
||||
|
||||
int albumId = int.Parse(rowAlbum["album_id"].ToString());
|
||||
|
||||
GanjoorAlbum album = new GanjoorAlbum()
|
||||
{
|
||||
Name = rowAlbum["album_name"].ToString(),
|
||||
Url = rowAlbum["album_beeptunesurl"].ToString(),
|
||||
Tracks = new List<GanjoorTrack>()
|
||||
};
|
||||
|
||||
using (MySqlDataAdapter srcTracks = new MySqlDataAdapter(
|
||||
$"SELECT track_name, track_beeptunesurl FROM ganja_tracks WHERE album_id = {albumId} ORDER BY track_id",
|
||||
connection))
|
||||
{
|
||||
using (DataTable dataTracks = new DataTable())
|
||||
{
|
||||
await srcTracks.FillAsync(dataTracks);
|
||||
|
||||
foreach (DataRow rowTrack in dataTracks.Rows)
|
||||
{
|
||||
album.Tracks.Add
|
||||
(
|
||||
new GanjoorTrack()
|
||||
{
|
||||
Name = rowTrack["track_name"].ToString(),
|
||||
Url = rowTrack["track_beeptunesurl"].ToString(),
|
||||
Blocked = false
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
singer.Albums.Add(album);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
context.Singers.Add(singer);
|
||||
|
||||
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, $"phase 4 - import singers data - {singer.Name}")).Result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, "phase 4 - finalizing singers data")).Result;
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
return new RServiceResult<bool>(true);
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, job.Progress, "", false, exp.ToString());
|
||||
|
||||
return new RServiceResult<bool>(false, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration
|
||||
/// </summary>
|
||||
protected IConfiguration Configuration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
public MusicCatalogueService(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -40,7 +40,10 @@
|
||||
"Database": "adab",
|
||||
"2ndDatabase": "audio",
|
||||
"2ndUsername": "audio",
|
||||
"2ndPassword": ""
|
||||
"2ndPassword": "",
|
||||
"SongsDatabase": "golha",
|
||||
"SongsUsername": "root",
|
||||
"SongsPassword": ""
|
||||
},
|
||||
"AudioSFPServer": {
|
||||
"Host": "localhost",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user