Krolyxon
Commit 1dcac38

rmptuiREADME.md

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