- 将播放器收敛为单个共享实例,避免列表/网格内多个 video ref 导致进度保存失效 - 恢复视频播放器上方的继续播放提示 - 在播放、暂停、拖动、结束、切换页面和离开页面时保存播放位置 - 保留文件浏览分页和排序参数的前端调用
105 lines
3.6 KiB
C#
105 lines
3.6 KiB
C#
using Microsoft.EntityFrameworkCore;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
|
||
namespace FileShare_EFCore.Models
|
||
{
|
||
/// <summary>
|
||
/// 扫描入库的可在线查看文件。
|
||
/// </summary>
|
||
[Comment("文件库文件记录")]
|
||
[Table("managed-file-record")]
|
||
public class ManagedFileRecord
|
||
{
|
||
/// <summary>主键 ID。</summary>
|
||
[Key]
|
||
[Column("id")]
|
||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||
public int Id { get; set; }
|
||
|
||
/// <summary>所属根目录 ID。</summary>
|
||
[Column("library-root-id")]
|
||
public int LibraryRootId { get; set; }
|
||
|
||
/// <summary>文件名。</summary>
|
||
[Column("file-name")]
|
||
[MaxLength(260)]
|
||
public string FileName { get; set; } = string.Empty;
|
||
|
||
/// <summary>相对根目录路径。</summary>
|
||
[Column("relative-path")]
|
||
[MaxLength(1024)]
|
||
public string RelativePath { get; set; } = string.Empty;
|
||
|
||
/// <summary>服务器本机绝对路径。</summary>
|
||
[Column("absolute-path")]
|
||
[MaxLength(2048)]
|
||
public string AbsolutePath { get; set; } = string.Empty;
|
||
|
||
/// <summary>扩展名,小写并包含点。</summary>
|
||
[Column("extension")]
|
||
[MaxLength(32)]
|
||
public string Extension { get; set; } = string.Empty;
|
||
|
||
/// <summary>文件大小,字节。</summary>
|
||
[Column("size-bytes")]
|
||
public long SizeBytes { get; set; }
|
||
|
||
/// <summary>文件最后修改时间 UTC。</summary>
|
||
[Column("last-write-time-utc")]
|
||
public DateTime LastWriteTimeUtc { get; set; }
|
||
|
||
/// <summary>鏂囦欢鍦ㄦ枃浠剁郴缁熶腑鐨勫垱寤烘椂闂?UTC銆?/summary>
|
||
[Column("file-creation-time-utc")]
|
||
public DateTime? FileCreationTimeUtc { get; set; }
|
||
|
||
/// <summary>媒体类型:text、video、audio。</summary>
|
||
[Column("media-type")]
|
||
[MaxLength(20)]
|
||
public string MediaType { get; set; } = string.Empty;
|
||
|
||
/// <summary>MIME 类型。</summary>
|
||
[Column("content-type")]
|
||
[MaxLength(100)]
|
||
public string ContentType { get; set; } = "application/octet-stream";
|
||
|
||
/// <summary>文件是否仍存在。</summary>
|
||
[Column("exists")]
|
||
public bool Exists { get; set; } = true;
|
||
|
||
/// <summary>最近扫描时间。</summary>
|
||
[Column("last-seen-at")]
|
||
public DateTime LastSeenAt { get; set; } = DateTime.UtcNow;
|
||
|
||
/// <summary>视频缩略图路径(相对于 wwwroot)。</summary>
|
||
[Column("thumbnail-id")]
|
||
public int? ThumbnailId { get; set; }
|
||
|
||
/// <summary>视频时长(秒)。</summary>
|
||
[Column("video-duration")]
|
||
public double? VideoDuration { get; set; }
|
||
|
||
/// <summary>最近一次播放时间 UTC。</summary>
|
||
[Column("last-played-at")]
|
||
public DateTime? LastPlayedAt { get; set; }
|
||
|
||
/// <summary>视频播放位置(秒)。</summary>
|
||
[Column("playback-position")]
|
||
public double? PlaybackPosition { get; set; }
|
||
|
||
/// <summary>创建时间。</summary>
|
||
[Column("created-at")]
|
||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||
|
||
/// <summary>更新时间。</summary>
|
||
[Column("updated-at")]
|
||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||
|
||
/// <summary>所属根目录。</summary>
|
||
public ManagedLibraryRoot? LibraryRoot { get; set; }
|
||
|
||
/// <summary>缩略图映射记录。</summary>
|
||
public ManagedThumbnailMap? Thumbnail { get; set; }
|
||
}
|
||
}
|