[ADD] New entities for library db

This commit is contained in:
max
2025-08-16 16:46:56 +02:00
parent 3c3f2db4e7
commit f9aaf4267e
9 changed files with 133 additions and 1 deletions

View File

@@ -17,7 +17,6 @@
<ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="Models\LibraryContext\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,7 @@
namespace Manager.Data.Models;
public abstract class DateTimeBase
{
public DateTime CreatedAtUtc { get; set; } = DateTime.UtcNow;
public DateTime LastModifiedUtc { get; set; } = DateTime.UtcNow;
}

View File

@@ -0,0 +1,9 @@
namespace Manager.Data.Models.LibraryContext;
public class CaptionEntity
{
public required string MediaId { get; set; }
public required string Name { get; set; }
public required string CaptionPath { get; set; }
public string? LanguageCode { get; set; }
}

View File

@@ -0,0 +1,15 @@
namespace Manager.Data.Models.LibraryContext;
public class ChannelEntity
{
public required string Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public DateTime JoinedDate { get; set; }
public long Subscribers { get; set; }
public long TotalVideos { get; set; }
public long TotalViews { get; set; }
public DateTime AddedDate { get; set; }
public DateTime ModifiedDate { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace Manager.Data.Models.LibraryContext;
public class ClientAccountEntity : DateTimeBase
{
public Guid Id { get; set; }
public string Name { get; set; } = "";
public List<PlaylistEntity> Playlists { get; set; } = [];
public List<HttpCookieEntity> HttpCookies { get; set; } = [];
}

View File

@@ -0,0 +1,15 @@
namespace Manager.Data.Models.LibraryContext;
public class HttpCookieEntity : DateTimeBase
{
public required string Name { get; set; }
public string? Value { get; set; }
public string? Domain { get; set; }
public string? Path { get; set; }
public DateTimeOffset? ExpiresUtc { get; set; }
public bool Secure { get; set; }
public bool HttpOnly { get; set; }
public string? SameSite { get; set; }
public required string ClientId { get; set; }
}

View File

@@ -0,0 +1,33 @@
namespace Manager.Data.Models.LibraryContext;
public class MediaEntity : DateTimeBase
{
public required string Id { get; set; }
public string? Title { get; set; }
public string? Description { get; set; }
public DateTime UploadDateUtc { get; set; }
public required string ChannelId { get; set; }
public List<MediaFormatEntity> Formats { get; set; } = [];
public List<CaptionEntity> Captions { get; set; } = [];
public MediaState State { get; set; } = MediaState.Online;
public bool IsDownloaded { get; set; }
public MediaProcessState ProcessState { get; set; } = MediaProcessState.ToDownload;
}
public enum MediaState
{
Online,
Offline,
Limited,
Removed
}
public enum MediaProcessState
{
ToDownload,
Downloaded,
ToRemove,
Removed,
Failed
}

View File

@@ -0,0 +1,36 @@
namespace Manager.Data.Models.LibraryContext;
public class MediaFormatEntity
{
public required string MediaId { get; set; }
public required string MediaPath { get; set; }
public VideoQuality VideoQuality { get; set; } = VideoQuality.None;
public bool IsAdaptive { get; set; }
public string? MimeType { get; set; }
public long Bitrate { get; set; }
public long AverageBitrate { get; set; }
public long LastModifiedUnixEpoch { get; set; }
public long ContentLengthBytes { get; set; }
public long ApproxDurationMs { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public double Framerate { get; set; }
public string? QualityLabel { get; set; }
public int AudioChannels { get; set; }
public string? AudioSampleRate { get; set; }
public double LoudnessDb { get; set; }
}
public enum VideoQuality
{
P4320 = 4320,
P2160 = 2160,
P1440 = 1440,
P1080 = 1080,
P720 = 720,
P480 = 480,
P360 = 360,
P240 = 240,
P144 = 144,
None = 0
}

View File

@@ -0,0 +1,9 @@
namespace Manager.Data.Models.LibraryContext;
public class PlaylistEntity : DateTimeBase
{
public required string Id { get; set; }
public required string Name { get; set; }
public string? Description { get; set; }
public required string ChannelId { get; set; }
}