feat: add "partIndex" file name template variable

close #114 #360
This commit is contained in:
genteure 2022-08-27 16:51:13 +08:00
parent 8e9faa7a94
commit 616efe40c9
4 changed files with 9 additions and 0 deletions

View File

@ -36,6 +36,8 @@ namespace BililiveRecorder.Core.Recording
private readonly FileNameGenerator fileNameGenerator;
private readonly UserScriptRunner userScriptRunner;
private int partIndex = 0;
protected string? streamHost;
protected bool started = false;
protected bool timeoutTriggered = false;
@ -178,6 +180,8 @@ namespace BililiveRecorder.Core.Recording
protected (string fullPath, string relativePath) CreateFileName()
{
this.partIndex++;
var output = this.fileNameGenerator.CreateFilePath(new FileNameTemplateContext
{
Name = FileNameGenerator.RemoveInvalidFileName(this.room.Name, ignore_slash: false),
@ -186,6 +190,7 @@ namespace BililiveRecorder.Core.Recording
ShortId = this.room.ShortId,
AreaParent = FileNameGenerator.RemoveInvalidFileName(this.room.AreaNameParent, ignore_slash: false),
AreaChild = FileNameGenerator.RemoveInvalidFileName(this.room.AreaNameChild, ignore_slash: false),
PartIndex = this.partIndex,
Qn = this.qn,
Json = this.room.RawBilibiliApiJsonData,
});

View File

@ -16,6 +16,8 @@ namespace BililiveRecorder.Core.Templating
public string AreaChild { get; set; } = string.Empty;
public int PartIndex { get; set; }
public int Qn { get; set; }
public JObject? Json { get; set; }

View File

@ -8,6 +8,7 @@ namespace BililiveRecorder.Web.Models.Rest
public string Title { get; set; } = string.Empty;
public string AreaParent { get; set; } = string.Empty;
public string AreaChild { get; set; } = string.Empty;
public int PartIndex { get; set; }
public int Qn { get; set; }
/// <example>{}</example>

View File

@ -517,6 +517,7 @@ namespace BililiveRecorder.Core.Templating
public string AreaParent { get; set; }
public Newtonsoft.Json.Linq.JObject? Json { get; set; }
public string Name { get; set; }
public int PartIndex { get; set; }
public int Qn { get; set; }
public int RoomId { get; set; }
public int ShortId { get; set; }