Commit d91c004
committed
feat: add batch processing support for processing multiple files
Add comprehensive batch processing functionality to process multiple
accelerometer files from a folder in a single command.
Changes to src/accelerometer/accProcess.py:
- Add matchesExtension() to match file extensions with compression support
- Add discoverFiles() to discover files by extension with recursive option
- Add processSingleFile() extracted from main() for reusability
- Add processBatch() to orchestrate batch processing with error handling
- Add --fileExtensions argument (required for batch mode)
- Add --recursive argument for subdirectory search
- Refactor main() to detect and route file vs directory input
- Implement try-finally cleanup to ensure intermediate files deleted on error
- Catch SystemExit exceptions to prevent device.py sys.exit() from killing batch
- Detect duplicate basenames and exit with error to prevent data loss
- Exit with non-zero code when no files found or any files fail
- Respect --verbose flag for detailed error reporting in batch mode
- Remove unused atexit dependency (cleanup now in finally block)
Changes to README.md:
- Add batch processing usage section with examples
- Update output paths to reflect new outputs/{filename}/ structure
- Document --fileExtensions and --recursive options
- Explain compression format auto-detection
Key features:
- Serial processing with per-file error isolation
- Comprehensive batch summary with success/failure counts
- Exit codes: 255 for no files/duplicates, 1 for any failures
- Smart extension matching (case-insensitive, compression aware)
- Duplicate basename detection prevents output overwrites
- Backward compatible: single file mode unchanged1 parent 32d1958 commit d91c004
2 files changed
Lines changed: 469 additions & 114 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
41 | | - | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
61 | 92 | | |
62 | 93 | | |
63 | 94 | | |
| |||
0 commit comments