pub trait TranscriptSource: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn matches(url: &str) -> bool
where Self: Sized;
fn fetch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
locator: &'life1 str,
opts: &'life2 FetchOpts,
) -> Pin<Box<dyn Future<Output = Result<Transcript>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list_languages<'life0, 'life1, 'async_trait>(
&'life0 self,
locator: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<LanguageInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn info<'life0, 'life1, 'async_trait>(
&'life0 self,
locator: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MediaInfo>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A source capable of fetching transcripts from a media platform.
Implementations are expected to be cheap to construct; per-request state (HTTP client, auth, etc.) lives inside the implementor.
The trait is Send + Sync so implementations can be used behind
Box<dyn TranscriptSource> for runtime dispatch (e.g. once
omni-dev transcript fetch <url> auto-detection lands in a follow-up).
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable, lowercase identifier for the source (e.g. "youtube"). Used
in error messages, the Transcript::source field, and as the
CLI subcommand name.
Sourcefn matches(url: &str) -> boolwhere
Self: Sized,
fn matches(url: &str) -> boolwhere
Self: Sized,
Whether this source recognises url as one of its locators. Used by
future auto-detection (omni-dev transcript fetch <url>).
where Self: Sized keeps this method out of the dyn vtable so
dyn TranscriptSource remains object-safe.
Sourcefn fetch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
locator: &'life1 str,
opts: &'life2 FetchOpts,
) -> Pin<Box<dyn Future<Output = Result<Transcript>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
locator: &'life1 str,
opts: &'life2 FetchOpts,
) -> Pin<Box<dyn Future<Output = Result<Transcript>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Resolve locator to a transcript matching opts.
Sourcefn list_languages<'life0, 'life1, 'async_trait>(
&'life0 self,
locator: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<LanguageInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_languages<'life0, 'life1, 'async_trait>(
&'life0 self,
locator: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<LanguageInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List the caption tracks available on locator.