Krolyxon
Commit b139f20

rmptuiREADME.md

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