Compare commits
2 commits
4da84d4012
...
05d545927a
Author | SHA1 | Date | |
---|---|---|---|
05d545927a | |||
ba71d9ad30 |
2 changed files with 42 additions and 0 deletions
4
manifest.scm
Normal file
4
manifest.scm
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
(packages->manifest
|
||||||
|
(list
|
||||||
|
(specification->package "python")
|
||||||
|
(specification->package "python-invoke")))
|
38
tasks.py
Normal file
38
tasks.py
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
from invoke import task
|
||||||
|
from shutil import rmtree, unpack_archive
|
||||||
|
from os import mkdir
|
||||||
|
from os.path import isdir, basename
|
||||||
|
from glob import glob
|
||||||
|
from itertools import chain
|
||||||
|
from shlex import quote
|
||||||
|
|
||||||
|
PREP = "assets"
|
||||||
|
OUTPUT = "output"
|
||||||
|
|
||||||
|
MUSIC_GLOBS = ["*.flac", "*.mp3", "*.ogg", "*.opus", "*.aac"]
|
||||||
|
|
||||||
|
@task
|
||||||
|
def clean(c):
|
||||||
|
dirs = [dir for dir in [PREP] if isdir(dir)]
|
||||||
|
for dir in dirs:
|
||||||
|
print(f"Removing {dir}")
|
||||||
|
rmtree(dir)
|
||||||
|
|
||||||
|
@task
|
||||||
|
def unpack(c):
|
||||||
|
zipfiles = glob("src/*.zip")
|
||||||
|
if not isdir(PREP):
|
||||||
|
mkdir(PREP)
|
||||||
|
for zipfile in zipfiles:
|
||||||
|
unpack_archive(zipfile, PREP)
|
||||||
|
|
||||||
|
@task(unpack)
|
||||||
|
def probe(c):
|
||||||
|
if not isdir(OUTPUT):
|
||||||
|
mkdir(OUTPUT)
|
||||||
|
music_list = list(chain.from_iterable([glob(f"{PREP}/{pat}") for pat in MUSIC_GLOBS]))
|
||||||
|
for m in music_list:
|
||||||
|
cmd = f"ffprobe -v quiet -print_format json -show_format {quote(m)}"
|
||||||
|
result = c.run(cmd)
|
||||||
|
with open(f"{OUTPUT}/{basename(m)}.json", 'w') as f:
|
||||||
|
f.write(result.stdout)
|
Loading…
Reference in a new issue