mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-10-01 17:29:29 +05:30
feat(media): add batch folder mode to Image/Audio/Video Tools dialog
Reviewer follow-up on Task 12: the task's own title/brief called for
batch support and no later task in the plan picks it up, so this closes
that gap. Adds a "Single File" / "Batch Folder" mode toggle to the
existing media-operations-dialog.js; batch mode swaps the per-file
input/output fields for an Input Folder + "Include subfolders" +
Output Folder trio while keeping every other parameter (width/height/
quality/angle/startTime/duration/crf/fps/format/fit) applied uniformly
to every matching file. Disabled for audio "Merge", which combines many
inputs into one output and doesn't fit a per-file batch model.
main.js: adds collectFilesByExtension() (src/main/collectFilesByExtension.js,
unit tested), a generalization of the inline collectFiles() closure inside
ipcMain.on('universal-convert-batch', ...) to match a set of extensions
instead of one format. runMediaBatchOperation() loops
ImageOperations/AudioOperations/VideoOperations.executeOperation() over
the matched files, reporting per-file progress via new
'media-batch-progress' events and a final 'media-batch-complete' event,
then shows a "Batch Conversion Complete" dialog.showMessageBox with
completed/failed counts, mirroring performBatchConversion()'s pattern.
Wired via three new ipcMain.on handlers: batch-image-operation,
batch-audio-operation, batch-video-operation.
preload.js: whitelists the three new send channels and the two new
receive channels (media-batch-progress, media-batch-complete).
This commit is contained in:
@@ -47,12 +47,15 @@ const ALLOWED_SEND_CHANNELS = [
|
||||
// Image converter
|
||||
'process-image-operation',
|
||||
'select-image-folder',
|
||||
'batch-image-operation',
|
||||
|
||||
// Audio converter
|
||||
'process-audio-operation',
|
||||
'batch-audio-operation',
|
||||
|
||||
// Video converter
|
||||
'process-video-operation',
|
||||
'batch-video-operation',
|
||||
|
||||
// Header/Footer
|
||||
'get-header-footer-settings',
|
||||
@@ -190,6 +193,10 @@ const ALLOWED_RECEIVE_CHANNELS = [
|
||||
'audio-conversion-complete',
|
||||
'video-conversion-complete',
|
||||
|
||||
// Batch media operations (Image/Audio/Video Tools dialog batch mode)
|
||||
'media-batch-progress',
|
||||
'media-batch-complete',
|
||||
|
||||
// Folder selection
|
||||
'folder-selected',
|
||||
'pdf-folder-selected',
|
||||
|
||||
Reference in New Issue
Block a user