Types
Audio
Audio type {
file: FileMeta,
duration_seconds: Dec?,
format: AudioFormat?,
transcript: Str?
}
Audio file metadata.
Fields
file- File metadata from ::hot::fileduration_seconds- Audio duration in secondsformat- Audio file formattranscript- Transcript text (for transcribed audio)
AudioFormat
Common audio file formats.
Image
Image type {
file: FileMeta,
width: Int?,
height: Int?,
format: ImageFormat?
}
Image file metadata.
Fields
file- File metadata from ::hot::filewidth- Image width in pixelsheight- Image height in pixelsformat- Image file format
ImageFormat
Common image file formats.
Media
Unified enum for media files.
Supports images, audio, and video with provider-agnostic structure.
Usage
import ::hot::media
// Pattern match on media type
describe-media fn (media: Media): Str {
match media {
Media.Image => { `Image: ${media.width}x${media.height}` }
Media.Audio => { `Audio: ${media.duration_seconds}s` }
Media.Video => { `Video: ${media.width}x${media.height} ${media.duration_seconds}s` }
}
}
// Access common file info
path file(media).path
size file(media).size
MediaBatch
MediaBatch type {
items: Vec,
succeeded: Int,
failed: Int,
errors: Vec?
}
Result of batch media processing.
Fields
items- Media filessucceeded- Count of successful operationsfailed- Count of failed operationserrors- List of errors (if any)
MediaError
MediaError type {
index: Int,
message: Str
}
Error that occurred during batch media processing.
Video
Video type {
file: FileMeta,
duration_seconds: Dec?,
width: Int?,
height: Int?,
format: VideoFormat?,
fps: Int?
}
Video file metadata.
Fields
file- File metadata from ::hot::fileduration_seconds- Video duration in secondswidth- Video width in pixelsheight- Video height in pixelsformat- Video file formatfps- Frames per second
VideoFormat
Common video file formats.
Functions
audio
fn (data: Audio): Media
Create a Media.Audio from Audio data.
Example
media audio(Audio({file: file-meta, duration_seconds: 3.5}))
duration
fn (media: Media): Dec?
Get duration in seconds for audio/video. Returns null for images.
Example
seconds duration(audio-media) // 3.5
seconds duration(image-media) // null
has-duration
fn (media: Media): Bool
Check if media has a duration (audio or video).
image
fn (data: Image): Media
Create a Media.Image from Image data.
Example
media image(Image({file: file-meta, width: 1920, height: 1080}))
is-audio
fn (media: Media): Bool
Check if media is an Audio variant.
is-image
fn (media: Media): Bool
Check if media is an Image variant.
is-video
fn (media: Media): Bool
Check if media is a Video variant.
video
fn (data: Video): Media
Create a Media.Video from Video data.
Example
media video(Video({file: file-meta, width: 1920, height: 1080, fps: 30}))