docs: update README to clarify functionality and usage of MusicBrainz Ratings Helper

This commit is contained in:
2026-05-31 14:48:34 -04:00
parent 9575c8b401
commit 9b72270a84
+64 -45
View File
@@ -1,71 +1,90 @@
# Navidrome to MusicBrainz Ratings Push # MusicBrainz Ratings Helper
This script reads ratings from Navidrome over its Subsonic API and submits them to MusicBrainz. Push Navidrome ratings to MusicBrainz.
It supports: The helper reads ratings from Navidrome through the Subsonic API and submits them to MusicBrainz as:
- song ratings -> MusicBrainz recordings
- album ratings -> MusicBrainz release groups
- artist ratings -> MusicBrainz artists - artist ratings -> MusicBrainz artists
- album ratings -> MusicBrainz release groups
- song ratings -> MusicBrainz recordings
For songs, it will also expand a release-group match and rate every matching recording it can find in that group instead of stopping at the first one. For songs, release-group expansion is enabled by default. When a rated Navidrome song belongs to a MusicBrainz release group, the helper finds matching recordings in that group so alternate releases can receive the same recording rating.
## Setup ## Setup
1. Install dependencies: Install dependencies:
`python -m pip install -r requirements.txt` ```powershell
python -m pip install -r requirements.txt
```
Optional: run inside a Python virtual environment (recommended) Using a virtual environment is recommended:
- Windows (PowerShell): ```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
```
```powershell Create a `.env` or set these environment variables:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
```
- Windows (cmd.exe): ```text
NAVIDROME_BASE_URL=https://navidrome.example.com
NAVIDROME_USERNAME=your-navidrome-username
NAVIDROME_PASSWORD=your-navidrome-password
```cmd MB_USERNAME=your-musicbrainz-username
python -m venv .venv MB_PASSWORD=your-musicbrainz-password
.\.venv\Scripts\activate.bat ```
python -m pip install -r requirements.txt
```
- Unix/macOS: ## Usage
```bash Preview what would be submitted:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
```
2. Set your Navidrome and MusicBrainz credentials: ```powershell
python musicbrainz-ratings-helper.py --dry-run
```
- `NAVIDROME_BASE_URL` Run for one Navidrome artist:
- `NAVIDROME_USERNAME`
- `NAVIDROME_PASSWORD`
- `MB_USERNAME` ```powershell
- `MB_PASSWORD` python musicbrainz-ratings-helper.py --dry-run --artist-id 5YPCM8WgUTYDxJPS8QUuOO
```
3. Run the script: Submit ratings for real:
`python musicbrainz-ratings-helper.py` ```powershell
python musicbrainz-ratings-helper.py
```
## Useful flags ## Useful Flags
- `--navidrome-base-url`, `--navidrome-username`, and `--navidrome-password` to override environment variables - `--dry-run` previews the same rating batches without posting to MusicBrainz.
- `--entity song --entity album --entity artist` to limit what gets exported - `--artist-id ID` limits album and song processing to one Navidrome artist.
- `--dry-run` to preview submissions - `--entity song`, `--entity album`, and `--entity artist` limit exported entity types. Repeat the flag for multiple types.
- `--max-targets 1` to limit a dry run to the first resolved target - `--max-artists N` limits artist rating collection.
- `--no-expand-release-groups` to disable release-group fan-out for songs - `--max-albums N` limits album/song collection.
- `--no-expand-release-groups` disables recording fan-out within release groups.
- `--log-level DEBUG` shows detailed matching and MusicBrainz resolution logs.
## Logging
Normal logs are grouped by artist and album. Rating lines show the Navidrome source rating and the MusicBrainz rating that will be submitted:
```text
Artist: s:2 -> mb:40 | 3Breezy / 3Breezy: dry-run
Album: s:3 -> mb:60 | Murda She Wrote / 3Breezy: dry-run
Recording: s:2 -> mb:40 | Bacc To Tha Basics / 3Breezy: dry-run
```
The final summary includes scanned counts and previewed/submitted counts.
Detailed recording ID resolution is logged only with `--log-level DEBUG`.
## Notes ## Notes
- The script submits one through five star ratings and converts them to MusicBrainz's 0-100 scale. - Navidrome uses 1-5 star ratings. MusicBrainz user ratings use a 0-100 scale, so the helper submits `rating * 20`.
- Zero ratings are skipped. - Zero or missing ratings are skipped.
- MusicBrainz requires authenticated XML POST submissions and a meaningful client string. - MusicBrainz API requests are throttled to about one request per second.
- Navidrome access uses the Subsonic API only; the script does not read the database directly. - Rating submissions are batched into one MusicBrainz POST where possible instead of sending one request per rating.
- Navidrome access uses the Subsonic API only; the helper does not read the Navidrome database directly.