From efde6453f17cc0ebd8975c1c185f5ff91cf74b93 Mon Sep 17 00:00:00 2001 From: Volodymyr Dyptan Date: Tue, 10 Mar 2026 19:52:24 +0100 Subject: [PATCH] Fix review comments --- .devcontainer/devcontainer.json | 17 --- .github/workflows/BuildImage.yml | 2 +- Dockerfile.complex | 33 ----- README.md | 126 ++++++++---------- .../dependencies.d/init-mods | 0 .../s6-rc.d/init-mod-beets-httpshell/run | 5 - .../s6-rc.d/init-mod-beets-httpshell/type | 1 - .../s6-rc.d/init-mod-beets-httpshell/up | 1 - .../dependencies.d/init-mod-beets-httpshell | 0 .../user/contents.d/init-mod-beets-httpshell | 0 10 files changed, 58 insertions(+), 127 deletions(-) delete mode 100644 .devcontainer/devcontainer.json delete mode 100644 Dockerfile.complex delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/dependencies.d/init-mods delete mode 100755 root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/run delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/type delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/up delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-beets-httpshell delete mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-beets-httpshell diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 778fe8b..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "beets-httpshell", - "image": "mcr.microsoft.com/devcontainers/python:3", - "customizations": { - "vscode": { - "extensions": [ - "ms-python.python", - "ms-python.vscode-pylance" - ], - "settings": { - "python.defaultInterpreterPath": "/usr/local/bin/python", - "python.analysis.typeCheckingMode": "basic" - } - } - }, - "forwardPorts": [5555] -} diff --git a/.github/workflows/BuildImage.yml b/.github/workflows/BuildImage.yml index 1b28dad..6ad7f9b 100644 --- a/.github/workflows/BuildImage.yml +++ b/.github/workflows/BuildImage.yml @@ -15,7 +15,7 @@ env: BASEIMAGE: "beets" #replace MODNAME: "httpshell" #replace MOD_VERSION: ${{ inputs.mod_version }} #don't modify - MULTI_ARCH: "true" #set to false if not needed + MULTI_ARCH: "false" #set to false if not needed jobs: set-vars: diff --git a/Dockerfile.complex b/Dockerfile.complex deleted file mode 100644 index 3ed07b0..0000000 --- a/Dockerfile.complex +++ /dev/null @@ -1,33 +0,0 @@ -# syntax=docker/dockerfile:1 - -## Buildstage ## -FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS buildstage - -RUN \ - echo "**** install packages ****" && \ - apk add --no-cache \ - curl && \ - echo "**** grab rclone ****" && \ - mkdir -p /root-layer && \ - if [ $(uname -m) = "x86_64" ]; then \ - echo "Downloading x86_64 tarball" && \ - curl -o \ - /root-layer/rclone.deb -L \ - "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb"; \ - elif [ $(uname -m) = "aarch64" ]; then \ - echo "Downloading aarch64 tarball" && \ - curl -o \ - /root-layer/rclone.deb -L \ - "https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-arm64.deb"; \ - fi && \ - -# copy local files -COPY root/ /root-layer/ - -## Single layer deployed image ## -FROM scratch - -LABEL maintainer="username" - -# Add files from buildstage -COPY --from=buildstage /root-layer/ / diff --git a/README.md b/README.md index d6b72b3..ce2b0e0 100644 --- a/README.md +++ b/README.md @@ -8,51 +8,62 @@ The mod runs a Python 3 HTTP server (no extra dependencies) that maps URL paths ## Installation -Add the mod to your beets container using the `DOCKER_MODS` environment variable. +1. Configure your selected Docker container with the port, volume, and environment settings from the *original container documentation* here **[linuxserver/beets](https://hub.docker.com/r/linuxserver/beets "Beets Docker container")** +2. Add the **DOCKER_MODS** environment variable to your `compose.yml` file or `docker run` command, as follows: + - `DOCKER_MODS=linuxserver/mods:beets-httpshell` +3. Map the HTTP API port so it is accessible from outside the container. The default port is `5555` (configurable via `HTTPSHELL_PORT`). Add `5555:5555` to your port mappings: -### docker run +
+ Example Docker Compose YAML Configuration -```bash -docker run \ - --name=beets \ - -e DOCKER_MODS=ghcr.io/linuxserver/mods:beets-httpshell \ - -e PUID=1000 \ - -e PGID=1000 \ - -e TZ=Europe/London \ - -p 8337:8337 \ - -p 5555:5555 \ - -v /path/to/config:/config \ - -v /path/to/music:/music \ - -v /path/to/downloads:/downloads \ - --restart unless-stopped \ - lscr.io/linuxserver/beets:latest -``` + ```yaml + --- + services: + beets: + image: lscr.io/linuxserver/beets:latest + container_name: beets + environment: + - PUID=1000 + - PGID=1000 + - TZ=Europe/London + - DOCKER_MODS=linuxserver/mods:beets-httpshell + - HTTPSHELL_PORT=5555 + volumes: + - /path/to/config:/config + - /path/to/music:/music + - /path/to/downloads:/downloads + ports: + - 8337:8337 + - 5555:5555 + restart: unless-stopped + ``` +
-### docker compose +
+ Example Docker Run Command -```yaml ---- -services: - beets: - image: lscr.io/linuxserver/beets:latest - container_name: beets - environment: - DOCKER_MODS: ghcr.io/linuxserver/mods:beets-httpshell - PUID: 1000 - PGID: 1000 - TZ: Europe/London - HTTPSHELL_PORT: 5555 - volumes: - - /path/to/config:/config - - /path/to/music:/music - - /path/to/downloads:/downloads - ports: - - 8337:8337 - - 5555:5555 - restart: unless-stopped -``` + ```bash + docker run -d \ + --name=beets \ + -e PUID=1000 \ + -e PGID=1000 \ + -e TZ=Europe/London \ + -e DOCKER_MODS=linuxserver/mods:beets-httpshell \ + -e HTTPSHELL_PORT=5555 \ + -p 8337:8337 \ + -p 5555:5555 \ + -v /path/to/config:/config \ + -v /path/to/music:/music \ + -v /path/to/downloads:/downloads \ + --restart unless-stopped \ + lscr.io/linuxserver/beets:latest + ``` -## Environment Variables +
+ +4. Start the container. + +### Environment Variables | Variable | Default | Description | |---|---|---| @@ -86,22 +97,6 @@ The URL path is the beet subcommand. The optional `?mode=` query parameter contr } ``` -### Health check - -``` -GET /health -``` - -Returns `200 OK` with server status: - -```json -{ - "status": "ok", - "default_mode": "parallel", - "queue_size": 0 -} -``` - ### Examples ```bash @@ -116,12 +111,12 @@ curl -X POST http://localhost:5555/list \ # Import music in parallel (returns result when done, runs in parallel with other requests) curl -X POST http://localhost:5555/import \ -H "Content-Type: application/json" \ - -d '["/downloads/music", "--quiet", "--incremental"]' + -d '["--quiet", "--incremental", "/downloads/music"]' # Queue an import (returns 202 immediately, runs in background) curl -X POST 'http://localhost:5555/import?mode=queue' \ -H "Content-Type: application/json" \ - -d '["/downloads/music"]' + -d '["--quiet", "/downloads/music"]' # Update the library curl -X POST http://localhost:5555/update @@ -138,9 +133,6 @@ curl -X POST http://localhost:5555/remove \ curl -X POST http://localhost:5555/move \ -H "Content-Type: application/json" \ -d '["artist:Radiohead", "-d", "/music/favorites"]' - -# Health check -curl http://localhost:5555/health ``` ## Execution Modes @@ -187,9 +179,9 @@ Request 2 ──▶ 202 (queued, position 2) } ``` -## Lidarr Integration +## Lidarr Integration Example -Use beets-httpshell as a Lidarr custom script to automatically import downloads. In Lidarr, go to **Settings → Connect → +** and add a **Custom Script** with the path to the script below. +Use remote beets HTTP server in Lidarr's external content management script to automatically import downloads. In Lidarr, go to **Settings → Media Management → Importing → +** and add a **Import Script Path** with the path to the script below. Create the script at a path accessible to Lidarr (e.g., `/config/scripts/beets-import.sh`): @@ -203,7 +195,7 @@ fi curl -X POST --fail-with-body \ -H "Content-Type: application/json" \ - -d "[\"$lidarr_sourcepath\"]" \ + -d "[\"-q\",\"$lidarr_sourcepath\"]" \ 'http://beets:5555/import?mode=block' if [ $? -ne 0 ]; then @@ -212,7 +204,7 @@ if [ $? -ne 0 ]; then fi ``` -> **Note:** The script uses `?mode=block` so Lidarr waits for the import to complete before proceeding. Without it, the default `parallel` mode would also work but allows concurrent imports. Adjust the hostname (`beets`) and port (`5555`) to match your setup. +> **Note:** The script uses `?mode=block` so Lidarr waits for the import to complete before proceeding. Without it, the default `parallel` mode would also work but allows concurrent imports and import changes may not be detected by Lidarr sync. Adjust the hostname (`beets`) and port (`5555`) to match your setup. ## Mod Structure @@ -221,11 +213,7 @@ root/ ├── usr/local/bin/ │ └── beets-httpshell.py # HTTP server script └── etc/s6-overlay/s6-rc.d/ - ├── init-mod-beets-httpshell/ # oneshot init (startup banner, env validation) ├── svc-mod-beets-httpshell/ # longrun service (HTTP server) - ├── init-mods-end/dependencies.d/ - │ └── init-mod-beets-httpshell └── user/contents.d/ - ├── init-mod-beets-httpshell └── svc-mod-beets-httpshell ``` diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/dependencies.d/init-mods b/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/dependencies.d/init-mods deleted file mode 100644 index e69de29..0000000 diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/run b/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/run deleted file mode 100755 index df97494..0000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash - -echo "**** installing beets-httpshell mod ****" -echo "**** httpshell port: ${HTTPSHELL_PORT:-5555} ****" -echo "**** beets-httpshell mod installed ****" diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/type b/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/type deleted file mode 100644 index bdd22a1..0000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/type +++ /dev/null @@ -1 +0,0 @@ -oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/up b/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/up deleted file mode 100644 index 9873bf2..0000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/up +++ /dev/null @@ -1 +0,0 @@ -/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/run diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-beets-httpshell b/root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-beets-httpshell deleted file mode 100644 index e69de29..0000000 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-beets-httpshell b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-beets-httpshell deleted file mode 100644 index e69de29..0000000