# LastRecc Go weekly engine The Python app in the repo root is the **discovery UI**. This Go tool is the **weekly action engine**: it turns the same kind of recommendations into a rolling Navidrome playlist and, when an album is missing, downloads it through `streamrip-go` (`~/cloned/streamrip-go` by default). ```text last 7 days of scrobbles │ ▼ recency-weighted artist/track seeds │ ▼ Last.fm similar artists + biggest albums │ ├── album already in Navidrome → use its unheard top tracks │ └── album missing → Qobuz search via `rip` → download album │ ▼ Navidrome scan → resolve new tracks │ ▼ replace "LastRecc Weekly" with top N tracks/album ``` ## What it does - Reads joren's Navidrome scrobble history (native API). - Scores seeds by plays with a 14-day recency half-life. - Expands through Last.fm `artist.getSimilar` and `track.getSimilar`. - Picks each recommended artist's most popular suitable album (filters live/compilation/hits, etc.). - If the album is already in the library, it selects tracks that have not been scrobbled yet. - If the album is missing, it searches Qobuz with `streamrip-go`, downloads the album using **your** `rip` config (auth, quality, destination folder), then triggers a Navidrome scan. - Adds only the **most popular N tracks per album** to the playlist (`TRACKS_PER_ALBUM`, default 3) and caps the whole playlist (`PLAYLIST_MAX_TRACKS`, default 60). - Replaces one rolling playlist (`PLAYLIST_NAME`, default `LastRecc Weekly`) each run. Files already in the library are never deleted. - Remembers recently used tracks (`REPEAT_WINDOW_WEEKS`, default 4) so the next week is not a repeat. - Uses a lock file, so overlapping cron runs are skipped. ## Requirements - Go 1.25+ - A configured `streamrip-go` binary. It can be on `PATH` or set `RIP_BINARY`. The Go port is preferred; the Python `rip` has a different CLI. - `streamrip-go` must be logged in to Qobuz and configured to download into a folder Navidrome scans. This tool does **not** touch those settings. - `ffmpeg`/`ffprobe` for `rip` tagging/conversion (streamrip-go requirement). ## Configuration The tool reads the repo root `.env` (or `../.env`, or `--env PATH`). The Navidrome and Last.fm values are shared with the Python app. | Variable | Default | Meaning | |---|---|---| | `NAVIDROME_URL`, `NAVIDROME_USER`, `NAVIDROME_PASSWORD` | — | Navidrome API | | `NAVIDROME_BASIC_USER/PASSWORD` | — | optional reverse-proxy basic auth | | `LASTFM_API_KEY` | — | Last.fm API key | | `SCAN_USER`, `SCAN_PASSWORD` | main user | admin account used for `startScan` | | `DAYS` | `7` | scrobble window | | `MAX_ARTISTS` | `30` | top recommended artists to process, `0` = all | | `TRACKS_PER_ALBUM` | `3` | most-popular tracks added from each album | | `PLAYLIST_MAX_TRACKS` | `60` | hard playlist cap, `0` = unlimited | | `PLAYLIST_NAME` | `LastRecc Weekly` | rolling playlist name | | `REPEAT_WINDOW_WEEKS` | `4` | avoid tracks used in the last N weeks | | `RIP_BINARY` | clone/PATH | streamrip-go binary | | `RIP_CONFIG` | `rip` default | optional `--config-path` | | `QUALITY` | `rip` default | optional Qobuz quality override (`-1` = config) | | `SCAN` | `true` | trigger Navidrome scan after downloads | | `SCAN_TIMEOUT_SECONDS` | `1800` | max wait for a library scan | | `STATE_DIR` | `./state` | cache, lock and report directory | CLI flags override these (`--days`, `--max-artists`, `--tracks-per-album`, `--playlist-max-tracks`, `--playlist-name`, `--repeat-weeks`, `--rip`, `--rip-config`, `--quality`, `--state-dir`, `--no-scan`, `--dry-run`). ## Usage ```bash cd lastrecc-go go build -o lastrecc ./cmd/lastrecc ./lastrecc seeds # inspect weighted seeds ./lastrecc plan # dry run: albums, library matches, Qobuz hits ./lastrecc plan --json # machine-readable plan ./lastrecc weekly # download missing albums + rebuild playlist ./lastrecc weekly --dry-run # same as plan ./lastrecc artist "Кино" --limit 10 # similar artists + a top album each ./lastrecc artist "Кино" --download --dry-run # show Qobuz matches ./lastrecc artist "Кино" --download # fetch the top albums ./lastrecc artist "Cher" --json # machine-readable ``` Useful limits while experimenting: ```bash ./lastrecc plan --max-artists 3 ./lastrecc weekly --max-artists 1 --playlist-name "LastRecc Test" ``` The default `MAX_ARTISTS=30` mirrors the scale of the web feed. Set `--max-artists 0` to process every unique recommended artist; that can queue dozens of albums, so run `plan` first. ## Cron Run once a week (Monday 06:00), from the Go directory: ```cron 0 6 * * 1 cd /home/joren/dev/LastRecc/lastrecc-go && ./lastrecc weekly --env /home/joren/dev/LastRecc/.env >> state/weekly.log 2>&1 ``` `weekly` takes a lock at `state/weekly.lock`; if a previous run is still going, the new run exits instead of overlapping. A lock older than 24h is removed automatically. ## Output - `state/last-run.json` — full report: seeds, artists, albums, Qobuz IDs, selected tracks, warnings. - `state/last-plan.json` — dry-run report. - `state/playlist_history.json` — recent playlist keys used for de-duplication. - `state/qobuz_batch.json` — the last batch handed to `rip file`. - `state/cache/` — Navidrome metadata and Last.fm responses. The playlist itself is the user-facing output. Old downloaded files remain in the library; only the playlist contents change. ## Notes - The download step is intentionally delegated to `streamrip-go`. It uses your own Qobuz account and config; use it only in line with Qobuz's terms. - The tool assumes `rip` downloads into the Navidrome library. If it does not, the scan succeeds but the new album will not be found for the playlist. - Qobuz search is matched by album title + query relevance. `plan` shows the Qobuz title and match score before anything is downloaded. - Last.fm's API is non-commercial; this is a personal tool. ## Tests ```bash go test ./... ```