feat: expose attachment size on MKVAttachment - #132
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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
force-pushed
the
feat/attachment-size
branch
from
August 2, 2026 16:11
ceeefa6 to
acbaae2
Compare
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.
Closes #124.
sizecomes from the mkvmerge JSON, never fromfile_path: for an attachment read out of an MKV,file_pathpoints at the container, so a filesystem size would report the whole MKV instead of the payload. It isNonefor an attachment built from a local path.Two related fixes the property exposed:
AttachmentOptionsskips anything still carrying a source id, somkv.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 isremove_attachmentplusadd_attachment. A local attachment can still be repointed.AttachmentInfo.sizeisint | 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.