my-beets/Makefile

62 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

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
2024-01-18 18:38:43 +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
# 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
# Re-runs an import on the existing library
2018-04-24 16:46:45 +00:00
reimport: beets_env
2024-01-18 18:38:43 +00:00
$(BEET_CMD) import "$(TARGET_DIR)"
reimport-select: beets_env
$(BEET_CMD) import "$(SOURCE_DIR)"
2018-04-24 16:46:45 +00:00
# Incrementally imports and copies from from source into target directory
2018-05-18 21:35:50 +00:00
import: beets_env
2024-01-18 18:38:43 +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
# Launch beets web interface
2018-04-24 16:46:45 +00:00
web: beets_env
$(BEET_CMD) web
# 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" \
2020-11-18 18:52:38 +00:00
-p "9999:9999" \
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