my-beets/Makefile

41 lines
974 B
Makefile

DOCKER_TAG := beets-dev-${USER}
SOURCE_DIR := ~/Music/Incoming
TARGET_DIR := ~/Music/Library
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
docker-build:
docker build . -t $(DOCKER_TAG)
docker-import: docker-build
docker run --rm -it \
-v $(shell pwd):/beets \
-v $(SOURCE_DIR):/source \
-v $(TARGET_DIR):/target \
$(DOCKER_TAG) \
-d /target \
import -i -c /source