Krolyxon
Commit 957ffc9

rmptuiREADME.md

278 lines · 10.1 KB · Markdown

1# rmptui
2
3![Release](https://img.shields.io/github/v/release/krolyxon/rmptui?color=%23c694ff)
4[![GitHub Downloads](https://img.shields.io/github/downloads/krolyxon/rmptui/total.svg?label=GitHub%20downloads)](https://github.com/krolyxon/rmptui/releases)
5
6**A fast, keyboard-driven MPD client for your terminal.**
7
8rmptui is a terminal interface for [Music Player Daemon
9(MPD)](https://www.musicpd.org/) that looks and feels like ncmpcpp. Browse your
10library, manage the queue and playlists, edit tags, read synced lyrics and
11watch a music visualizer without leaving the terminal.
12
13![Browse Screen](assets/browse-screen.png)
14
15<table>
16 <tr>
17 <td width="50%"><img src="assets/playlist-editor-screen.png" alt="system tab"><br>
18 <sub><b>Playlist Editor</b> · Manage your playlists</sub></td>
19 <td width="50%"><img src="assets/lyrics-screen.png" alt="system tab"><br>
20 <sub><b>Lyrics Screen</b> · Fetched lyrics with synchronization</sub></td>
21 </tr>
22</table>
23
24## Screens
25
26| Key | Screen | What it does |
27| --- | --- | --- |
28| `1` | **Playlist** | The play queue as a table (Artist, Track, Title, Album, Time). Play, remove, reorder, mark, shuffle or save it as a playlist. `L` shows a synced lyrics pane next to it. |
29| `2` | **Browse** | Your music folders. Folders (`[name]`) span the whole row, songs use the same columns as the queue, and stored playlists are listed at the bottom of the root folder. |
30| `3` | **Playlist editor** | Stored playlists and their songs: load, play from a song, remove or reorder songs, rename or delete playlists. |
31| `4` | **Media library** | Album artists → albums (with year) → songs. `t` switches between AlbumArtist and Artist. |
32| `5` | **Tag editor** | Directories, tag types and tags, like ncmpcpp: edit Title, Artist, Album Artist, Album, Date, Track, Genre, Composer, Performer, Disc and Comment of one or many songs, rename files, fix letter case, then save. |
33| `6` | **Music visualizer** | ncmpcpp-style wave, filled wave, spectrum and ellipse visualizers fed by an MPD fifo output; `Space` cycles them. |
34| `7` | **Lyrics** | Synced lyrics that follow playback, or plain lyrics you can scroll. |
35
36Every screen shares ncmpcpp's frame: the screen title and volume on top
37(active modes such as `[rz]` appear on the line below), and at the bottom a
38progress bar above `Playing: "Title" by Artist in Album (Year)` with the
39bitrate and elapsed/total time.
40
41Other highlights:
42
43- **Instant controls.** All MPD traffic runs in background tasks over MPD's
44 `idle` notifications, so seeking, volume changes and skipping never wait for
45 the UI, and the UI never waits for the server.
46- **Fuzzy search everywhere.** `/` searches the focused list; `n`/`N` cycle
47 through the matches.
48- **Marks.** `v` marks items; queue removal, add-to-playlist and tag edits
49 then apply to every marked item.
50- **Mouse support.** Click to select, double-click to play/open, scroll with
51 the wheel and click the progress bar to seek.
52- **TCP or Unix socket**, with password support and automatic reconnection.
53
54## Requirements
55
56- A running MPD server with its music library configured.
57- Rust 1.88 or newer and Cargo to build from source.
58
59## Install
60
61From a local checkout, run the installer to build the release executable and
62copy it to `/usr/local/bin/rmptui`:
63
64```sh
65./install.sh
66```
67
68The script uses `sudo` for the system-directory operations when needed. To use
69a different binary directory or uninstall rmptui:
70
71```sh
72./install.sh --bin-dir "$HOME/.local/bin"
73./install.sh --uninstall
74```
75
76Uninstall from a custom directory with
77`./install.sh --uninstall --bin-dir "$HOME/.local/bin"`. Run
78`./install.sh --help` for usage.
79
80## Build from source
81
82```sh
83git clone https://github.com/krolyxon/rmptui.git
84cd rmptui
85cargo run --release
86```
87
88## Configuration
89
90On first launch rmptui writes a fully commented configuration to
91`$CONFIG_HOME/rmptui/config.toml`. If `CONFIG_HOME` is not set, it uses
92`$XDG_CONFIG_HOME/rmptui/config.toml`, then `~/.config/rmptui/config.toml`.
93Use `rmptui --config FILE` to load a different file, and
94`rmptui --print-default-config` to see every option with its default. Restart
95rmptui to apply changes.
96
97You only need to keep the settings you change: anything left out keeps its
98default, table by table. Unknown options and conflicting key bindings are
99reported with the file and the offending value.
100
101> **Upgrading from 0.1:** the configuration format changed. rmptui refuses to
102> start with a 0.1 file and tells you so; move the old file aside, start
103> rmptui to generate the new one, and copy your MPD settings over.
104
105The main sections:
106
107```toml
108[mpd]
109host = "127.0.0.1" # or a Unix socket path such as "~/.config/mpd/socket"
110port = 6600
111password = ""
112music_directory = "" # for the tag editor and local .lrc files (see below)
113
114[playback]
115seek_seconds = 5
116volume_step = 5
117
118[ui]
119startup_screen = "queue"
120mouse = true
121confirm_clear_queue = false
122lyrics_pane = false
123song_columns = [ # queue, browser and playlist editor
124 { field = "artist", width = 34 },
125 { field = "track", width = 5 },
126 { field = "title", width = 33 },
127 { field = "album", width = 30 },
128 { field = "duration", width = 5 },
129]
130
131[theme] # color names, 256-color indices or "#rrggbb"
132text = "reset"
133dim = "darkgray"
134selection_fg = "reset" # both "reset": reverse video, like ncmpcpp
135selection_bg = "reset"
136visualizer = ["blue", "cyan", "green", "yellow", "red"]
137
138[lyrics]
139online = true # look up lyrics on lrclib.net
140cache = true
141
142[visualizer]
143fifo = "/tmp/mpd.fifo"
144```
145
146The MPD connection can also be set with environment variables, which take
147precedence over the file:
148
149| Variable | Description |
150| --- | --- |
151| `MPD_HOST` | Hostname, address or Unix socket path. Use `password@host` to set both host and password. |
152| `MPD_PORT` | Port; an explicit port in `MPD_HOST` takes precedence. |
153
154```sh
155MPD_HOST=192.168.1.20 MPD_PORT=6600 rmptui
156MPD_HOST='secret@localhost' rmptui
157MPD_HOST=~/.config/mpd/socket rmptui
158```
159
160Logs (and panic details) are appended to `/tmp/rmptui.log`. Set
161`RMPTUI_LOG=debug` for more detail.
162
163### Visualizer
164
165The visualizer reads raw audio from an MPD fifo output. Add this to
166`mpd.conf` and restart MPD:
167
168```
169audio_output {
170 type "fifo"
171 name "Visualizer feed"
172 path "/tmp/mpd.fifo"
173 format "44100:16:2"
174}
175```
176
177`[visualizer]` must match the `path` and `format`. The fifo is only read while
178the Visualizer screen is visible.
179
180Like ncmpcpp, there are four styles: `wave` (the default), `wave_filled`,
181`spectrum` and `ellipse`. Set the startup one with `style` and press `Space` on
182the screen to cycle through them. With `stereo = true` the wave styles draw the
183left channel in the top half and the right channel in the bottom half.
184
185### Lyrics
186
187Lyrics are looked up in this order:
188
1891. An `.lrc` file next to the song (`Song.flac` → `Song.lrc`), when the music
190 directory is known.
1912. The cache in `$XDG_CACHE_HOME/rmptui/lyrics` (`~/.cache` by default).
1923. [LRCLIB](https://lrclib.net), a free lyrics database. Results are cached.
193
194Set `lyrics.online = false` to stay offline. `F5` on the Lyrics screen fetches
195the lyrics of the current song again.
196
197### Tag editor
198
199MPD cannot change tags, so the tag editor writes the files directly, which
200requires the music files to be on this machine. rmptui finds the music
201directory in this order: `mpd.music_directory` in its config, MPD itself (only
202answered over a Unix socket), and finally `music_directory` from the local
203MPD's `mpd.conf` (`$XDG_CONFIG_HOME/mpd/mpd.conf`, `~/.config/mpd/mpd.conf`,
204`~/.mpdconf`, `~/.mpd/mpd.conf` or `/etc/mpd.conf`) when MPD runs on this
205machine.
206
207Highlight a directory to see its songs in the `Tags` column, which shows the
208tag selected in `Tag types`. `Enter` on a tag type edits it for all marked
209songs (or all songs), `Enter` on a song edits it for that song only, and
210`Filename` renames files. Changes stay pending until you choose `Save` (or
211press `w`); `Reset` (or `u`) discards them. After saving, rmptui asks MPD to
212rescan the folder.
213
214## Key bindings
215
216These are the defaults; every binding is configurable in the `[keys.*]` tables
217of the config. `?` shows the active bindings inside rmptui.
218
219Bindings are grouped by context. A key is looked up in the focused popup or
220screen first, then in `navigation`, then in `global`, so screen bindings
221shadow global ones on that screen (for example `R` renames a playlist on the
222Playlists screen and toggles consume elsewhere).
223
224### Global
225
226| Key | Action |
227| --- | --- |
228| `1`–`7` | Switch screen |
229| `Tab` / `Shift+Tab` | Next / previous screen |
230| `p` | Toggle play/pause |
231| `s` / `x` | Pause / stop |
232| `>` / `<` | Next / previous track |
233| `f` / `b` | Seek forward / backward |
234| `+` `=` / `-` | Volume up / down |
235| `m` | Toggle mute |
236| `r` `z` `y` `R` | Toggle repeat, random, single, consume |
237| `c` | Clear the queue |
238| `U` | Rescan the music database |
239| `?` `F1` | Show key bindings |
240| `q` `Ctrl+c` | Quit |
241
242### Lists
243
244| Key | Action |
245| --- | --- |
246| `j` `k` / arrows | Move down / up |
247| `g` `G` / `Home` `End` | Top / bottom |
248| `Ctrl+d` `Ctrl+u`, `PageDown` `PageUp` | Half page / page |
249| `h` `l` / arrows | Back or previous column / open or next column |
250| `Enter` | Play or open the selected item |
251| `Space` | Add to the queue (toggles songs in the browser) |
252| `a` | Add to the queue, a new playlist or an existing one |
253| `v` / `V` | Mark item / clear marks |
254| `/`, `n` / `N` | Search, next / previous match |
255
256### Screens
257
258| Screen | Key | Action |
259| --- | --- | --- |
260| Queue | `d` `Delete` | Remove the song (or all marked songs) |
261| Queue | `J` / `K` | Move the song down / up |
262| Queue | `Z` / `S` | Shuffle / save as playlist |
263| Queue | `o` | Jump to the playing song |
264| Queue | `L` | Toggle the lyrics pane |
265| Playlists | `d`, `J` / `K` | Remove / move the selected song |
266| Playlists | `R` / `D` | Rename / delete the playlist |
267| Library | `t` | Switch between AlbumArtist and Artist |
268| Tags | `Enter` | Edit a tag, rename a file, or run the highlighted action |
269| Tags | `w` / `u` | Write / discard pending changes |
270| Lyrics | `F5` | Fetch lyrics again |
271
272In text fields, `Enter` submits, `Esc` cancels, `Ctrl+w` deletes a word and
273`Ctrl+a` / `Ctrl+e` jump to the start / end.
274
275## License
276
277rmptui is distributed under the
278[GNU Affero General Public License v3.0](LICENSE).