mirror of
https://github.com/linuxserver/docker-mods.git
synced 2026-03-23 00:05:28 +08:00
Fix review comments
This commit is contained in:
parent
1b1230021f
commit
efde6453f1
@ -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]
|
||||
}
|
||||
2
.github/workflows/BuildImage.yml
vendored
2
.github/workflows/BuildImage.yml
vendored
@ -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:
|
||||
|
||||
@ -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/ /
|
||||
126
README.md
126
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
|
||||
<details>
|
||||
<summary>Example Docker Compose YAML Configuration</summary>
|
||||
|
||||
```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
|
||||
```
|
||||
</details>
|
||||
|
||||
### docker compose
|
||||
<details>
|
||||
<summary>Example Docker Run Command</summary>
|
||||
|
||||
```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
|
||||
</details>
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
@ -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 ****"
|
||||
@ -1 +0,0 @@
|
||||
oneshot
|
||||
@ -1 +0,0 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-mod-beets-httpshell/run
|
||||
Loading…
x
Reference in New Issue
Block a user