Mercurial > codedump
comparison copy-aac-fixup.py @ 136:da4f7200665f default tip
buncha shit
| author | Paper <paper@tflc.us> |
|---|---|
| date | Sat, 07 Mar 2026 18:04:10 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 135:0c3cd90e91f7 | 136:da4f7200665f |
|---|---|
| 1 #!/usr/bin/env python3 | |
| 2 import glob | |
| 3 import subprocess | |
| 4 import termios | |
| 5 | |
| 6 oldtty = termios.tcgetattr(0) | |
| 7 | |
| 8 # list of Popen classes to wait on | |
| 9 # this allows us to run metaflac independently on | |
| 10 # a huge list of files concurrently | |
| 11 processes = list() | |
| 12 | |
| 13 i = 1 | |
| 14 | |
| 15 # glob the files in order | |
| 16 files = glob.glob("*.aac") | |
| 17 files.sort() | |
| 18 for g in files: | |
| 19 processes.append(subprocess.Popen(["ffmpeg", "-i", g, "-c", "copy", "-metadata", "track=%d" % i, g + ".m4a"])) | |
| 20 i += 1 | |
| 21 | |
| 22 for p in processes: | |
| 23 p.wait() | |
| 24 | |
| 25 # ffmpeg fucks the terminal, restore it back | |
| 26 termios.tcsetattr(0, termios.TCSANOW, oldtty) |
