Skip to content

[FIX] Route parser notices through the message target - #2473

Open
harshalsp07 wants to merge 1 commit into
CCExtractor:masterfrom
harshalsp07:fix/webvtt-stdout-notice
Open

harshalsp07 wants to merge 1 commit into
CCExtractor:masterfrom
harshalsp07:fix/webvtt-stdout-notice

Conversation

@harshalsp07

@harshalsp07 harshalsp07 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

The WebVTT encoding notice goes into the subtitle stream when --stdout is used. Route it through messages_target along with the chapter, word-list, and binary-format notices. They go to stdout by default, stderr with --stdout, and nowhere with --quiet.

Reproduce with the existing SCC fixture. Sample

build/ccextractor tests/samples/scc_23_976.scc --webvtt --latin1 --stdout --no-bom > output.vtt

With the fix, output.vtt starts with WEBVTT and the UTF-8 notice appears on stderr. Add --quiet to suppress the notice.

The Rust unit test checks all three destinations. On Linux, all 24 WebVTT encoding cases passed. CLI checks also covered chapter notices, both word-file warnings, and the TCP input-format notice. Subtitle bytes matched master after accounting for the misplaced notices.

@cfsmp3 cfsmp3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Carlos' claude doing the first pass. Before Carlos takes a look, please address these issues.

The problem is real: with --stdout, the notice ends up in the subtitle stream.

  1. Follow messages_target instead of always using stderr. The parser already tracks where messages go: Stdout by default, Stderr with --stdout (parser.rs ~1012), Quiet with --quiet. Please print according to that (stdout, stderr or nothing) rather than hardcoding eprintln!, so this notice goes to the same place as every other message in the run.

  2. Other parse-time notices have the same bug. These also use println! and land in the subtitles with --stdout:

    • process_word_file(): "Word in line {num} too long…" (--capfile / --profanity-file with --stdout)
    • "Request to extract chapters recieved." and the two lines after it (--chapters)
    • "Output format is changed to bin" / "Input format is changed to bin"

    Please route them the same way, so --stdout output only ever contains subtitles. A small helper that prints according to messages_target would cover all of them.

  3. Please remove the CTest/Python additions (src/CMakeLists.txt block, tests/test_cli_webvtt_stdout.py, tests/samples/cli_output.scc). Nothing defines BUILD_TESTING (no include(CTest) / enable_testing()), and CI doesn't run ctest, so none of it ever runs. A Rust unit test on the helper is enough.

@harshalsp07
harshalsp07 force-pushed the fix/webvtt-stdout-notice branch from 98071aa to a7fd3de Compare November 23, 2026 17:12
@harshalsp07 harshalsp07 changed the title [FIX] Keep the WebVTT encoding notice out of stdout [FIX] Route parser notices through the message target Nov 23, 2026
@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on windows. 90/238 tests matched the approved output:
Report Name Tests Passed
Broken 0/13
CEA-708 2/14
DVB 0/7
DVD 3/3
DVR-MS 0/2
General 1/28
Hardsubx 1/1
Hauppage 0/3
MP4 0/3
NoCC 10/10
Options 68/86
Teletext 0/21
WTV 0/13
XDS 5/34

148 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.


Compared with the tip of master — test 10101, commit 81bc1d0:

  • 81 pass there and fail here
  • 0 fail there and pass here
  • 29 fail on both, with different output
  • 38 fail on both, byte for byte the same

Pass there, fail here:

Fail on both but produce different output — behaviour moved even though the verdict did not:


Compared with the commit this branch was cut from: the same run as the tip of master (test 10101), so the comparison above already covers it.


This branch changes the behaviour of 110 test(s) relative to the tip of master. Those are the ones worth looking at; anything else in the list fails the same way on both sides.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on linux. 171/238 tests matched the approved output:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 0/7
DVD 3/3
DVR-MS 2/2
General 26/28
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 68/86
Teletext 0/21
WTV 12/13
XDS 32/34

67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.


Compared with the tip of master — test 10106, commit 7f5fe41:

  • 0 pass there and fail here
  • 1 fail there and pass here
  • 0 fail on both, with different output
  • 67 fail on both, byte for byte the same

Fail there, pass here:

  • ccextractor --out=sami --latin1 --autoprogram --no-goptime 5b4e0a6034...

Compared with the commit this branch was cut from — test 10110, commit 31264a1:

  • 0 pass there and fail here
  • 27 fail there and pass here
  • 7 fail on both, with different output
  • 60 fail on both, byte for byte the same

Fail on both but produce different output — behaviour moved even though the verdict did not:

Fail there, pass here:


No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch.

@harshalsp07
harshalsp07 force-pushed the fix/webvtt-stdout-notice branch from a7fd3de to e54ea3a Compare November 24, 2026 04:14
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.

3 participants