Merge pull request #151 from carlitosteso3/fix/transcripts-89-97-98

Transcripts: disabled, not failing, in builds without speech-to-text (#89, #97, #98)
This commit is contained in:
Brandon Thomas
2026-10-07 10:44:59 -04:00
committed by GitHub
3 changed files with 17 additions and 4 deletions
+8 -1
View File
@@ -57,7 +57,7 @@ pub(crate) fn commands() -> Vec<CommandSpec> {
&["Sequence"],
None,
r#"{"track":"mix"|"A1"|id?,"language":"en|auto"?,"diarize":bool?,"maxSpeakers":n?,"model":str?}"#,
has_audio_clips,
can_transcribe_sequence,
transcribe,
),
spec(
@@ -105,6 +105,13 @@ fn has_audio_clips(s: &Session) -> std::result::Result<(), String> {
if q.audio_tracks.iter().any(|t| !t.items.is_empty()) { Ok(()) } else { Err("the sequence has no audio clips".into()) }
}
/// Transcribe Sequence runs `transcript.generate`: disabled like it in a build without
/// speech-to-text (#97), and when the sequence has no sound.
fn can_transcribe_sequence(s: &Session) -> std::result::Result<(), String> {
crate::transcript::can_transcribe(s)?;
has_audio_clips(s)
}
fn has_caption_track(s: &Session) -> std::result::Result<(), String> {
has_seq(s)?;
if s.active_sequence().is_some_and(|q| !q.caption_tracks.is_empty()) { Ok(()) } else { Err("the sequence has no caption track".into()) }
+2
View File
@@ -167,6 +167,7 @@ fn generate_without_a_transcriber() {
let why = if filmcraft_speech::available() { "unknown speech model" } else { "not available in this build" };
assert!(e.contains(why), "{e}");
if !filmcraft_speech::available() {
assert!(!s.is_enabled("sequence.transcribe"), "Transcribe Sequence follows transcript.generate");
let e = s.execute("transcript.generate", json!({"items": [item.0]})).unwrap_err().to_string();
assert!(e.contains("whisper") && e.contains("not available"), "{e}");
#[cfg(not(feature = "speech-download"))]
@@ -174,6 +175,7 @@ fn generate_without_a_transcriber() {
}
// defaults to the media of the open sequence's audio clips
s.transcriber = Some(Arc::new(FixedTranscriber { transcript: Transcript::default(), id: "empty".into() }));
assert!(s.is_enabled("sequence.transcribe"), "an installed recogniser enables Transcribe Sequence");
let r = s.execute("transcript.generate", json!({})).unwrap();
assert!(r["items"].as_array().unwrap().len() >= 2, "{r}");
}
+7 -3
View File
@@ -50,9 +50,13 @@ Both are **optional features**, off by default and never built for the web:
- `download` (`speech-download` on the engine): HTTPS downloads with rustls + RustCrypto and the
operating system's certificate verifier.
Without `whisper`, `transcript.generate` fails with "speech-to-text is not available in this build";
transcripts can still be imported with `transcript.set` and edited with every other command. Hosts
and tests can install any recogniser in `Session::transcriber`.
Without `whisper`, and with no recogniser installed, `transcript.generate` and Transcribe Sequence
are disabled, with "speech-to-text is not available in this build" as the reason (`describe`,
`command_list {"enabled_only": true}` and the menus show it); with Automatically transcribe clips
on, `file.import` reports the same reason as a `transcription: …` entry in its `errors`.
Without `speech-download`, `transcript.downloadModel` is disabled the same way. Transcripts can
still be imported with `transcript.set` and edited with every other command. Hosts and tests can
install any recogniser in `Session::transcriber`, which enables transcription in any build.
### Models