code cleanup (#743)
* update tools * run code cleanup * update dependencies
This commit is contained in:
@@ -6,23 +6,20 @@ namespace ErsatzTV.Core.FFmpeg;
|
||||
public class SubtitleBuilder
|
||||
{
|
||||
private readonly ITempFilePool _tempFilePool;
|
||||
private Option<int> _alignment;
|
||||
private Option<int> _borderStyle;
|
||||
private string _content;
|
||||
private Option<IDisplaySize> _resolution = None;
|
||||
private Option<string> _fontName;
|
||||
private Option<int> _fontSize;
|
||||
private Option<string> _primaryColor;
|
||||
private Option<string> _outlineColor;
|
||||
private Option<int> _alignment;
|
||||
private int _marginRight;
|
||||
private int _marginLeft;
|
||||
private int _marginRight;
|
||||
private int _marginV;
|
||||
private Option<int> _borderStyle;
|
||||
private Option<string> _outlineColor;
|
||||
private Option<string> _primaryColor;
|
||||
private Option<IDisplaySize> _resolution = None;
|
||||
private Option<int> _shadow;
|
||||
|
||||
public SubtitleBuilder(ITempFilePool tempFilePool)
|
||||
{
|
||||
_tempFilePool = tempFilePool;
|
||||
}
|
||||
public SubtitleBuilder(ITempFilePool tempFilePool) => _tempFilePool = tempFilePool;
|
||||
|
||||
public SubtitleBuilder WithResolution(IDisplaySize resolution)
|
||||
{
|
||||
@@ -71,7 +68,7 @@ public class SubtitleBuilder
|
||||
_marginLeft = marginLeft;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public SubtitleBuilder WithMarginV(int marginV)
|
||||
{
|
||||
_marginV = marginV;
|
||||
@@ -95,7 +92,7 @@ public class SubtitleBuilder
|
||||
_content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public async Task<string> BuildFile()
|
||||
{
|
||||
string fileName = _tempFilePool.GetNextTempFile(TempFileCategory.Subtitle);
|
||||
@@ -114,12 +111,15 @@ public class SubtitleBuilder
|
||||
}
|
||||
|
||||
sb.AppendLine("[V4+ Styles]");
|
||||
sb.AppendLine("Format: Name, Fontname, Fontsize, PrimaryColour, OutlineColour, BorderStyle, Outline, Shadow, Alignment, Encoding");
|
||||
sb.AppendLine($"Style: Default,{await _fontName.IfNoneAsync("")},{await _fontSize.IfNoneAsync(32)},{await _primaryColor.IfNoneAsync("")},{await _outlineColor.IfNoneAsync("")},{await _borderStyle.IfNoneAsync(0)},1,{await _shadow.IfNoneAsync(0)},{await _alignment.IfNoneAsync(0)},1");
|
||||
sb.AppendLine(
|
||||
"Format: Name, Fontname, Fontsize, PrimaryColour, OutlineColour, BorderStyle, Outline, Shadow, Alignment, Encoding");
|
||||
sb.AppendLine(
|
||||
$"Style: Default,{await _fontName.IfNoneAsync("")},{await _fontSize.IfNoneAsync(32)},{await _primaryColor.IfNoneAsync("")},{await _outlineColor.IfNoneAsync("")},{await _borderStyle.IfNoneAsync(0)},1,{await _shadow.IfNoneAsync(0)},{await _alignment.IfNoneAsync(0)},1");
|
||||
|
||||
sb.AppendLine("[Events]");
|
||||
sb.AppendLine("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text");
|
||||
sb.AppendLine($"Dialogue: 0,0:00:00.00,99:99:99.99,Default,,{_marginLeft},{_marginRight},{_marginV},,{_content}");
|
||||
sb.AppendLine(
|
||||
$"Dialogue: 0,0:00:00.00,99:99:99.99,Default,,{_marginLeft},{_marginRight},{_marginV},,{_content}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_content))
|
||||
{
|
||||
@@ -130,4 +130,4 @@ public class SubtitleBuilder
|
||||
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user