Created
April 4, 2018 19:44
-
-
Save bddap/e586fa26138c83e7fa5bd211a9a3ca58 to your computer and use it in GitHub Desktop.
sfs_cat_audio.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from os import listdir, mkdir, path | |
from subprocess import run | |
import json | |
songfiles = list(listdir('songs')) | |
if not path.exists('songs2'): | |
mkdir('songs2') | |
def catmp3(srcs, dest): | |
run(["sox", *srcs, dest]) | |
def songs_for(q): | |
return sorted(['./songs/' + file for file in songfiles if file.startswith(q)]) | |
qs = ["Q" + str(q).zfill(2) for q in range(1, 53)] | |
for q in qs: | |
s = songs_for(q) | |
print(q, s) | |
catmp3(s, './songs2/' + q + ".mp3") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment