mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 11:42:22 +08:00
Toolbox: Change source file structure
This commit is contained in:
parent
2b482a9c4b
commit
e2d5a3fd47
|
@ -18,33 +18,8 @@ using BililiveRecorder.ToolBox.ProcessingRules;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Serilog;
|
||||
|
||||
namespace BililiveRecorder.ToolBox.Commands
|
||||
namespace BililiveRecorder.ToolBox.Tool.Analyze
|
||||
{
|
||||
public class AnalyzeRequest : ICommandRequest<AnalyzeResponse>
|
||||
{
|
||||
public string Input { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class AnalyzeResponse
|
||||
{
|
||||
public string InputPath { get; set; } = string.Empty;
|
||||
|
||||
public bool NeedFix { get; set; }
|
||||
public bool Unrepairable { get; set; }
|
||||
|
||||
public int OutputFileCount { get; set; }
|
||||
|
||||
public FlvStats? VideoStats { get; set; }
|
||||
public FlvStats? AudioStats { get; set; }
|
||||
|
||||
public int IssueTypeOther { get; set; }
|
||||
public int IssueTypeUnrepairable { get; set; }
|
||||
public int IssueTypeTimestampJump { get; set; }
|
||||
public int IssueTypeTimestampOffset { get; set; }
|
||||
public int IssueTypeDecodingHeader { get; set; }
|
||||
public int IssueTypeRepeatingData { get; set; }
|
||||
}
|
||||
|
||||
public class AnalyzeHandler : ICommandHandler<AnalyzeRequest, AnalyzeResponse>
|
||||
{
|
||||
private static readonly ILogger logger = Log.ForContext<AnalyzeHandler>();
|
7
BililiveRecorder.ToolBox/Tool/Analyze/AnalyzeRequest.cs
Normal file
7
BililiveRecorder.ToolBox/Tool/Analyze/AnalyzeRequest.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace BililiveRecorder.ToolBox.Tool.Analyze
|
||||
{
|
||||
public class AnalyzeRequest : ICommandRequest<AnalyzeResponse>
|
||||
{
|
||||
public string Input { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
24
BililiveRecorder.ToolBox/Tool/Analyze/AnalyzeResponse.cs
Normal file
24
BililiveRecorder.ToolBox/Tool/Analyze/AnalyzeResponse.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using BililiveRecorder.ToolBox.ProcessingRules;
|
||||
|
||||
namespace BililiveRecorder.ToolBox.Tool.Analyze
|
||||
{
|
||||
public class AnalyzeResponse
|
||||
{
|
||||
public string InputPath { get; set; } = string.Empty;
|
||||
|
||||
public bool NeedFix { get; set; }
|
||||
public bool Unrepairable { get; set; }
|
||||
|
||||
public int OutputFileCount { get; set; }
|
||||
|
||||
public FlvStats? VideoStats { get; set; }
|
||||
public FlvStats? AudioStats { get; set; }
|
||||
|
||||
public int IssueTypeOther { get; set; }
|
||||
public int IssueTypeUnrepairable { get; set; }
|
||||
public int IssueTypeTimestampJump { get; set; }
|
||||
public int IssueTypeTimestampOffset { get; set; }
|
||||
public int IssueTypeDecodingHeader { get; set; }
|
||||
public int IssueTypeRepeatingData { get; set; }
|
||||
}
|
||||
}
|
|
@ -10,19 +10,8 @@ using BililiveRecorder.Flv.Parser;
|
|||
using BililiveRecorder.Flv.Xml;
|
||||
using Serilog;
|
||||
|
||||
namespace BililiveRecorder.ToolBox.Commands
|
||||
namespace BililiveRecorder.ToolBox.Tool.Export
|
||||
{
|
||||
public class ExportRequest : ICommandRequest<ExportResponse>
|
||||
{
|
||||
public string Input { get; set; } = string.Empty;
|
||||
|
||||
public string Output { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class ExportResponse
|
||||
{
|
||||
}
|
||||
|
||||
public class ExportHandler : ICommandHandler<ExportRequest, ExportResponse>
|
||||
{
|
||||
private static readonly ILogger logger = Log.ForContext<ExportHandler>();
|
9
BililiveRecorder.ToolBox/Tool/Export/ExportRequest.cs
Normal file
9
BililiveRecorder.ToolBox/Tool/Export/ExportRequest.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace BililiveRecorder.ToolBox.Tool.Export
|
||||
{
|
||||
public class ExportRequest : ICommandRequest<ExportResponse>
|
||||
{
|
||||
public string Input { get; set; } = string.Empty;
|
||||
|
||||
public string Output { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
6
BililiveRecorder.ToolBox/Tool/Export/ExportResponse.cs
Normal file
6
BililiveRecorder.ToolBox/Tool/Export/ExportResponse.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
namespace BililiveRecorder.ToolBox.Tool.Export
|
||||
{
|
||||
public class ExportResponse
|
||||
{
|
||||
}
|
||||
}
|
|
@ -17,37 +17,8 @@ using BililiveRecorder.ToolBox.ProcessingRules;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Serilog;
|
||||
|
||||
namespace BililiveRecorder.ToolBox.Commands
|
||||
namespace BililiveRecorder.ToolBox.Tool.Fix
|
||||
{
|
||||
public class FixRequest : ICommandRequest<FixResponse>
|
||||
{
|
||||
public string Input { get; set; } = string.Empty;
|
||||
|
||||
public string OutputBase { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class FixResponse
|
||||
{
|
||||
public string InputPath { get; set; } = string.Empty;
|
||||
|
||||
public string[] OutputPaths { get; set; } = Array.Empty<string>();
|
||||
|
||||
public bool NeedFix { get; set; }
|
||||
public bool Unrepairable { get; set; }
|
||||
|
||||
public int OutputFileCount { get; set; }
|
||||
|
||||
public FlvStats? VideoStats { get; set; }
|
||||
public FlvStats? AudioStats { get; set; }
|
||||
|
||||
public int IssueTypeOther { get; set; }
|
||||
public int IssueTypeUnrepairable { get; set; }
|
||||
public int IssueTypeTimestampJump { get; set; }
|
||||
public int IssueTypeTimestampOffset { get; set; }
|
||||
public int IssueTypeDecodingHeader { get; set; }
|
||||
public int IssueTypeRepeatingData { get; set; }
|
||||
}
|
||||
|
||||
public class FixHandler : ICommandHandler<FixRequest, FixResponse>
|
||||
{
|
||||
private static readonly ILogger logger = Log.ForContext<FixHandler>();
|
||||
|
@ -115,9 +86,7 @@ namespace BililiveRecorder.ToolBox.Commands
|
|||
var outputPaths = new List<string>();
|
||||
IFlvTagWriter tagWriter;
|
||||
if (xmlMode)
|
||||
{
|
||||
tagWriter = new FlvTagListWriter();
|
||||
}
|
||||
else
|
||||
{
|
||||
var targetProvider = new AutoFixFlvWriterTargetProvider(request.OutputBase);
|
||||
|
@ -170,7 +139,6 @@ namespace BililiveRecorder.ToolBox.Commands
|
|||
logger.Information("Xml meta: {@Meta}", meta);
|
||||
|
||||
if (xmlMode)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var w = (FlvTagListWriter)tagWriter;
|
||||
|
@ -195,7 +163,6 @@ namespace BililiveRecorder.ToolBox.Commands
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return new CommandResponse<FixResponse> { Status = ResponseStatus.Cancelled };
|
9
BililiveRecorder.ToolBox/Tool/Fix/FixRequest.cs
Normal file
9
BililiveRecorder.ToolBox/Tool/Fix/FixRequest.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace BililiveRecorder.ToolBox.Tool.Fix
|
||||
{
|
||||
public class FixRequest : ICommandRequest<FixResponse>
|
||||
{
|
||||
public string Input { get; set; } = string.Empty;
|
||||
|
||||
public string OutputBase { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
27
BililiveRecorder.ToolBox/Tool/Fix/FixResponse.cs
Normal file
27
BililiveRecorder.ToolBox/Tool/Fix/FixResponse.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using BililiveRecorder.ToolBox.ProcessingRules;
|
||||
|
||||
namespace BililiveRecorder.ToolBox.Tool.Fix
|
||||
{
|
||||
public class FixResponse
|
||||
{
|
||||
public string InputPath { get; set; } = string.Empty;
|
||||
|
||||
public string[] OutputPaths { get; set; } = Array.Empty<string>();
|
||||
|
||||
public bool NeedFix { get; set; }
|
||||
public bool Unrepairable { get; set; }
|
||||
|
||||
public int OutputFileCount { get; set; }
|
||||
|
||||
public FlvStats? VideoStats { get; set; }
|
||||
public FlvStats? AudioStats { get; set; }
|
||||
|
||||
public int IssueTypeOther { get; set; }
|
||||
public int IssueTypeUnrepairable { get; set; }
|
||||
public int IssueTypeTimestampJump { get; set; }
|
||||
public int IssueTypeTimestampOffset { get; set; }
|
||||
public int IssueTypeDecodingHeader { get; set; }
|
||||
public int IssueTypeRepeatingData { get; set; }
|
||||
}
|
||||
}
|
|
@ -2,7 +2,9 @@ using System;
|
|||
using System.CommandLine;
|
||||
using System.CommandLine.Invocation;
|
||||
using System.Threading.Tasks;
|
||||
using BililiveRecorder.ToolBox.Commands;
|
||||
using BililiveRecorder.ToolBox.Tool.Analyze;
|
||||
using BililiveRecorder.ToolBox.Tool.Export;
|
||||
using BililiveRecorder.ToolBox.Tool.Fix;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BililiveRecorder.ToolBox
|
||||
|
|
Loading…
Reference in New Issue
Block a user