{"record":{"id":"4e143accecee9c1b","repo":"tonhowtf/omniget","slug":"legenda-n-o-encontrada-burn","errorCode":null,"errorMessage":"legenda não encontrada: {}","messagePattern":"legenda não encontrada: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/bilibili/danmaku/burn.rs","lineNumber":81,"sourceCode":"pub struct BurnResult {\n    pub output: String,\n    pub bytes: u64,\n    pub duration_secs: f64,\n    /// Quantos comentários sobraram dentro da janela.\n    pub dialogues: usize,\n    /// 0 quando a codificação foi por CRF.\n    pub video_kbps: u32,\n    pub audio_kbps: u32,\n}\n\npub async fn run(opts: &BurnOptions, progress: &ProgressFn) -> Result<BurnResult> {\n    let video = PathBuf::from(opts.video.trim());\n    if !video.is_file() {\n        return Err(anyhow!(\"vídeo não encontrado: {}\", opts.video));\n    }\n    let sub = PathBuf::from(opts.subtitle.trim());\n    if !sub.is_file() {\n        return Err(anyhow!(\"legenda não encontrada: {}\", opts.subtitle));\n    }\n    let ffmpeg = omniget_core::core::dependencies::ensure_ffmpeg().await?;\n\n    report(\n        progress,\n        ID,\n        \"progress\",\n        0,\n        Some(3),\n        Some(\"lendo o vídeo\".into()),\n    );\n    let probe = omniget_core::core::ffmpeg::probe(&video).await?;\n    let has_audio = probe.streams.iter().any(|s| s.codec_type == \"audio\");\n    let start = opts.start.max(0.0);\n    let window = if opts.duration > 0.0 {\n        opts.duration\n    } else {\n        (probe.duration_seconds - start).max(0.0)","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/bilibili/danmaku/burn.rs#L63-L99","documentation":"run() validates that the subtitle/danmaku file (opts.subtitle) exists as a regular file after trimming. If missing, it throws 'legenda não encontrada: <path>'. The subtitle is the second required input for burning danmaku comments into the video.","triggerScenarios":"Calling burn::run with BurnOptions.subtitle pointing to a non-existent, empty-string, or deleted subtitle file (e.g. the danmaku export step of export.rs never ran or wrote to a different path).","commonSituations":"Danmaku export was skipped or failed; subtitle written to a temp dir that was cleaned; mismatch between export output path and burn input path; video has no comments so no subtitle was produced.","solutions":["Verify the subtitle file exists with std::path::Path::is_file() before calling run","Run the danmaku export stage first and thread its actual output path into BurnOptions.subtitle","Handle the no-comments case explicitly (empty danmaku) instead of passing a missing file path"],"exampleFix":"// before\nburn::run(&BurnOptions { subtitle: \"danmaku.ass\".into(), ..opts })\n// after\nlet sub = \"danmaku.ass\";\nanyhow::ensure!(\n    std::path::Path::new(sub).is_file(),\n    \"legenda ausente: {} — exporte os comentários antes de gravar\",\n    sub\n);\nburn::run(&BurnOptions { subtitle: sub.into(), ..opts })","handlingStrategy":"validation","validationCode":"fn ensure_subtitle(path: &str) -> Result<(), String> {\n    if std::path::Path::new(path.trim()).is_file() { Ok(()) }\n    else { Err(format!(\"legenda não encontrada: {}\", path)) }\n}","typeGuard":"fn has_subtitle(opts: &BurnOptions) -> bool {\n    !opts.subtitle.trim().is_empty() && std::path::Path::new(opts.subtitle.trim()).is_file()\n}","tryCatchPattern":"match burn::run(&opts, &progress).await {\n    Err(e) if e.to_string().starts_with(\"legenda não encontrada\") => skip_burn_or_reexport_danmaku(&opts),\n    Err(e) => propagate(e)?,\n    Ok(res) => use_result(res),\n}","preventionTips":["Always run the danmaku export stage before burn and use its returned path","Skip the burn step when the video has no comments (no subtitle produced)","Avoid hard-coded subtitle paths; derive them from the video filename"],"tags":["file-not-found","validation","subtitle"],"backgroundTag":"file-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}