Public Access
Add transcript line workflow rules
PR and Push Build/Test / build-and-test (push) Failing after 13m27s
PR and Push Build/Test / build-and-test (push) Failing after 13m27s
This commit is contained in:
@@ -14,11 +14,30 @@ public interface ITranscriptStore
|
||||
return CreateSessionAsync(cancellationToken);
|
||||
}
|
||||
|
||||
Task AppendAsync(TranscriptSession session, TranscriptionSegment segment, CancellationToken cancellationToken);
|
||||
Task AppendAsync(TranscriptSession session, TranscriptionSegment segment, CancellationToken cancellationToken)
|
||||
{
|
||||
return AppendLineAsync(
|
||||
session,
|
||||
TranscriptLineFormatter.Format(segment).Line,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
Task AppendLineAsync(TranscriptSession session, string line, CancellationToken cancellationToken);
|
||||
|
||||
Task ReplaceAsync(
|
||||
TranscriptSession session,
|
||||
IReadOnlyList<TranscriptionSegment> replacementSegments,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return ReplaceLinesAsync(
|
||||
session,
|
||||
replacementSegments.Select(segment => TranscriptLineFormatter.Format(segment).Line).ToList(),
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
Task ReplaceLinesAsync(
|
||||
TranscriptSession session,
|
||||
IReadOnlyList<string> replacementLines,
|
||||
CancellationToken cancellationToken);
|
||||
|
||||
Task UpdateMetadataAsync(
|
||||
@@ -29,3 +48,26 @@ public interface ITranscriptStore
|
||||
}
|
||||
|
||||
public sealed record TranscriptSession(string TranscriptPath);
|
||||
|
||||
public static class TranscriptLineFormatter
|
||||
{
|
||||
public static FormattedTranscriptLine Format(TranscriptionSegment segment)
|
||||
{
|
||||
var speaker = NormalizeSpeaker(segment.Speaker);
|
||||
return new FormattedTranscriptLine(
|
||||
$"[{segment.Start:hh\\:mm\\:ss}] {speaker}: {segment.Text}",
|
||||
speaker);
|
||||
}
|
||||
|
||||
public static string FormatSegmentLine(TranscriptionSegment segment)
|
||||
{
|
||||
return Format(segment).Line;
|
||||
}
|
||||
|
||||
public static string NormalizeSpeaker(string? speaker)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(speaker) ? "Unknown" : speaker;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed record FormattedTranscriptLine(string Line, string Speaker);
|
||||
|
||||
Reference in New Issue
Block a user