{"record":{"id":"277c874cf0a7800f","repo":"tonhowtf/omniget","slug":"os-arquivos-n-o-tinham-nenhuma-escuta-de-m-sica","errorCode":null,"errorMessage":"os arquivos não tinham nenhuma escuta de música","messagePattern":"os arquivos não tinham nenhuma escuta de música","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/music/history.rs","lineNumber":771,"sourceCode":"    let mut plays = Vec::new();\n    let mut files = Vec::new();\n    for (i, (name, text)) in sources.iter().enumerate() {\n        report(\n            p,\n            TOOL_ID,\n            \"progress\",\n            i as u64 + 1,\n            Some(total),\n            Some(name.clone()),\n        );\n        let mut got = parse_history(text, opts.min_ms);\n        if !got.is_empty() {\n            files.push(name.clone());\n            plays.append(&mut got);\n        }\n    }\n    if plays.is_empty() {\n        anyhow::bail!(\"os arquivos não tinham nenhuma escuta de música\");\n    }\n    plays.sort_by_key(|x| x.ts);\n\n    let mut result = analyze(&plays, opts.top.max(1));\n    result.files = files;\n    if let Some(dir) = &opts.out_dir {\n        if !dir.is_empty() {\n            write_exports(&mut result, Path::new(dir), &opts.formats)?;\n        }\n    }\n    report(p, TOOL_ID, \"done\", total, Some(total), None);\n    Ok(result)\n}\n\n/// Conveniência para a UI: quantas horas um bloco representa.\npub fn ms_to_hours(ms: u64) -> f64 {\n    hours(ms)\n}","sourceCodeStart":753,"sourceCodeEnd":789,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/music/history.rs#L753-L789","documentation":"The music history tool aggregates play events from user-selected audio files. After scanning all configured files it found zero play records, so any analysis would be meaningless. The library bails with this Portuguese message instead of producing an empty report.","triggerScenarios":"Calling the history analysis tool when none of the collected input files contained recognizable play/scrobble records — e.g. files with no playback metadata, wrong file types, or formats the parser does not recognize.","commonSituations":"Pointing the tool at freshly created or wiped player databases; selecting text/playlist files instead of player library files; a player version change that altered the history file schema so the parser reads zero plays.","solutions":["Verify the input files are the correct player history/database files that actually contain play records","Check that the player has recorded plays (open the player's own history view) before running the tool","Update the tool/parser if the player application version changed its history file format","Ensure the file selection/options passed to the tool point at the right directories"],"exampleFix":"// before\nlet got = read_plays(&path); // parsed 0 records from wrong file\n// after\nlet got = if path.is_player_history() { read_plays(&path) } else { Vec::new() }; // select real history file","handlingStrategy":"validation","validationCode":"// Rust\nif opts.input_files.iter().all(|f| !is_player_history(f)) {\n    return Err(anyhow!(\"nenhum arquivo de histórico válido selecionado\"));\n}","typeGuard":"fn has_play_records(path: &Path) -> bool {\n    read_plays(path).map(|p| !p.is_empty()).unwrap_or(false)\n}","tryCatchPattern":"match run_history(opts) {\n    Err(e) if e.to_string().contains(\"nenhuma escuta de música\") => eprintln!(\"selecione arquivos de histórico do player válidos\"),\n    Err(e) => return Err(e),\n    Ok(r) => println!(\"{} plays\", r.plays.len()),\n}","preventionTips":["Point the tool at verified player history files with existing plays","Dry-run the file parsing before full analysis","Keep the player version and tool parser version in sync"],"tags":["music","empty-result","input-validation"],"backgroundTag":"empty-result-set","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}