#![forbid(unsafe_code)]
use std::path::{Path, PathBuf};
use thiserror::Error as ThisError;
pub mod bundle;
pub mod convert;
pub mod detect;
pub mod hash;
pub mod manifest;
pub mod mirror;
pub mod pipeline;
pub mod report;
#[cfg(unix)]
pub mod runner;
pub mod segments;
pub mod walk;
#[cfg(unix)]
pub use runner::protocol::bodies as runner_bodies;
#[cfg(not(unix))]
pub mod runner_bodies {
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AsrSegment {
pub start_seconds: f64,
pub end_seconds: f64,
pub speaker: u32,
pub text: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ScreenState {
pub first_seen_seconds: f64,
pub text: String,
}
}
#[derive(Debug, ThisError)]
pub enum Error {
#[error("{op} {path}: {source}")]
Io {
op: &'static str,
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("rules file {name}: {message}")]
Rules {
name: String,
message: String,
},
#[error("manifest {path} line {line}: {message}")]
Manifest {
path: PathBuf,
line: usize,
message: String,
},
#[error("encode manifest record for {path}: {message}")]
Encode {
path: PathBuf,
message: String,
},
#[error("invalid division name {name:?}: use ASCII letters, digits, hyphen, underscore")]
Division {
name: String,
},
#[error("invalid layout: {message}")]
Layout {
message: String,
},
#[error("{verb} refused: {}", problems.join("; "))]
Refused {
verb: &'static str,
problems: Vec<String>,
},
}
impl Error {
pub(crate) fn io(op: &'static str, path: &Path, source: std::io::Error) -> Self {
Error::Io {
op,
path: path.to_path_buf(),
source,
}
}
}
pub type Result<T> = std::result::Result<T, Error>;