Add model mapping

This commit is contained in:
Jamie Brunton committed 2023-02-13 21:14:16 +00:00
1 parent 9f1905f5e0
commit 1186ebf755
29 files changed
+997 -831

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Convertarr.Web/bin/Debug/net7.0/Convertarr.Web.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Convertarr.Web",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"name": "Docker .NET Core Launch",
"type": "docker",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"netCore": {
"appProject": "${workspaceFolder}/src/Convertarr.Web/Convertarr.Web.csproj"
}
}
]
}
+110
View File
@@ -0,0 +1,110 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/Convertarr.Web/Convertarr.Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/Convertarr.Web/Convertarr.Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/src/Convertarr.Web/Convertarr.Web.csproj"
],
"problemMatcher": "$msCompile"
},
{
"type": "docker-build",
"label": "docker-build: debug",
"dependsOn": [
"build"
],
"dockerBuild": {
"tag": "convertarr:dev",
"target": "base",
"dockerfile": "${workspaceFolder}/src/Convertarr.Web/Dockerfile",
"context": "${workspaceFolder}",
"pull": true
},
"netCore": {
"appProject": "${workspaceFolder}/src/Convertarr.Web/Convertarr.Web.csproj"
}
},
{
"type": "docker-build",
"label": "docker-build: release",
"dependsOn": [
"build"
],
"dockerBuild": {
"tag": "convertarr:latest",
"dockerfile": "${workspaceFolder}/src/Convertarr.Web/Dockerfile",
"context": "${workspaceFolder}",
"pull": true
},
"netCore": {
"appProject": "${workspaceFolder}/src/Convertarr.Web/Convertarr.Web.csproj"
}
},
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": [
"docker-build: debug"
],
"dockerRun": {
"volumes": [
{
"containerPath": "/media",
"localPath": "/Users/jamiebrunton/Movies",
"permissions": "rw"
},
{
"containerPath": "/config",
"localPath": "/Users/jamiebrunton/Documents/Projects/ConvertarrConfig",
"permissions": "rw"
}
]
},
"netCore": {
"appProject": "${workspaceFolder}/src/Convertarr.Web/Convertarr.Web.csproj",
"enableDebugging": true
}
},
{
"type": "docker-run",
"label": "docker-run: release",
"dependsOn": [
"docker-build: release"
],
"dockerRun": {},
"netCore": {
"appProject": "${workspaceFolder}/src/Convertarr.Web/Convertarr.Web.csproj"
}
}
]
}
@@ -8,6 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="Hangfire.Core" Version="1.7.32" /> <PackageReference Include="Hangfire.Core" Version="1.7.32" />
<PackageReference Include="Xabe.FFmpeg" Version="5.2.5" /> <PackageReference Include="Xabe.FFmpeg" Version="5.2.5" />
<PackageReference Include="Xabe.FFmpeg.Downloader" Version="5.2.5" /> <PackageReference Include="Xabe.FFmpeg.Downloader" Version="5.2.5" />
@@ -0,0 +1,12 @@
using AutoMapper;
namespace Convertarr.Core.Converters
{
public class NullStringConverter : ITypeConverter<string, string>
{
public string Convert(string source, string destination, ResolutionContext context)
{
return source ?? string.Empty;
}
}
}
+15 -1
View File
@@ -5,6 +5,8 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper;
using Convertarr.Core.Converters;
using Convertarr.Data; using Convertarr.Data;
using Convertarr.Data.Models; using Convertarr.Data.Models;
using Hangfire; using Hangfire;
@@ -40,12 +42,24 @@ namespace Convertarr.Core
{ {
return; return;
} }
var config = new MapperConfiguration(cfg =>
{
cfg.CreateMap<string, string>().ConvertUsing<NullStringConverter>();
cfg.CreateMap<IVideoStream, Data.Models.VideoStream>();
cfg.CreateMap<IAudioStream, Data.Models.AudioStream>();
cfg.CreateMap<ISubtitleStream, Data.Models.SubtitleStream>();
}
);
var mapper = new Mapper(config);
Debug.WriteLine($"Starting analysis for {dbFile.FilePath}"); Debug.WriteLine($"Starting analysis for {dbFile.FilePath}");
var fileInfo = await FFmpeg.GetMediaInfo(dbFile.FilePath); var fileInfo = await FFmpeg.GetMediaInfo(dbFile.FilePath);
dbFile.MediaInfo = new Convertarr.Data.Models.MediaInfo dbFile.MediaInfo = new Convertarr.Data.Models.MediaInfo
{ {
Codec = fileInfo.VideoStreams.First().Codec Duration = fileInfo.Duration,
VideoStreams = fileInfo.VideoStreams.Select(x => mapper.Map<Data.Models.VideoStream>(x)),
AudioStreams = fileInfo.AudioStreams.Select(x => mapper.Map<Data.Models.AudioStream>(x)),
SubtitleStreams = fileInfo.SubtitleStreams.Select(x => mapper.Map<Data.Models.SubtitleStream>(x))
}; };
this._context.Update(dbFile); this._context.Update(dbFile);
@@ -1,39 +0,0 @@
// <auto-generated />
using Convertarr.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Convertarr.Data.Migrations
{
[DbContext(typeof(ConvertarrContext))]
[Migration("20230210230745_MyFirstMigration")]
partial class MyFirstMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("Convertarr.Data.Models.MediaFile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("FilePath")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Files");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,34 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Convertarr.Data.Migrations
{
/// <inheritdoc />
public partial class MyFirstMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Files",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
FilePath = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Files", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Files");
}
}
}
@@ -1,66 +0,0 @@
// <auto-generated />
using Convertarr.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Convertarr.Data.Migrations
{
[DbContext(typeof(ConvertarrContext))]
[Migration("20230211164210_MediaAnalysis")]
partial class MediaAnalysis
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.Property<int>("MediaFileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("FilePath")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("MediaInfoId")
.HasColumnType("INTEGER");
b.HasKey("MediaFileId");
b.HasIndex("MediaInfoId");
b.ToTable("Files");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Property<int>("MediaInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.HasKey("MediaInfoId");
b.ToTable("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", "MediaInfo")
.WithMany()
.HasForeignKey("MediaInfoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MediaInfo");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,112 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Convertarr.Data.Migrations
{
/// <inheritdoc />
public partial class MediaAnalysis : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Files",
table: "Files");
migrationBuilder.RenameColumn(
name: "Id",
table: "Files",
newName: "MediaInfoId");
migrationBuilder.AlterColumn<int>(
name: "MediaInfoId",
table: "Files",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER")
.OldAnnotation("Sqlite:Autoincrement", true);
migrationBuilder.AddColumn<int>(
name: "MediaFileId",
table: "Files",
type: "INTEGER",
nullable: false,
defaultValue: 0)
.Annotation("Sqlite:Autoincrement", true);
migrationBuilder.AddPrimaryKey(
name: "PK_Files",
table: "Files",
column: "MediaFileId");
migrationBuilder.CreateTable(
name: "MediaInfo",
columns: table => new
{
MediaInfoId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true)
},
constraints: table =>
{
table.PrimaryKey("PK_MediaInfo", x => x.MediaInfoId);
});
migrationBuilder.CreateIndex(
name: "IX_Files_MediaInfoId",
table: "Files",
column: "MediaInfoId");
migrationBuilder.AddForeignKey(
name: "FK_Files_MediaInfo_MediaInfoId",
table: "Files",
column: "MediaInfoId",
principalTable: "MediaInfo",
principalColumn: "MediaInfoId",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Files_MediaInfo_MediaInfoId",
table: "Files");
migrationBuilder.DropTable(
name: "MediaInfo");
migrationBuilder.DropPrimaryKey(
name: "PK_Files",
table: "Files");
migrationBuilder.DropIndex(
name: "IX_Files_MediaInfoId",
table: "Files");
migrationBuilder.DropColumn(
name: "MediaFileId",
table: "Files");
migrationBuilder.RenameColumn(
name: "MediaInfoId",
table: "Files",
newName: "Id");
migrationBuilder.AlterColumn<int>(
name: "Id",
table: "Files",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER")
.Annotation("Sqlite:Autoincrement", true);
migrationBuilder.AddPrimaryKey(
name: "PK_Files",
table: "Files",
column: "Id");
}
}
}
@@ -1,70 +0,0 @@
// <auto-generated />
using Convertarr.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Convertarr.Data.Migrations
{
[DbContext(typeof(ConvertarrContext))]
[Migration("20230211172658_Codec")]
partial class Codec
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.Property<int>("MediaFileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("FilePath")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("MediaInfoId")
.HasColumnType("INTEGER");
b.HasKey("MediaFileId");
b.HasIndex("MediaInfoId");
b.ToTable("Files");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Property<int>("MediaInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MediaInfoId");
b.ToTable("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", "MediaInfo")
.WithMany()
.HasForeignKey("MediaInfoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MediaInfo");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,29 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Convertarr.Data.Migrations
{
/// <inheritdoc />
public partial class Codec : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Codec",
table: "MediaInfo",
type: "TEXT",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Codec",
table: "MediaInfo");
}
}
}
@@ -1,69 +0,0 @@
// <auto-generated />
using System;
using Convertarr.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Convertarr.Data.Migrations
{
[DbContext(typeof(ConvertarrContext))]
[Migration("20230211173316_CodecConstraint")]
partial class CodecConstraint
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.Property<int>("MediaFileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("FilePath")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.HasKey("MediaFileId");
b.HasIndex("MediaInfoId");
b.ToTable("Files");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Property<int>("MediaInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MediaInfoId");
b.ToTable("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", "MediaInfo")
.WithMany()
.HasForeignKey("MediaInfoId");
b.Navigation("MediaInfo");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Convertarr.Data.Migrations
{
/// <inheritdoc />
public partial class CodecConstraint : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Files_MediaInfo_MediaInfoId",
table: "Files");
migrationBuilder.AlterColumn<int>(
name: "MediaInfoId",
table: "Files",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AddForeignKey(
name: "FK_Files_MediaInfo_MediaInfoId",
table: "Files",
column: "MediaInfoId",
principalTable: "MediaInfo",
principalColumn: "MediaInfoId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Files_MediaInfo_MediaInfoId",
table: "Files");
migrationBuilder.AlterColumn<int>(
name: "MediaInfoId",
table: "Files",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Files_MediaInfo_MediaInfoId",
table: "Files",
column: "MediaInfoId",
principalTable: "MediaInfo",
principalColumn: "MediaInfoId",
onDelete: ReferentialAction.Cascade);
}
}
}
@@ -1,76 +0,0 @@
// <auto-generated />
using System;
using Convertarr.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Convertarr.Data.Migrations
{
[DbContext(typeof(ConvertarrContext))]
[Migration("20230211181606_FileHash")]
partial class FileHash
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.Property<int>("MediaFileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("FileHash")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FilePath")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("LastScanned")
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.HasKey("MediaFileId");
b.HasIndex("MediaInfoId");
b.ToTable("Files");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Property<int>("MediaInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MediaInfoId");
b.ToTable("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", "MediaInfo")
.WithMany()
.HasForeignKey("MediaInfoId");
b.Navigation("MediaInfo");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,41 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Convertarr.Data.Migrations
{
/// <inheritdoc />
public partial class FileHash : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "FileHash",
table: "Files",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<DateTime>(
name: "LastScanned",
table: "Files",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FileHash",
table: "Files");
migrationBuilder.DropColumn(
name: "LastScanned",
table: "Files");
}
}
}
@@ -1,79 +0,0 @@
// <auto-generated />
using System;
using Convertarr.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Convertarr.Data.Migrations
{
[DbContext(typeof(ConvertarrContext))]
[Migration("20230211182032_Attributes")]
partial class Attributes
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.Property<int>("MediaFileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("FilePath")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("FileSize")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("LastScanned")
.HasColumnType("TEXT");
b.Property<DateTime>("LastWrite")
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.HasKey("MediaFileId");
b.HasIndex("MediaInfoId");
b.ToTable("Files");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Property<int>("MediaInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MediaInfoId");
b.ToTable("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", "MediaInfo")
.WithMany()
.HasForeignKey("MediaInfoId");
b.Navigation("MediaInfo");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,39 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Convertarr.Data.Migrations
{
/// <inheritdoc />
public partial class Attributes : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "FileHash",
table: "Files",
newName: "LastWrite");
migrationBuilder.AddColumn<string>(
name: "FileSize",
table: "Files",
type: "TEXT",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FileSize",
table: "Files");
migrationBuilder.RenameColumn(
name: "LastWrite",
table: "Files",
newName: "FileHash");
}
}
}
@@ -1,78 +0,0 @@
// <auto-generated />
using System;
using Convertarr.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Convertarr.Data.Migrations
{
[DbContext(typeof(ConvertarrContext))]
[Migration("20230211182140_AttributesWithLength")]
partial class AttributesWithLength
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.Property<int>("MediaFileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("FilePath")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("FileSize")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastScanned")
.HasColumnType("TEXT");
b.Property<DateTime>("LastWrite")
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.HasKey("MediaFileId");
b.HasIndex("MediaInfoId");
b.ToTable("Files");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Property<int>("MediaInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MediaInfoId");
b.ToTable("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", "MediaInfo")
.WithMany()
.HasForeignKey("MediaInfoId");
b.Navigation("MediaInfo");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,34 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Convertarr.Data.Migrations
{
/// <inheritdoc />
public partial class AttributesWithLength : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<long>(
name: "FileSize",
table: "Files",
type: "INTEGER",
nullable: false,
oldClrType: typeof(string),
oldType: "TEXT");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "FileSize",
table: "Files",
type: "TEXT",
nullable: false,
oldClrType: typeof(long),
oldType: "INTEGER");
}
}
}
@@ -0,0 +1,269 @@
// <auto-generated />
using System;
using Convertarr.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Convertarr.Data.Migrations
{
[DbContext(typeof(ConvertarrContext))]
[Migration("20230213211154_Initial")]
partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.Property<int>("MediaFileId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("FilePath")
.IsRequired()
.HasColumnType("TEXT");
b.Property<long>("FileSize")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastScanned")
.HasColumnType("TEXT");
b.Property<DateTime>("LastWrite")
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.HasKey("MediaFileId");
b.HasIndex("MediaInfoId");
b.ToTable("Files");
});
modelBuilder.Entity("Convertarr.Data.Models.AudioStream", b =>
{
b.Property<int>("AudioStreamId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("Bitrate")
.HasColumnType("INTEGER");
b.Property<int>("Channels")
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Default")
.HasColumnType("INTEGER");
b.Property<TimeSpan>("Duration")
.HasColumnType("TEXT");
b.Property<int?>("Forced")
.HasColumnType("INTEGER");
b.Property<int>("Index")
.HasColumnType("INTEGER");
b.Property<string>("Language")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.Property<int>("MediaStreamType")
.HasColumnType("INTEGER");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("SampleRate")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("AudioStreamId");
b.HasIndex("MediaInfoId");
b.ToTable("AudioStream");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Property<int>("MediaInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<TimeSpan>("Duration")
.HasColumnType("TEXT");
b.HasKey("MediaInfoId");
b.ToTable("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.Models.SubtitleStream", b =>
{
b.Property<int>("SubtitleStreamId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Default")
.HasColumnType("INTEGER");
b.Property<int?>("Forced")
.HasColumnType("INTEGER");
b.Property<int>("Index")
.HasColumnType("INTEGER");
b.Property<string>("Language")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.Property<int>("MediaStreamType")
.HasColumnType("INTEGER");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("SubtitleStreamId");
b.HasIndex("MediaInfoId");
b.ToTable("SubtitleStream");
});
modelBuilder.Entity("Convertarr.Data.Models.VideoStream", b =>
{
b.Property<int>("VideoStreamId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("Bitrate")
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Default")
.HasColumnType("INTEGER");
b.Property<TimeSpan>("Duration")
.HasColumnType("TEXT");
b.Property<int?>("Forced")
.HasColumnType("INTEGER");
b.Property<double>("Framerate")
.HasColumnType("REAL");
b.Property<int>("Height")
.HasColumnType("INTEGER");
b.Property<int>("Index")
.HasColumnType("INTEGER");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.Property<int>("MediaStreamType")
.HasColumnType("INTEGER");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PixelFormat")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Ratio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Rotation")
.HasColumnType("INTEGER");
b.Property<int>("Width")
.HasColumnType("INTEGER");
b.HasKey("VideoStreamId");
b.HasIndex("MediaInfoId");
b.ToTable("VideoStream");
});
modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", "MediaInfo")
.WithMany()
.HasForeignKey("MediaInfoId");
b.Navigation("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.Models.AudioStream", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", null)
.WithMany("AudioStreams")
.HasForeignKey("MediaInfoId");
});
modelBuilder.Entity("Convertarr.Data.Models.SubtitleStream", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", null)
.WithMany("SubtitleStreams")
.HasForeignKey("MediaInfoId");
});
modelBuilder.Entity("Convertarr.Data.Models.VideoStream", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", null)
.WithMany("VideoStreams")
.HasForeignKey("MediaInfoId");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Navigation("AudioStreams");
b.Navigation("SubtitleStreams");
b.Navigation("VideoStreams");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,177 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Convertarr.Data.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "MediaInfo",
columns: table => new
{
MediaInfoId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Duration = table.Column<TimeSpan>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MediaInfo", x => x.MediaInfoId);
});
migrationBuilder.CreateTable(
name: "AudioStream",
columns: table => new
{
AudioStreamId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Forced = table.Column<int>(type: "INTEGER", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: false),
Language = table.Column<string>(type: "TEXT", nullable: false),
Channels = table.Column<int>(type: "INTEGER", nullable: false),
SampleRate = table.Column<int>(type: "INTEGER", nullable: false),
Bitrate = table.Column<long>(type: "INTEGER", nullable: false),
Duration = table.Column<TimeSpan>(type: "TEXT", nullable: false),
Default = table.Column<int>(type: "INTEGER", nullable: true),
MediaInfoId = table.Column<int>(type: "INTEGER", nullable: true),
Path = table.Column<string>(type: "TEXT", nullable: false),
Index = table.Column<int>(type: "INTEGER", nullable: false),
Codec = table.Column<string>(type: "TEXT", nullable: false),
MediaStreamType = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AudioStream", x => x.AudioStreamId);
table.ForeignKey(
name: "FK_AudioStream_MediaInfo_MediaInfoId",
column: x => x.MediaInfoId,
principalTable: "MediaInfo",
principalColumn: "MediaInfoId");
});
migrationBuilder.CreateTable(
name: "Files",
columns: table => new
{
MediaFileId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
FilePath = table.Column<string>(type: "TEXT", nullable: false),
FileSize = table.Column<long>(type: "INTEGER", nullable: false),
LastWrite = table.Column<DateTime>(type: "TEXT", nullable: false),
MediaInfoId = table.Column<int>(type: "INTEGER", nullable: true),
LastScanned = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Files", x => x.MediaFileId);
table.ForeignKey(
name: "FK_Files_MediaInfo_MediaInfoId",
column: x => x.MediaInfoId,
principalTable: "MediaInfo",
principalColumn: "MediaInfoId");
});
migrationBuilder.CreateTable(
name: "SubtitleStream",
columns: table => new
{
SubtitleStreamId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Language = table.Column<string>(type: "TEXT", nullable: false),
Default = table.Column<int>(type: "INTEGER", nullable: true),
Forced = table.Column<int>(type: "INTEGER", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: false),
MediaInfoId = table.Column<int>(type: "INTEGER", nullable: true),
Path = table.Column<string>(type: "TEXT", nullable: false),
Index = table.Column<int>(type: "INTEGER", nullable: false),
Codec = table.Column<string>(type: "TEXT", nullable: false),
MediaStreamType = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SubtitleStream", x => x.SubtitleStreamId);
table.ForeignKey(
name: "FK_SubtitleStream_MediaInfo_MediaInfoId",
column: x => x.MediaInfoId,
principalTable: "MediaInfo",
principalColumn: "MediaInfoId");
});
migrationBuilder.CreateTable(
name: "VideoStream",
columns: table => new
{
VideoStreamId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Rotation = table.Column<int>(type: "INTEGER", nullable: true),
Forced = table.Column<int>(type: "INTEGER", nullable: true),
Default = table.Column<int>(type: "INTEGER", nullable: true),
Bitrate = table.Column<long>(type: "INTEGER", nullable: false),
Ratio = table.Column<string>(type: "TEXT", nullable: false),
Framerate = table.Column<double>(type: "REAL", nullable: false),
Height = table.Column<int>(type: "INTEGER", nullable: false),
Width = table.Column<int>(type: "INTEGER", nullable: false),
Duration = table.Column<TimeSpan>(type: "TEXT", nullable: false),
PixelFormat = table.Column<string>(type: "TEXT", nullable: false),
MediaInfoId = table.Column<int>(type: "INTEGER", nullable: true),
Path = table.Column<string>(type: "TEXT", nullable: false),
Index = table.Column<int>(type: "INTEGER", nullable: false),
Codec = table.Column<string>(type: "TEXT", nullable: false),
MediaStreamType = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VideoStream", x => x.VideoStreamId);
table.ForeignKey(
name: "FK_VideoStream_MediaInfo_MediaInfoId",
column: x => x.MediaInfoId,
principalTable: "MediaInfo",
principalColumn: "MediaInfoId");
});
migrationBuilder.CreateIndex(
name: "IX_AudioStream_MediaInfoId",
table: "AudioStream",
column: "MediaInfoId");
migrationBuilder.CreateIndex(
name: "IX_Files_MediaInfoId",
table: "Files",
column: "MediaInfoId");
migrationBuilder.CreateIndex(
name: "IX_SubtitleStream_MediaInfoId",
table: "SubtitleStream",
column: "MediaInfoId");
migrationBuilder.CreateIndex(
name: "IX_VideoStream_MediaInfoId",
table: "VideoStream",
column: "MediaInfoId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AudioStream");
migrationBuilder.DropTable(
name: "Files");
migrationBuilder.DropTable(
name: "SubtitleStream");
migrationBuilder.DropTable(
name: "VideoStream");
migrationBuilder.DropTable(
name: "MediaInfo");
}
}
}
@@ -46,19 +46,180 @@ namespace Convertarr.Data.Migrations
b.ToTable("Files"); b.ToTable("Files");
}); });
modelBuilder.Entity("Convertarr.Data.Models.AudioStream", b =>
{
b.Property<int>("AudioStreamId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("Bitrate")
.HasColumnType("INTEGER");
b.Property<int>("Channels")
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Default")
.HasColumnType("INTEGER");
b.Property<TimeSpan>("Duration")
.HasColumnType("TEXT");
b.Property<int?>("Forced")
.HasColumnType("INTEGER");
b.Property<int>("Index")
.HasColumnType("INTEGER");
b.Property<string>("Language")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.Property<int>("MediaStreamType")
.HasColumnType("INTEGER");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("SampleRate")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("AudioStreamId");
b.HasIndex("MediaInfoId");
b.ToTable("AudioStream");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b => modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{ {
b.Property<int>("MediaInfoId") b.Property<int>("MediaInfoId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<TimeSpan>("Duration")
.HasColumnType("TEXT");
b.HasKey("MediaInfoId");
b.ToTable("MediaInfo");
});
modelBuilder.Entity("Convertarr.Data.Models.SubtitleStream", b =>
{
b.Property<int>("SubtitleStreamId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Codec") b.Property<string>("Codec")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.HasKey("MediaInfoId"); b.Property<int?>("Default")
.HasColumnType("INTEGER");
b.ToTable("MediaInfo"); b.Property<int?>("Forced")
.HasColumnType("INTEGER");
b.Property<int>("Index")
.HasColumnType("INTEGER");
b.Property<string>("Language")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.Property<int>("MediaStreamType")
.HasColumnType("INTEGER");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("SubtitleStreamId");
b.HasIndex("MediaInfoId");
b.ToTable("SubtitleStream");
});
modelBuilder.Entity("Convertarr.Data.Models.VideoStream", b =>
{
b.Property<int>("VideoStreamId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("Bitrate")
.HasColumnType("INTEGER");
b.Property<string>("Codec")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Default")
.HasColumnType("INTEGER");
b.Property<TimeSpan>("Duration")
.HasColumnType("TEXT");
b.Property<int?>("Forced")
.HasColumnType("INTEGER");
b.Property<double>("Framerate")
.HasColumnType("REAL");
b.Property<int>("Height")
.HasColumnType("INTEGER");
b.Property<int>("Index")
.HasColumnType("INTEGER");
b.Property<int?>("MediaInfoId")
.HasColumnType("INTEGER");
b.Property<int>("MediaStreamType")
.HasColumnType("INTEGER");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PixelFormat")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Ratio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Rotation")
.HasColumnType("INTEGER");
b.Property<int>("Width")
.HasColumnType("INTEGER");
b.HasKey("VideoStreamId");
b.HasIndex("MediaInfoId");
b.ToTable("VideoStream");
}); });
modelBuilder.Entity("Convertarr.Data.MediaFile", b => modelBuilder.Entity("Convertarr.Data.MediaFile", b =>
@@ -69,6 +230,36 @@ namespace Convertarr.Data.Migrations
b.Navigation("MediaInfo"); b.Navigation("MediaInfo");
}); });
modelBuilder.Entity("Convertarr.Data.Models.AudioStream", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", null)
.WithMany("AudioStreams")
.HasForeignKey("MediaInfoId");
});
modelBuilder.Entity("Convertarr.Data.Models.SubtitleStream", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", null)
.WithMany("SubtitleStreams")
.HasForeignKey("MediaInfoId");
});
modelBuilder.Entity("Convertarr.Data.Models.VideoStream", b =>
{
b.HasOne("Convertarr.Data.Models.MediaInfo", null)
.WithMany("VideoStreams")
.HasForeignKey("MediaInfoId");
});
modelBuilder.Entity("Convertarr.Data.Models.MediaInfo", b =>
{
b.Navigation("AudioStreams");
b.Navigation("SubtitleStreams");
b.Navigation("VideoStreams");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }
+45
View File
@@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Convertarr.Data.Models
{
public class AudioStream : MediaStream
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int AudioStreamId { get; set; }
//
// Summary:
// Forced
public int? Forced { get; set; }
//
// Summary:
// Title
public required string Title { get; set; }
//
// Summary:
// Language
public required string Language { get; set; }
//
// Summary:
// Channels
public int Channels { get; set; }
//
// Summary:
// Sample Rate
public int SampleRate { get; set; }
//
// Summary:
// Bitrate
public long Bitrate { get; set; }
//
// Summary:
// Duration
public TimeSpan Duration { get; set; }
//
// Summary:
// Default
public int? Default { get; set; }
}
}
+9 -1
View File
@@ -14,6 +14,14 @@ namespace Convertarr.Data.Models
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int MediaInfoId { get; set; } public int MediaInfoId { get; set; }
public string Codec { get; set; } // Summary:
// Duration of media
public TimeSpan Duration { get; set;}
public virtual IEnumerable<VideoStream> VideoStreams {get;set;}
public virtual IEnumerable<AudioStream> AudioStreams {get;set;}
public virtual IEnumerable<SubtitleStream> SubtitleStreams {get;set;}
} }
} }
+22
View File
@@ -0,0 +1,22 @@
namespace Convertarr.Data.Models
{
public class MediaStream
{
//
// Summary:
// File source of stream
public string Path { get; set; }
//
// Summary:
// Index of stream
public int Index { get; set; }
//
// Summary:
// Format
public string Codec { get; set; }
//
// Summary:
// Codec type
public MediaStreamType MediaStreamType { get; set; }
}
}
@@ -0,0 +1,21 @@
namespace Convertarr.Data.Models
{
//
// Summary:
// Stream type
public enum MediaStreamType
{
//
// Summary:
// Video stream
Video = 0,
//
// Summary:
// Audio stream
Audio = 1,
//
// Summary:
// Subtitle stream
Subtitle = 2
}
}
@@ -0,0 +1,29 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Convertarr.Data.Models
{
public class SubtitleStream : MediaStream
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int SubtitleStreamId { get; set; }
//
// Summary:
// Subtitle language
public required string Language { get; set; }
//
// Summary:
// Default
public int? Default { get; set; }
//
// Summary:
// Forced
public int? Forced { get; set; }
//
// Summary:
// Title
public required string Title { get; set; }
}
}
+53
View File
@@ -0,0 +1,53 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Convertarr.Data.Models
{
public class VideoStream : MediaStream
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int VideoStreamId { get; set; }
//
// Summary:
// Rotation angle
public int? Rotation { get; set; }
//
// Summary:
// Forced
public int? Forced { get; set; }
//
// Summary:
// Default
public int? Default { get; set; }
//
// Summary:
// Video bitrate
public long Bitrate { get; set; }
//
// Summary:
// Screen ratio
public string Ratio { get; set; }
//
// Summary:
// Frame rate
public double Framerate { get; set; }
//
// Summary:
// Height
public int Height { get; set; }
//
// Summary:
// Width
public int Width { get; set; }
//
// Summary:
// Duration
public TimeSpan Duration { get; set; }
//
// Summary:
// Pixel Format
public required string PixelFormat { get; set; }
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
@@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>.</DockerfileContext> <DockerfileContext>.</DockerfileContext>
<UserSecretsId>a6cd9fb8-2c5b-4050-8de6-35b900282e87</UserSecretsId>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UserSecretsId>ddf29b39-9301-478f-82ac-b3dac4be32ac</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>