Spaces:
Sleeping
Sleeping
Download scripts/extract_debug_audio.py from jasonmdong/notepilot: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/jasonmdong/notepilot/resolve/main/scripts/extract_debug_audio.py
- Command line
-
hf download hf://spaces/jasonmdong/notepilot/scripts/extract_debug_audio.py
-
curl -L -o extract_debug_audio.py https://huggingface.co/spaces/jasonmdong/notepilot/resolve/main/scripts/extract_debug_audio.py
1.02 kB
| #!/usr/bin/env python3 | |
| """Extract embedded compressed recordings from one NotePilot debug bundle.""" | |
| import base64 | |
| import json | |
| import sys | |
| from pathlib import Path | |
| def main() -> int: | |
| if len(sys.argv) != 3: | |
| print('usage: extract_debug_audio.py bundle.json output-directory', file=sys.stderr) | |
| return 2 | |
| bundle = json.loads(Path(sys.argv[1]).read_text()) | |
| out = Path(sys.argv[2]); out.mkdir(parents=True, exist_ok=True) | |
| audio = bundle.get('audio', {}) | |
| count = 0 | |
| for key, filename in (('microphone', 'mic.webm'), ('digitalOutput', 'output.webm')): | |
| entry = audio.get(key, {}) | |
| encoded = entry.get('base64') | |
| if not encoded: | |
| continue | |
| data = base64.b64decode(encoded, validate=True) | |
| (out / filename).write_bytes(data) | |
| print(out / filename) | |
| count += 1 | |
| if not count: | |
| print('no embedded compressed audio found', file=sys.stderr) | |
| return 1 | |
| return 0 | |
| if __name__ == '__main__': | |
| raise SystemExit(main()) | |