自动去除VTT class
例如: ``` <c.background-color_transparent.font-family_monospace.font-style_normal.font-weight_normal>[bell tolls]</c> <c.background-color_transparent.font-family_monospace.font-style_normal.font-weight_normal><b>[bell tolls]</b></c> <c.background-color_transparent.font-family_monospace.font-style_normal.font-weight_normal>Is it open now, dough boy?</c> ```
This commit is contained in:
parent
2ac18681b2
commit
f2468d16d7
|
@ -15,6 +15,8 @@ namespace N_m3u8DL_RE.Common.Entity
|
||||||
private static partial Regex TSValueRegex();
|
private static partial Regex TSValueRegex();
|
||||||
[GeneratedRegex("\\s")]
|
[GeneratedRegex("\\s")]
|
||||||
private static partial Regex SplitRegex();
|
private static partial Regex SplitRegex();
|
||||||
|
[GeneratedRegex("<c\\..*?>([\\s\\S]*?)<\\/c>")]
|
||||||
|
private static partial Regex VttClassRegex();
|
||||||
|
|
||||||
public List<SubCue> Cues { get; set; } = new List<SubCue>();
|
public List<SubCue> Cues { get; set; } = new List<SubCue>();
|
||||||
public long MpegtsTimestamp { get; set; } = 0L;
|
public long MpegtsTimestamp { get; set; } = 0L;
|
||||||
|
@ -88,7 +90,7 @@ namespace N_m3u8DL_RE.Common.Entity
|
||||||
{
|
{
|
||||||
StartTime = startTime,
|
StartTime = startTime,
|
||||||
EndTime = endTime,
|
EndTime = endTime,
|
||||||
Payload = string.Join("", payload.Where(c => c != 8203)), //Remove Zero Width Space!
|
Payload = RemoveClassTag(string.Join("", payload.Where(c => c != 8203))), //Remove Zero Width Space!
|
||||||
Settings = style
|
Settings = style
|
||||||
});
|
});
|
||||||
payloads.Clear();
|
payloads.Clear();
|
||||||
|
@ -120,6 +122,15 @@ namespace N_m3u8DL_RE.Common.Entity
|
||||||
return webSub;
|
return webSub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string RemoveClassTag(string text)
|
||||||
|
{
|
||||||
|
if (VttClassRegex().IsMatch(text))
|
||||||
|
{
|
||||||
|
return VttClassRegex().Match(text).Groups[1].Value;
|
||||||
|
}
|
||||||
|
else return text;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 从另一个字幕中获取所有Cue,并加载此字幕中,且自动修正偏移
|
/// 从另一个字幕中获取所有Cue,并加载此字幕中,且自动修正偏移
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue