diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ebee749 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +default: + virtualenv venv && source venv/bin/activate && pip install -r requirements.txt + +run: + source venv/bin/activate && ./slice.py ${DIR} diff --git a/README.md b/README.md new file mode 100644 index 0000000..88b5db0 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +run `make` to install it, then do `make DIR=/wherever/your/files/are/ run` to +run it diff --git a/slice.py b/slice.py index d455cd3..984359c 100755 --- a/slice.py +++ b/slice.py @@ -48,14 +48,16 @@ def silence(infile): convert(infile) def silence_all(): - local("mkdir -p ./shortened") - fileset = local("ls .", capture=True).split("\n") - shuffle(fileset) - for f in fileset: - if f.split(".")[-1] in ["ogg", "opus", "m4a", "mp3"]: - try: - silence(f) - except Exception: - pass + with lcd(argv[1]): + local("mkdir -p ./shortened") + fileset = local("ls .", capture=True).split("\n") + shuffle(fileset) + for f in fileset: + if f.split(".")[-1] in ["ogg", "opus", "m4a", "mp3"]: + try: + silence(f) + local("rm -f /tmp/*wav") + except Exception: + pass silence_all()