2020-05-22 22:20:11 +00:00
|
|
|
DOCKER_TAG ?= beets-dev
|
2020-11-18 18:49:16 +00:00
|
|
|
SOURCE_DIR ?= $(HOME)/Music/Incoming
|
|
|
|
TARGET_DIR ?= $(HOME)/Music/Library
|
2018-05-18 21:52:00 +00:00
|
|
|
BEET_CMD := BEETSDIR=. ./beets_env/bin/beet -d $(TARGET_DIR)
|
2018-04-24 16:46:45 +00:00
|
|
|
|
2020-05-22 22:20:11 +00:00
|
|
|
test:
|
|
|
|
echo $(SOURCE_DIR)
|
|
|
|
|
2018-04-24 16:46:45 +00:00
|
|
|
default: beets_env
|
|
|
|
|
2018-05-18 21:52:00 +00:00
|
|
|
# Creates virtualenv with beets
|
2018-04-24 16:46:45 +00:00
|
|
|
beets_env:
|
|
|
|
python3 -m venv beets_env
|
|
|
|
./beets_env/bin/pip install -U pip
|
|
|
|
./beets_env/bin/pip install -r ./requirements.txt
|
|
|
|
|
2018-05-18 21:52:00 +00:00
|
|
|
# Re-runs an import on the existing library
|
2018-04-24 16:46:45 +00:00
|
|
|
reimport: beets_env
|
2018-05-18 21:52:00 +00:00
|
|
|
$(BEET_CMD) import $(TARGET_DIR)
|
2018-04-24 16:46:45 +00:00
|
|
|
|
2018-05-18 21:52:00 +00:00
|
|
|
# Incrementally imports and copies from from source into target directory
|
2018-05-18 21:35:50 +00:00
|
|
|
import: beets_env
|
2018-05-18 21:52:00 +00:00
|
|
|
$(BEET_CMD) import -i -c $(SOURCE_DIR)
|
2018-05-18 21:35:50 +00:00
|
|
|
|
2019-06-29 01:03:23 +00:00
|
|
|
# List all duplicates
|
|
|
|
duplicates: beets_env
|
|
|
|
$(BEET_CMD) duplicates
|
|
|
|
|
2018-05-18 21:52:00 +00:00
|
|
|
# Launch beets web interface
|
2018-04-24 16:46:45 +00:00
|
|
|
web: beets_env
|
|
|
|
$(BEET_CMD) web
|
2018-05-18 21:52:00 +00:00
|
|
|
|
|
|
|
# Cleans environment and beets config
|
|
|
|
clean:
|
|
|
|
rm -fr ./beets_env ./import.log ./library.db ./state.pickle
|
2019-06-29 00:40:54 +00:00
|
|
|
|
|
|
|
docker-build:
|
|
|
|
docker build . -t $(DOCKER_TAG)
|
|
|
|
|
|
|
|
docker-import: docker-build
|
|
|
|
docker run --rm -it \
|
2020-11-18 18:49:16 +00:00
|
|
|
-v "$(shell pwd):/beets" \
|
|
|
|
-v "$(SOURCE_DIR):/import" \
|
|
|
|
-v "$(TARGET_DIR):/library" \
|
|
|
|
-p "9000:9000" \
|
2019-06-29 01:03:23 +00:00
|
|
|
$(DOCKER_TAG) \
|
|
|
|
-d /library \
|
2020-05-22 22:20:11 +00:00
|
|
|
import -i /import
|
2019-06-29 01:03:23 +00:00
|
|
|
|
|
|
|
docker-duplicates: docker-build
|
|
|
|
docker run --rm -it \
|
2020-11-18 18:49:16 +00:00
|
|
|
-v "$(shell pwd):/beets" \
|
|
|
|
-v "$(SOURCE_DIR):/import" \
|
|
|
|
-v "$(TARGET_DIR):/library" \
|
|
|
|
-p "9000:9000" \
|
2019-06-29 00:40:54 +00:00
|
|
|
$(DOCKER_TAG) \
|
2019-06-29 01:03:23 +00:00
|
|
|
-d /library \
|
|
|
|
duplicates
|