mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 18:47:21 +00:00
Added transcription of audio and video files to local data sources (#1081)
Co-authored-by: Paul Koudelka <106623909+PaulKoudelka@users.noreply.github.com>
This commit is contained in:
1 parent
8642ce2d81
commit
752f7d828a
82 files changed
+3231
-302
No files matched your search
@@ -0,0 +1,57 @@
|
||||
using AIStudio.Tools.Media;
|
||||
|
||||
namespace AIStudio.Tests.Tools.Media;
|
||||
|
||||
/// <summary>
|
||||
/// Checks the transcripts which the Batch Processing assistant keeps next to its media files.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public sealed class MediaSidecarTranscriptsTests
|
||||
{
|
||||
[TestCase("recording.mp3.transcript.md")]
|
||||
[TestCase("recording.mp3.transcript.md.0123456789abcdef.tmp")]
|
||||
[TestCase("RECORDING.MP3.TRANSCRIPT.MD")]
|
||||
public void GeneratedTranscriptFilesAreRecognized(string fileName)
|
||||
{
|
||||
Assert.That(MediaSidecarTranscripts.IsArtifactPath(fileName), Is.True);
|
||||
}
|
||||
|
||||
[TestCase("notes.md")]
|
||||
[TestCase("recording.mp3")]
|
||||
[TestCase("recording.mp3.transcript.md.backup")]
|
||||
public void OtherFilesAreNoTranscripts(string fileName)
|
||||
{
|
||||
Assert.That(MediaSidecarTranscripts.IsArtifactPath(fileName), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheTranscriptLiesNextToItsMediaFile()
|
||||
{
|
||||
var mediaPath = Path.Combine(Path.GetTempPath(), "recording.mp3");
|
||||
var slot = await MediaSidecarTranscripts.INSTANCE.ResolveAsync(mediaPath, CancellationToken.None);
|
||||
Assert.That(slot.Path, Is.EqualTo(mediaPath + MediaSidecarTranscripts.FILE_SUFFIX));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task OnlyATranscriptWithContentCanBeReused()
|
||||
{
|
||||
var directoryPath = Path.Combine(Path.GetTempPath(), $"ai-studio-sidecar-transcript-{Guid.NewGuid():N}");
|
||||
var mediaPath = Path.Combine(directoryPath, "recording.mp3");
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
|
||||
try
|
||||
{
|
||||
Assert.That(MediaSidecarTranscripts.HasReusableTranscript(mediaPath), Is.False, "A missing transcript counted as reusable.");
|
||||
|
||||
await File.WriteAllTextAsync(MediaSidecarTranscripts.GetFilePath(mediaPath), string.Empty);
|
||||
Assert.That(MediaSidecarTranscripts.HasReusableTranscript(mediaPath), Is.False, "An empty transcript counted as reusable.");
|
||||
|
||||
await File.WriteAllTextAsync(MediaSidecarTranscripts.GetFilePath(mediaPath), "Transcript");
|
||||
Assert.That(MediaSidecarTranscripts.HasReusableTranscript(mediaPath), Is.True);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Directory.Delete(directoryPath, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user