SOURCE_DIR := ~/Music/Music_Raw
TARGET_DIR := ~/Music/Music
BEET_CMD := BEETSDIR=. ./beets_env/bin/beet -d $(TARGET_DIR)

default: beets_env

# Creates virtualenv with beets
beets_env:
	python3 -m venv beets_env
	./beets_env/bin/pip install -U pip
	./beets_env/bin/pip install -r ./requirements.txt

# Re-runs an import on the existing library
reimport: beets_env
	$(BEET_CMD) import $(TARGET_DIR)

# Incrementally imports and copies from from source into target directory
import: beets_env
	$(BEET_CMD) import -i -c $(SOURCE_DIR)

# Launch beets web interface
web: beets_env
	$(BEET_CMD) web

# Cleans environment and beets config
clean:
	rm -fr ./beets_env ./import.log ./library.db ./state.pickle