Skip to content
Snippets Groups Projects
Commit 1d083bb5 authored by Anduin Xue's avatar Anduin Xue
Browse files

Fix resharper.

parent bfaa98a4
No related branches found
No related tags found
No related merge requests found

namespace Parser.Core
{
public static class Core
{
}
}
\ No newline at end of file
...@@ -34,7 +34,7 @@ namespace Aiursoft.Parser.FFmpeg ...@@ -34,7 +34,7 @@ namespace Aiursoft.Parser.FFmpeg
foreach (var file in videos) foreach (var file in videos)
{ {
_logger.LogTrace("Parsing video file: " + file); _logger.LogTrace("Parsing video file: " + file);
await Parse(file, coder: _options.UseGPU ? "hevc_nvenc" : "libx265"); await Parse(file, coder: _options.UseGpu ? "hevc_nvenc" : "libx265");
} }
} }
...@@ -52,10 +52,10 @@ namespace Aiursoft.Parser.FFmpeg ...@@ -52,10 +52,10 @@ namespace Aiursoft.Parser.FFmpeg
var newFileName = $"{fileInfo.Directory}{Path.DirectorySeparatorChar}{bareName}_265.mp4"; var newFileName = $"{fileInfo.Directory}{Path.DirectorySeparatorChar}{bareName}_265.mp4";
if (shouldParse) if (shouldParse)
{ {
_logger.LogWarning($"{filePath} WILL be parsed, with codec: {coder}, crf is {_options.CRF}"); _logger.LogWarning($"{filePath} WILL be parsed, with codec: {coder}, crf is {_options.Crf}");
File.Delete(newFileName); File.Delete(newFileName);
await _commandService.RunCommand("ffmpeg", $@"-i ""{filePath}"" -codec:a copy -codec:v {coder} -crf {_options.CRF} ""{newFileName}""", folder, getOutput: false); await _commandService.RunCommand("ffmpeg", $@"-i ""{filePath}"" -codec:a copy -codec:v {coder} -crf {_options.Crf} ""{newFileName}""", folder, getOutput: false);
if (File.Exists(newFileName)) if (File.Exists(newFileName))
{ {
......
...@@ -6,12 +6,12 @@ namespace Aiursoft.Parser.FFmpeg; ...@@ -6,12 +6,12 @@ namespace Aiursoft.Parser.FFmpeg;
public class FFmpegHandler : ServiceCommandHandler<FFmpegEntry, StartUp> public class FFmpegHandler : ServiceCommandHandler<FFmpegEntry, StartUp>
{ {
private Option<bool> UseGPU = new Option<bool>( private Option<bool> UseGpu = new Option<bool>(
getDefaultValue: () => false, getDefaultValue: () => false,
aliases: new[] { "--gpu", "-g" }, aliases: new[] { "--gpu", "-g" },
description: "Use NVIDIA GPU to speed up parsing. Only if you have an NVIDIA GPU attached."); description: "Use NVIDIA GPU to speed up parsing. Only if you have an NVIDIA GPU attached.");
private Option<int> CRF = new Option<int>( private Option<int> Crf = new Option<int>(
getDefaultValue: () => 20, getDefaultValue: () => 20,
aliases: new[] { "--crf", "-c" }, aliases: new[] { "--crf", "-c" },
description: "The range of the CRF scale is 0–51, where 0 is lossless (for 8 bit only, for 10 bit use -qp 0), 20 is the default, and 51 is worst quality possible."); description: "The range of the CRF scale is 0–51, where 0 is lossless (for 8 bit only, for 10 bit use -qp 0), 20 is the default, and 51 is worst quality possible.");
...@@ -24,8 +24,8 @@ public class FFmpegHandler : ServiceCommandHandler<FFmpegEntry, StartUp> ...@@ -24,8 +24,8 @@ public class FFmpegHandler : ServiceCommandHandler<FFmpegEntry, StartUp>
{ {
return new Option[] return new Option[]
{ {
UseGPU, UseGpu,
CRF Crf
}; };
} }
...@@ -36,14 +36,14 @@ public class FFmpegHandler : ServiceCommandHandler<FFmpegEntry, StartUp> ...@@ -36,14 +36,14 @@ public class FFmpegHandler : ServiceCommandHandler<FFmpegEntry, StartUp>
OptionsProvider.PathOptions, OptionsProvider.PathOptions,
OptionsProvider.DryRunOption, OptionsProvider.DryRunOption,
OptionsProvider.VerboseOption, OptionsProvider.VerboseOption,
UseGPU, UseGpu,
CRF); Crf);
} }
public Task ExecuteOverride(string path, bool dryRun, bool verbose, bool useGPU, int crf) public Task ExecuteOverride(string path, bool dryRun, bool verbose, bool useGpu, int crf)
{ {
var services = BuildServices(verbose); var services = BuildServices(verbose);
services.AddSingleton(new FFmpegOptions { UseGPU = useGPU, CRF = crf }); services.AddSingleton(new FFmpegOptions { UseGpu = useGpu, Crf = crf });
return RunFromServices(services, path, dryRun); return RunFromServices(services, path, dryRun);
} }
} }
using System; namespace Aiursoft.Parser.FFmpeg
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aiursoft.Parser.FFmpeg
{ {
public class FFmpegOptions public class FFmpegOptions
{ {
public bool UseGPU { get; set; } public bool UseGpu { get; set; }
public int CRF { get; set; } public int Crf { get; set; }
} }
} }
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks;
namespace Aiursoft.Parser.FFmpeg.Services namespace Aiursoft.Parser.FFmpeg.Services
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment