Skip to content

Commit

Permalink
feat: add ytimport, store state+config within vol
Browse files Browse the repository at this point in the history
* Add ytimport plugin.
* To remember previous import decisions, store the state within the volume directory.
* The config.yaml has to be stored within same directory as the state. That keeps it consistent with the storage layout at the time of library creation.
* Change the storage path layout.
  • Loading branch information
mgoltzsche committed Oct 27, 2023
1 parent eb4c044 commit 7d99bd7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ RUN python3 -m pip install \
pyacoustid==1.3.0 \
python3-discogs-client==2.7 \
python-mpd2==3.1.0 \
beets-describe==0.0.4
beets-describe==0.0.4 \
beets-ytimport==0.2.1 \
ytmusicapi==1.3.1 \
yt-dlp==2023.10.13
RUN set -eux; \
addgroup -g 1000 beets; \
adduser -Su 1000 -G beets beets; \
mkdir -m750 /data; \
chown beets:beets /data; \
mkdir -p /home/beets/.config; \
ln -s /data/beets-state /home/beets/.config/beets
COPY config.yaml /etc/beets/
chown beets:beets /data
COPY config.yaml /etc/beets/default-config.yaml
COPY entrypoint.sh /
ENV BEETSDIR=/etc/beets
ENV BEETSDIR=/data/beets
USER beets:beets
WORKDIR /data
ENTRYPOINT ["/entrypoint.sh"]
Expand Down
15 changes: 11 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ library: /data/musiclibrary.db

paths:
default: $albumartist/$album%aunique{}/$track $title
singleton: Non-Album/$first_artist/$title
singleton: Singles/$first_artist/$title
comp: Compilations/$album%aunique{}/$track $title

# Load plugins beets can use.
Expand Down Expand Up @@ -31,7 +31,7 @@ plugins:
- bareasc
- fuzzy
- info
- youtube
- ytimport
- badfiles
- unimported
- random
Expand All @@ -56,12 +56,16 @@ import:
# This is to be prompted for skipped tracks only.
#incremental_skip_later: true

# Import liked songs from Youtube.
# See https://github.com/mgoltzsche/beets-ytimport
# Usage: beet ytimport --likes
ytimport:
directory: /data/youtube

# Match tracks against the Discogs database during import.
#discogs:
# source_weight: 0.5

youtube: {}

# Move featured artists from the artist field to the title field.
# Apparently this works with albums only.
# See https://beets.readthedocs.io/en/stable/plugins/ftintitle.html
Expand Down Expand Up @@ -171,6 +175,9 @@ bpm:
max_strokes: 3
overwrite: true

play:
command: cmus

# Generate playlists from music library queries.
# See https://beets.readthedocs.io/en/stable/plugins/smartplaylist.html
# Example: beet splupdate
Expand Down
5 changes: 3 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh

set -e
set -eu

mkdir -p /data/beets-state
mkdir -p "$BEETSDIR"
[ -f "$BEETSDIR/config.yaml" ] || cp /etc/beets/default-config.yaml "$BEETSDIR/config.yaml"

exec beet "$@"

0 comments on commit 7d99bd7

Please sign in to comment.