Route AppleScript chapter imports and make File > Optimize work on MKV
importFilesDirectly mirrors the open panel's extension dispatch, so AppleScript `import file` now sends .txt/.csv to addChapters/ updateChapters and everything else to FileImportController; the chapter track created on an MKV doc gets the tags-only trackId/ updateChangeCount bookkeeping in didSelect(chapters:). searchChapters moves to the always-valid validation group, though CLAUDE.md now records that it is orphaned dead code with no UI entry point. File > Optimize on a Matroska document forces writeMatroska's structural branch: a full remuxer rebuild from the existing tracks, the container-equivalent of atom-order optimize. Its validation uses fileURL instead of hasFileRepresentation, which is always false for tags-only models and kept the menu disabled forever. Bump MP42Foundation for the tagsOnly importer fix that mirrors the file's chapter atoms verbatim (offset first starts and tied zero starts survive an edit); harness matrix PASS=324/0. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
f457b4e89c
commit
06ecb0af5f
4 files changed
+46
-15
No files matched your search
+13
-2
@@ -339,7 +339,12 @@ final class Document: NSDocument {
|
||||
default: chaptersChanged = true
|
||||
}
|
||||
|
||||
if tracksChanged || chaptersChanged || saveOperation != .saveOperation {
|
||||
// `optimize` (Save and Optimize) forces the structural branch: the
|
||||
// Matroska equivalent of reordering atoms is rebuilding the whole file
|
||||
// — blocks stream-copied verbatim, Tracks/Tags rewritten, SeekHead and
|
||||
// Cues regenerated — i.e. exactly the Save-As pass, done in place
|
||||
// through the remuxer's temp file + atomic rename.
|
||||
if tracksChanged || chaptersChanged || optimize || saveOperation != .saveOperation {
|
||||
// An absent model track means "no chapters" — pass an empty
|
||||
// track so the remuxer removes the element rather than copying
|
||||
// the old one verbatim (nil replacement = verbatim).
|
||||
@@ -480,7 +485,13 @@ final class Document: NSDocument {
|
||||
return true
|
||||
case #selector(sendToQueue(_:)):
|
||||
return true
|
||||
case #selector(saveAndOptimize(_:)) where isDocumentEdited == false && mp4.hasFileRepresentation == true:
|
||||
// On a Matroska document optimize = full remuxer rebuild (see
|
||||
// writeMatroska), the container-equivalent of the atom-order optimize.
|
||||
// Tags-only models report hasFileRepresentation == false (their tracks
|
||||
// are never muxed), so the on-disk precondition there is just the
|
||||
// remux source: fileURL.
|
||||
case #selector(saveAndOptimize(_:)) where isDocumentEdited == false
|
||||
&& (isMatroska ? fileURL != nil : mp4.hasFileRepresentation == true):
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user