Torrent stuff

This commit is contained in:
Elias Jansson
2025-08-19 15:56:52 +02:00
parent 846a42f9e7
commit a97f31e405
19 changed files with 4736 additions and 235 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,105 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Aberwyn.Migrations
{
public partial class AddTorrentTables : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DownloadRules",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
KeywordFilter = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CategoryFilter = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
MinSeeders = table.Column<int>(type: "int", nullable: false),
MaxSize = table.Column<long>(type: "bigint", nullable: false),
AutoDownload = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DownloadRules", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "RssFeeds",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Url = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
LastChecked = table.Column<DateTime>(type: "datetime(6)", nullable: false),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RssFeeds", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "TorrentItems",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Title = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
MagnetLink = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
InfoHash = table.Column<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
PublishDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Size = table.Column<long>(type: "bigint", nullable: false),
Seeders = table.Column<int>(type: "int", nullable: false),
Leechers = table.Column<int>(type: "int", nullable: false),
Status = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Category = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
RssSource = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
TorrentUrl = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_TorrentItems", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_TorrentItems_InfoHash",
table: "TorrentItems",
column: "InfoHash",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DownloadRules");
migrationBuilder.DropTable(
name: "RssFeeds");
migrationBuilder.DropTable(
name: "TorrentItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,69 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Aberwyn.Migrations
{
public partial class AddTorrentTablesv2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Completed",
table: "TorrentItems",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "DownloadKey",
table: "TorrentItems",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "MovieName",
table: "TorrentItems",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Token",
table: "TorrentItems",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "Year",
table: "TorrentItems",
type: "int",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Completed",
table: "TorrentItems");
migrationBuilder.DropColumn(
name: "DownloadKey",
table: "TorrentItems");
migrationBuilder.DropColumn(
name: "MovieName",
table: "TorrentItems");
migrationBuilder.DropColumn(
name: "Token",
table: "TorrentItems");
migrationBuilder.DropColumn(
name: "Year",
table: "TorrentItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,211 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Aberwyn.Migrations
{
public partial class MakeTorrentFieldsNullable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "TorrentUrl",
table: "TorrentItems",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Token",
table: "TorrentItems",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MovieName",
table: "TorrentItems",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MagnetLink",
table: "TorrentItems",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "InfoHash",
table: "TorrentItems",
type: "varchar(255)",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "DownloadKey",
table: "TorrentItems",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Category",
table: "TorrentItems",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "TorrentItems",
keyColumn: "TorrentUrl",
keyValue: null,
column: "TorrentUrl",
value: "");
migrationBuilder.AlterColumn<string>(
name: "TorrentUrl",
table: "TorrentItems",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "TorrentItems",
keyColumn: "Token",
keyValue: null,
column: "Token",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Token",
table: "TorrentItems",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "TorrentItems",
keyColumn: "MovieName",
keyValue: null,
column: "MovieName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MovieName",
table: "TorrentItems",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "TorrentItems",
keyColumn: "MagnetLink",
keyValue: null,
column: "MagnetLink",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MagnetLink",
table: "TorrentItems",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "TorrentItems",
keyColumn: "InfoHash",
keyValue: null,
column: "InfoHash",
value: "");
migrationBuilder.AlterColumn<string>(
name: "InfoHash",
table: "TorrentItems",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "TorrentItems",
keyColumn: "DownloadKey",
keyValue: null,
column: "DownloadKey",
value: "");
migrationBuilder.AlterColumn<string>(
name: "DownloadKey",
table: "TorrentItems",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "TorrentItems",
keyColumn: "Category",
keyValue: null,
column: "Category",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Category",
table: "TorrentItems",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View File

@@ -697,6 +697,34 @@ namespace Aberwyn.Migrations
b.ToTable("WeeklyMenu", (string)null);
});
modelBuilder.Entity("DownloadRule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<bool>("AutoDownload")
.HasColumnType("tinyint(1)");
b.Property<string>("CategoryFilter")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("KeywordFilter")
.IsRequired()
.HasColumnType("longtext");
b.Property<long>("MaxSize")
.HasColumnType("bigint");
b.Property<int>("MinSeeders")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("DownloadRules");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
@@ -825,6 +853,103 @@ namespace Aberwyn.Migrations
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("RssFeed", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<DateTime>("LastChecked")
.HasColumnType("datetime(6)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("RssFeeds");
});
modelBuilder.Entity("TorrentItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("Category")
.HasColumnType("longtext");
b.Property<int>("Completed")
.HasColumnType("int");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("DownloadKey")
.HasColumnType("longtext");
b.Property<string>("InfoHash")
.HasColumnType("varchar(255)");
b.Property<int>("Leechers")
.HasColumnType("int");
b.Property<string>("MagnetLink")
.HasColumnType("longtext");
b.Property<string>("MovieName")
.HasColumnType("longtext");
b.Property<DateTime>("PublishDate")
.HasColumnType("datetime(6)");
b.Property<string>("RssSource")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Seeders")
.HasColumnType("int");
b.Property<long>("Size")
.HasColumnType("bigint");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Token")
.HasColumnType("longtext");
b.Property<string>("TorrentUrl")
.HasColumnType("longtext");
b.Property<int?>("Year")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("InfoHash")
.IsUnique();
b.ToTable("TorrentItems");
});
modelBuilder.Entity("Aberwyn.Models.BudgetCategory", b =>
{
b.HasOne("Aberwyn.Models.BudgetCategoryDefinition", "Definition")