crabidy/tidaldy/README.md

78 lines
2.8 KiB
Markdown

# tidaldy — the Tidal provider
Mounts your Tidal account at **`/tidal`** in the crabidy library, using
Tidal's web API.
## Logging in
On first start the provider runs Tidal's OAuth **device login**:
1. Start the server. It prints a `link.tidal.com` verification URL to its
stdout — for `cbd` (which owns the terminal) look in the log file under
`~/.local/state/crabidy/` instead.
2. Open the URL in a browser and authorize the device. The server polls
meanwhile; the attempt expires after a few minutes, so restart it if you
miss the window.
3. The provider finishes logging in by itself. The tokens are written back
into `tidaly.toml` and refreshed automatically from then on — you should
not need to log in again.
To switch accounts or recover from an invalidated session, delete the
`[login]` section from `tidaly.toml` and restart.
**Note:** a `tidaly.toml` that exists but cannot be parsed **aborts server
startup** rather than silently dropping your account — unlike every other
provider, whose config errors only cost that one subtree.
## How it works
The tree offers your playlists, favorite artists (with their albums and
tracks), and a **search** node: press `%` under `/tidal/search` to
create a search term; the term becomes a persistent child node holding
its results (tracks, artists, albums). Terms are renamable (`e`,
re-runs the search) and deletable (`d`).
Everything queueable is also capturable: `w` bookmarks a subtree as
links, `W` downloads a subtree's audio into `/crabidy/<name>`.
## Configuration — `~/.config/crabidy/tidaly.toml`
The file is rewritten on every server start with the current values
(including refreshed tokens), so **it contains your credentials — keep
it private**. All options with their defaults:
```toml
# Tidal API endpoints. Change only if you know why.
base_url = "https://api.tidal.com/v1"
hifi_url = "https://api.tidalhifi.com/v1"
# Stream quality: "Low" | "High" | "Lossless" | "HiRes".
audio_quality = "Lossless"
# Managed by the provider: filled in by the device login and refreshed
# automatically. Delete this whole section to force a fresh login.
[login]
# device_code = ...
# user_id = ...
# country_code = ...
# access_token = ...
# refresh_token = ...
# expires_after = ...
# OAuth client identity used for the device flow. Working defaults are
# built in; override only to use your own client registration.
[oauth]
# client_id = ...
# client_secret = ...
base_url = "https://auth.tidal.com/v1/oauth2"
```
Notes:
- A missing or empty file is fine: defaults are used and the device
login runs on the next start.
- If Tidal ever invalidates the session (long offline periods), delete
the `[login]` section and restart.
- Build the server without the `tidal` cargo feature to leave this provider
out of the binary entirely.