Skip to content

Fix #737: ffprobe metadata extraction returns empty (codec/bitrate/duration)#742

Open
Paelsmoessan wants to merge 1 commit into
Listenarrs:canaryfrom
Paelsmoessan:fix/737-clean
Open

Fix #737: ffprobe metadata extraction returns empty (codec/bitrate/duration)#742
Paelsmoessan wants to merge 1 commit into
Listenarrs:canaryfrom
Paelsmoessan:fix/737-clean

Conversation

@Paelsmoessan

Copy link
Copy Markdown

The bug

ffprobe metadata extraction returns empty for every file, so codec/bitrate are null and duration is stored as 0. Two independent causes:

1. Culture-sensitive duration parse. FfprobeMetadataMapper parses ffprobe's dot-decimal format.duration with a culture-less double.TryParse, so on a comma-decimal locale it fails and DurationSeconds ends up 0 for every file.

2. Log redaction corrupts the probe output. SystemProcessRunner runs process stdout through LogRedaction.RedactText, which appends a " <redacted>" marker whenever any sensitive env var (e.g. LISTENARR_API_KEY) is set — even when no secret is present. That turns valid ffprobe JSON into {...} <redacted>, so JsonSerializer.Deserialize throws "Failed to parse ffprobe JSON output" while ffprobe itself exits 0, and a null-metadata fallback is persisted. (Bites anyone with an API key configured.)

The fix

  • Parse duration + the other numeric fields with InvariantCulture.
  • Drop the append-marker fallback in RedactText — real secret values are still redacted by the value-replacement pass; nothing is appended when nothing matched.
  • Regression test that parses a dot-decimal duration under a comma-decimal culture (fails without the fix even on dot-decimal CI).

3 files, +53/-11.

Why it matters beyond the bug

Trustworthy per-file codec/bitrate/duration is the groundwork the quality-filter logic (#582) and the recycling bin (#736) both stand on — safely deciding or performing a quality upgrade isn't really possible without it. This just makes that data correct.

Closes #737

…bitrate/duration)

Two independent bugs broke ffprobe metadata extraction:

1. Culture-sensitive duration parse. FfprobeMetadataMapper parsed ffprobe's
   dot-decimal format.duration with a culture-less double.TryParse, so on a
   comma-decimal locale it failed and DurationSeconds was stored as 0 for every
   file. Parse with InvariantCulture (and harden the other numeric fields).

2. Log redaction corrupted the probe output. SystemProcessRunner runs process
   stdout through LogRedaction.RedactText, which appended a " <redacted>" marker
   whenever any sensitive env var (e.g. LISTENARR_API_KEY) was set, even when no
   secret appeared in the output. That turned valid ffprobe JSON into
   "{...} <redacted>", so Deserialize threw "Failed to parse ffprobe JSON output"
   while ffprobe itself exited 0, and a null-metadata fallback was persisted.
   Remove the append-marker fallback; real secret values are still redacted by the
   value-replacement pass.

Adds a regression test that parses a dot-decimal duration under a comma-decimal
culture (fails without the fix even on dot-decimal CI).

Closes Listenarrs#737

Related: reliable per-file codec/bitrate/duration is the quality data that Listenarrs#582
(quality-filter / upgrade-and-replace logic) needs to decide upgrades, and that
Listenarrs#736 (recycling bin) needs to replace or delete files safely. Together these make
quality upgrades safe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Paelsmoessan Paelsmoessan requested a review from a team July 7, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Download-imported audiobooks missing codec/bitrate/duration (probe empty at import time)

1 participant