mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 19:56:31 +00:00
add quartz for jobs
configure auto-scan folder and create hls files job WIP
This commit is contained in:
@@ -10,4 +10,8 @@
|
||||
<ProjectReference Include="..\Azaion.Repository\Azaion.Repository.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Diagnostics;
|
||||
using Azaion.Repository;
|
||||
using Azaion.Repository.DTO.Configs;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Azaion.Video;
|
||||
|
||||
public interface IFfmpegManager
|
||||
{
|
||||
void ConvertToHls(string video, string segmentFile, string outFile);
|
||||
}
|
||||
|
||||
public class FfmpegManager(IOptions<FoldersConfig> config) : IFfmpegManager
|
||||
{
|
||||
public void ConvertToHls(string video, string segmentFile, string outFile)
|
||||
{
|
||||
string arguments = string.Concat($"-i \"{video}\" ",
|
||||
"-f hls ",
|
||||
"-hls_time 2 ",
|
||||
"-hls_playlist_type vod ",
|
||||
"-hls_flags independent_segments ",
|
||||
"-hls_segment_type mpegts ",
|
||||
$"-hls_segment_filename \"{segmentFile}\"",
|
||||
$"\"{outFile}\"");
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = new()
|
||||
{
|
||||
FileName = config.Value.FfmpegExecutable,
|
||||
Arguments = arguments,
|
||||
UseShellExecute = true,
|
||||
},
|
||||
EnableRaisingEvents = true,
|
||||
};
|
||||
process.Start();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ using Azaion.Repository.Entities;
|
||||
|
||||
namespace Azaion.Video;
|
||||
|
||||
public interface IVideoManager
|
||||
public interface IVideoRepository
|
||||
{
|
||||
List<VideoDto> GetVideos();
|
||||
Media Get(Guid mediaId);
|
||||
+4
-2
@@ -1,11 +1,13 @@
|
||||
using System.Diagnostics;
|
||||
using Azaion.Repository;
|
||||
using Azaion.Repository.DTO;
|
||||
using Azaion.Repository.DTO.Configs;
|
||||
using Azaion.Repository.Entities;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Azaion.Video;
|
||||
|
||||
public class VideoManager(IDbFactory dbFactory) : IVideoManager
|
||||
public class VideoRepository(IDbFactory dbFactory, IOptions<FoldersConfig> foldersConfig) : IVideoRepository
|
||||
{
|
||||
public List<VideoDto> GetVideos()
|
||||
{
|
||||
@@ -38,7 +40,7 @@ public class VideoManager(IDbFactory dbFactory) : IVideoManager
|
||||
{
|
||||
StartInfo = new()
|
||||
{
|
||||
FileName = Constants.FFMPEG_FILE,
|
||||
FileName = foldersConfig.Value.FfmpegExecutable,
|
||||
Arguments = arguments,
|
||||
UseShellExecute = true,
|
||||
},
|
||||
Reference in New Issue
Block a user