Krolyxon
Commit a3a311f

rmptuiREADME.md

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