Added Lidarr API calls to add artist to library automatically. Updated README.md

This commit is contained in:
2025-09-26 12:37:04 +00:00
parent 2bcce54df7
commit 00086249b9
3 changed files with 184 additions and 93 deletions

View File

@@ -35,12 +35,14 @@ The `mbid-poller` container needs to communicate with your Lidarr instance.
1. **Rename the Example:** Rename the provided `docker-compose.yaml.example` to `docker-compose.yaml`.
2. **Network Setup:** Ensure the `lidarr` and `mbid-poller` services are on the **same Docker network** (e.g., `example_network`). If you use a different setup (like host network), update `LIDARR_BASE` accordingly.
3. **Lidarr Base URL:** Verify the `LIDARR_BASE` environment variable in the `mbid-poller` service points to your Lidarr instance.
3. **Lidarr Base URL:** The script uses the Lidarr API to automatically add the polled artists. You must set the following environment variables in the mbid-poller service:
```yaml
# Example for the default setup:
- LIDARR_BASE=http://lidarr:8686
```
| Environment Variable | Description | Source in Lidarr |
| LIDARR_BASE | The internal URL of your Lidarr instance. | N/A (Docker network alias) |
| LIDARR_API_KEY | Your Lidarr API key. | Settings > General > API Key |
| LIDARR_ROOT_FOLDER | The path for your music root folder as seen by Lidarr. | Settings > Media Management > Root Folders |
| LIDARR_QUALITY_PROFILE_ID | The numerical ID for the desired Quality Profile. (Default is 1) | Settings > Profiles > Quality Profiles (Inspect element to find ID) |
| LIDARR_METADATA_PROFILE_ID | The numerical ID for the desired Metadata Profile. (Default is 1) | Settings > Profiles > Metadata Profiles (Inspect element to find ID) |
### 3. Choose the MBID Input Source
@@ -60,15 +62,19 @@ In your `docker-compose.yaml`, **only one** of these should be uncommented and s
2. In `docker-compose.yaml`, **comment out** `MBID_API_URL` and **uncomment** `MBID_JSON_FILE`:
```yaml
# ... mbid-poller environment section
environment:
# ...
- LIDARR_BASE=http://lidarr:8686
# - MBID_API_URL=
- MBID_JSON_FILE=/config/ids.json
# - MBID_URL=...
volumes:
- ./ids.json:/config/ids.json:ro # Maps your local file into the container
# ... mbid-poller environment section
environment:
# ...
- LIDARR_BASE=http://lidarr:8686
- LIDARR_API_KEY=your_lidarr_api_key_here
- LIDARR_ROOT_FOLDER=/music # Example
- LIDARR_QUALITY_PROFILE_ID=1 # Example
- LIDARR_METADATA_PROFILE_ID=1 # Example
# - MBID_API_URL=
- MBID_JSON_FILE=/config/ids.json
# - MBID_URL=...
volumes:
- ./ids.json:/config/ids.json:ro # Maps your local file into the container
```
### 4. Build and Run
@@ -87,4 +93,8 @@ With your files and `docker-compose.yaml` configured, you can build and run the
docker compose up mbid-poller
```
The script will fetch the IDs, then loop through them, pinging the external MusicBrainz API until a successful response is received. It then outputs a Lidarr search URL for you to manually or automatically trigger the import in Lidarr.
The script will fetch the IDs, then loop through them. For each ID, it will:
1. Ping the external MusicBrainz API until a successful response is received.
2. Use the Lidarr API to automatically add the artist and set it to monitored.
3. Output a confirmation or error message before moving to the next artist.