Skip to content

feat: expose attachment size on MKVAttachment - #132

Merged
GitBib merged 1 commit into
masterfrom
feat/attachment-size
Aug 2, 2026
Merged

feat: expose attachment size on MKVAttachment#132
GitBib merged 1 commit into
masterfrom
feat/attachment-size

Conversation

@GitBib

@GitBib GitBib commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Closes #124.

size comes from the mkvmerge JSON, never from file_path: for an attachment read out of an MKV, file_path points at the container, so a filesystem size would report the whole MKV instead of the payload. It is None for an attachment built from a local path.

Two related fixes the property exposed:

  • Repointing an attachment that was read from a file now raises. AttachmentOptions skips anything still carrying a source id, so mkv.attachments[0].file_path = "other.txt" used to drop the new file from the mux and keep the old embedded payload, with no error. Replacing an attachment is remove_attachment plus add_attachment. A local attachment can still be repointed.
  • AttachmentInfo.size is int | None. mkvmerge refuses to attach an empty file, so no real attachment is 0 bytes and the old default turned a missing field into a plausible measurement.

@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.27%. Comparing base (acf00ae) to head (acbaae2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #132      +/-   ##
==========================================
+ Coverage   99.12%   99.27%   +0.14%     
==========================================
  Files          21       21              
  Lines        1487     1508      +21     
==========================================
+ Hits         1474     1497      +23     
+ Misses         13       11       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Closes #124.

size comes from the mkvmerge JSON, never from file_path: for an
attachment read out of an MKV, file_path points at the container, so a
filesystem size would report the whole MKV instead of the payload. It is
None for an attachment built from a local path, and stays None after
mux() — the object is not refreshed from the output.

Repointing an attachment that was read from a file now raises.
AttachmentOptions skips anything still carrying a source id, so
assigning a new file_path used to drop the replacement from the mux and
keep the old embedded payload with no error. Replacing an attachment is
remove_attachment plus add_attachment. A local attachment can still be
repointed, and naming the same file again — in any spelling, and even
once the container is gone — stays a no-op.

AttachmentInfo.size becomes int | None. The identification schema marks
size required with minimum 0, so 0 is a legal value and the old default
made a missing field indistinguishable from a real measurement.
@GitBib
GitBib force-pushed the feat/attachment-size branch from ceeefa6 to acbaae2 Compare August 2, 2026 16:11
@GitBib
GitBib merged commit 6c6e2e7 into master Aug 2, 2026
25 checks passed
@GitBib
GitBib deleted the feat/attachment-size branch August 2, 2026 16:15
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.

Add attachment size property to MKVAttachment

1 participant