diff --git a/Makefile b/Makefile index 121c05c..c196d9b 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,19 @@ extract: @if [ -x $(PY) ]; then $(PY) extract.py; else python3 extract.py; fi ast: + @AUDIO_A=$$(python3 -c "import tomllib; c=tomllib.load(open('config.toml','rb')); print(c['extract'].get('file_a',''))" 2>/dev/null); \ + AUDIO_B=$$(python3 -c "import tomllib; c=tomllib.load(open('config.toml','rb')); print(c['extract'].get('file_b',''))" 2>/dev/null); \ + OUT=$$(python3 -c "import tomllib; c=tomllib.load(open('config.toml','rb')); print(c['extract'].get('out_dir','extracted'))" 2>/dev/null); \ + STEM_A=$$(basename "$$AUDIO_A" | sed 's/\.[^.]*$$//'); \ + STEM_B=$$(basename "$$AUDIO_B" | sed 's/\.[^.]*$$//'); \ + NEED_EXTRACT=0; \ + if [ ! -f "$$OUT/$${STEM_A}_audio.wav" ] || [ ! -f "$$OUT/$${STEM_B}_audio.wav" ]; then NEED_EXTRACT=1; fi; \ + if [ $$NEED_EXTRACT -eq 1 ]; then \ + echo "=> extracted wavs not found, running make extract first..."; \ + $(MAKE) extract; \ + else \ + echo "=> extracted wavs exist ($$OUT/$${STEM_A}_audio.wav, $$OUT/$${STEM_B}_audio.wav), skipping extract"; \ + fi @if [ -x $(PY) ]; then $(PY) sync_audio_test.py --config $(CONFIG); else python3 sync_audio_test.py --config $(CONFIG); fi clean: