[PR #1848] fix(xds): Don't output empty XDS content entries #2610

Closed
opened 2026-01-29 17:23:04 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1848

State: closed
Merged: Yes


Summary

  • Fix duplicate empty XDS entries in transcript output when US TV Parental Guidelines are extracted
  • Only output the content flags (violence, language, etc.) if they are not empty
  • This affects files with TV-G or other ratings that have no additional content advisories

Root Cause

When outputting ContentAdvisory XDS data, the code always called xdsprint() for both:

  1. The age rating (e.g., "TV-G (General Audience)")
  2. The content flags (e.g., "[Violence] [Language]")

However, if there are no content flags (like for TV-G), the content string was empty, causing an empty duplicate XDS entry to be written.

Changes

  • Added if (content[0]) check before outputting the content string
  • Also added the check for the log and debug output calls

Test plan

  • Verified locally with sample b992e0cccb (test 113)
  • Before fix: 224 XDS entries (112 content + 112 empty duplicates)
  • After fix: 112 XDS entries (all content, no duplicates)

Fixes regression test 113 (XDS output mismatch).

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1848 **State:** closed **Merged:** Yes --- ## Summary - Fix duplicate empty XDS entries in transcript output when US TV Parental Guidelines are extracted - Only output the content flags (violence, language, etc.) if they are not empty - This affects files with TV-G or other ratings that have no additional content advisories ## Root Cause When outputting ContentAdvisory XDS data, the code always called `xdsprint()` for both: 1. The age rating (e.g., "TV-G (General Audience)") 2. The content flags (e.g., "[Violence] [Language]") However, if there are no content flags (like for TV-G), the content string was empty, causing an empty duplicate XDS entry to be written. ## Changes - Added `if (content[0])` check before outputting the content string - Also added the check for the log and debug output calls ## Test plan - [x] Verified locally with sample b992e0cccb (test 113) - [x] Before fix: 224 XDS entries (112 content + 112 empty duplicates) - [x] After fix: 112 XDS entries (all content, no duplicates) Fixes regression test 113 (XDS output mismatch). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claunia added the pull-request label 2026-01-29 17:23:04 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2610