Fix #737: ffprobe metadata extraction returns empty (codec/bitrate/duration)#742
Open
Paelsmoessan wants to merge 1 commit into
Open
Fix #737: ffprobe metadata extraction returns empty (codec/bitrate/duration)#742Paelsmoessan wants to merge 1 commit into
Paelsmoessan wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
FfprobeMetadataMapperparses ffprobe's dot-decimalformat.durationwith a culture-lessdouble.TryParse, so on a comma-decimal locale it fails andDurationSecondsends up 0 for every file.2. Log redaction corrupts the probe output.
SystemProcessRunnerruns process stdout throughLogRedaction.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>, soJsonSerializer.Deserializethrows "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
InvariantCulture.RedactText— real secret values are still redacted by the value-replacement pass; nothing is appended when nothing matched.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