mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 23:26:30 +00:00
7807f5bc90
configure auto-scan folder and create hls files job WIP
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using Azaion.Repository.DTO.Configs;
|
|
using Azaion.Video.DTO;
|
|
using Microsoft.Extensions.Options;
|
|
using IOPath = System.IO.Path;
|
|
|
|
namespace Azaion.Repository.Entities;
|
|
|
|
public class Media
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string Path { get; set; } = null!;
|
|
public int Resolution { get; set; }
|
|
public int Bitrate { get; set; }
|
|
public Guid? AnnotatorId { get; set; }
|
|
public MediaStatusEnum Status { get; set; }
|
|
public DateTime CreatedDate { get; set; }
|
|
|
|
|
|
private string MediaName => IOPath.GetFileNameWithoutExtension(Path);
|
|
private string OutDir(IOptions<FoldersConfig> config) =>
|
|
Directory.CreateDirectory(IOPath.Combine(config.Value.HlsFolder, MediaName)).FullName;
|
|
|
|
public string M3U8File(IOptions<FoldersConfig> config) =>
|
|
IOPath.Combine(OutDir(config), $"{MediaName}.{Constants.M3_U8_EXT}");
|
|
|
|
public string SegmentFile(IOptions<FoldersConfig> config) =>
|
|
IOPath.Combine(OutDir(config), $"{MediaName}%03d.{Constants.TS_EXT}");
|
|
}
|