my-beets/Makefile

62 lines
1.3 KiB
Makefile

DOCKER_TAG ?= beets-dev
SOURCE_DIR ?= $(HOME)/Music/Incoming
TARGET_DIR ?= $(HOME)/Music/Library
BEET_CMD := BEETSDIR=. ./beets_env/bin/beet -d "$(TARGET_DIR)"
test:
echo $(SOURCE_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)"
reimport-select: beets_env
$(BEET_CMD) import "$(SOURCE_DIR)"
# Incrementally imports and copies from from source into target directory
import: beets_env
$(BEET_CMD) import -i -c "$(SOURCE_DIR)"
# List all duplicates
duplicates: beets_env
$(BEET_CMD) duplicates
# 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):/import" \
-v "$(TARGET_DIR):/library" \
-p "9999:9999" \
$(DOCKER_TAG) \
-d /library \
import -i /import
docker-duplicates: docker-build
docker run --rm -it \
-v "$(shell pwd):/beets" \
-v "$(SOURCE_DIR):/import" \
-v "$(TARGET_DIR):/library" \
-p "9000:9000" \
$(DOCKER_TAG) \
-d /library \
duplicates