Skip to content

Commit

Permalink
feat: enable edit and play plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoltzsche committed Nov 13, 2023
1 parent d6a880f commit 04c34f9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM python:3-alpine3.18
RUN apk add --update --no-cache cargo g++ openblas-dev ffmpeg flac py3-gst gst-plugins-good gst-plugins-bad chromaprint jq recode
RUN apk add --update --no-cache cargo g++ openblas-dev ffmpeg flac py3-gst gst-plugins-good gst-plugins-bad chromaprint jq recode mpv
RUN python3 -m pip install \
beets==1.6.0 \
flask==2.1.2 \
Expand All @@ -22,7 +22,9 @@ RUN set -eux; \
chown beets:beets /data
COPY config.yaml /etc/beets/default-config.yaml
COPY entrypoint.sh /
ENV BEETSDIR=/data/beets
COPY play-playlist.sh /usr/local/bin/play-playlist
ENV BEETSDIR=/data/beets \
EDITOR=vi
USER beets:beets
WORKDIR /data
ENTRYPOINT ["/entrypoint.sh"]
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ docker run -ti --rm -v "$BEETS_DIR:/data" -u `id -u`:`id -g` \

To generate playlists from your music library, run:
```sh
docker run -ti --rm -v "$BEETS_DIR:/data" -u `id -u`:`id -g` \
docker run --rm -v "$BEETS_DIR:/data" -u `id -u`:`id -g` \
-v "$BEETS_DIR:/data" \
ghcr.io/mgoltzsche/beets splupdate
```
Expand All @@ -39,6 +39,15 @@ docker run -ti --rm -v "$BEETS_DIR:/data" -u `id -u`:`id -g` \
ghcr.io/mgoltzsche/beets web
```

To play tracks via pulseaudio, run e.g.:
```sh
docker run -ti --rm -v "$BEETS_DIR:/data" -u `id -u`:`id -g` \
-v "$BEETS_DIR:/data" \
-v /run:/host/run \
-e PULSE_SERVER=unix:/host/run/user/`id -u`/pulse/native \
ghcr.io/mgoltzsche/beets play House --args=--shuffle
```

## Development

To list the supported targets, run `make help`.
Expand Down
7 changes: 6 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ plugins:
- types
- smartplaylist
- importfeeds
- edit
- play
- mbsync
#- discogs
- fromfilename
Expand Down Expand Up @@ -175,8 +177,11 @@ bpm:
max_strokes: 3
overwrite: true

# Allows to play tracks also during import.
# See https://beets.readthedocs.io/en/stable/plugins/play.html
# Example: beet play House --args=--shuffle
play:
command: cmus
command: play-playlist

# Generate playlists from music library queries.
# See https://beets.readthedocs.io/en/stable/plugins/smartplaylist.html
Expand Down
12 changes: 12 additions & 0 deletions play-playlist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -eu

ARGS=
while [ $# -gt 1 ]; do
ARGS="$ARGS $1"
shift
done
PLAYLIST="$1"

exec mpv --no-video $ARGS --playlist="$PLAYLIST"

0 comments on commit 04c34f9

Please sign in to comment.