tonhowtf/omniget · error

os arquivos não tinham nenhuma escuta de música

Error message

os arquivos não tinham nenhuma escuta de música

What it means

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.

Solutions

  1. Verify the input files are the correct player history/database files that actually contain play records
  2. Check that the player has recorded plays (open the player's own history view) before running the tool
  3. Update the tool/parser if the player application version changed its history file format
  4. Ensure the file selection/options passed to the tool point at the right directories

Example fix

// before
let got = read_plays(&path); // parsed 0 records from wrong file
// after
let got = if path.is_player_history() { read_plays(&path) } else { Vec::new() }; // select real history file
Defensive patterns

Strategy: validation

Validate before calling

// Rust
if opts.input_files.iter().all(|f| !is_player_history(f)) {
    return Err(anyhow!("nenhum arquivo de histórico válido selecionado"));
}

Type guard

fn has_play_records(path: &Path) -> bool {
    read_plays(path).map(|p| !p.is_empty()).unwrap_or(false)
}

Try / catch

match run_history(opts) {
    Err(e) if e.to_string().contains("nenhuma escuta de música") => eprintln!("selecione arquivos de histórico do player válidos"),
    Err(e) => return Err(e),
    Ok(r) => println!("{} plays", r.plays.len()),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/277c874cf0a7800f. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/music/history.rs:771

    let mut plays = Vec::new();
    let mut files = Vec::new();
    for (i, (name, text)) in sources.iter().enumerate() {
        report(
            p,
            TOOL_ID,
            "progress",
            i as u64 + 1,
            Some(total),
            Some(name.clone()),
        );
        let mut got = parse_history(text, opts.min_ms);
        if !got.is_empty() {
            files.push(name.clone());
            plays.append(&mut got);
        }
    }
    if plays.is_empty() {
        anyhow::bail!("os arquivos não tinham nenhuma escuta de música");
    }
    plays.sort_by_key(|x| x.ts);

    let mut result = analyze(&plays, opts.top.max(1));
    result.files = files;
    if let Some(dir) = &opts.out_dir {
        if !dir.is_empty() {
            write_exports(&mut result, Path::new(dir), &opts.formats)?;
        }
    }
    report(p, TOOL_ID, "done", total, Some(total), None);
    Ok(result)
}

/// Conveniência para a UI: quantas horas um bloco representa.
pub fn ms_to_hours(ms: u64) -> f64 {
    hours(ms)
}

View on GitHub (pinned to 8600b91f42)