Krolyxon
Commit 222ab2f

rmptuiREADME.md

264 lines · 9.5 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 spectrum 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** | A spectrum analyzer fed by an MPD fifo output. |
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
171### Lyrics
172
173Lyrics are looked up in this order:
174
1751. An `.lrc` file next to the song (`Song.flac` → `Song.lrc`), when the music
176 directory is known.
1772. The cache in `$XDG_CACHE_HOME/rmptui/lyrics` (`~/.cache` by default).
1783. [LRCLIB](https://lrclib.net), a free lyrics database. Results are cached.
179
180Set `lyrics.online = false` to stay offline. `F5` on the Lyrics screen fetches
181the lyrics of the current song again.
182
183### Tag editor
184
185MPD cannot change tags, so the tag editor writes the files directly, which
186requires the music files to be on this machine. rmptui finds the music
187directory in this order: `mpd.music_directory` in its config, MPD itself (only
188answered over a Unix socket), and finally `music_directory` from the local
189MPD's `mpd.conf` (`$XDG_CONFIG_HOME/mpd/mpd.conf`, `~/.config/mpd/mpd.conf`,
190`~/.mpdconf`, `~/.mpd/mpd.conf` or `/etc/mpd.conf`) when MPD runs on this
191machine.
192
193Highlight a directory to see its songs in the `Tags` column, which shows the
194tag selected in `Tag types`. `Enter` on a tag type edits it for all marked
195songs (or all songs), `Enter` on a song edits it for that song only, and
196`Filename` renames files. Changes stay pending until you choose `Save` (or
197press `w`); `Reset` (or `u`) discards them. After saving, rmptui asks MPD to
198rescan the folder.
199
200## Key bindings
201
202These are the defaults; every binding is configurable in the `[keys.*]` tables
203of the config. `?` shows the active bindings inside rmptui.
204
205Bindings are grouped by context. A key is looked up in the focused popup or
206screen first, then in `navigation`, then in `global`, so screen bindings
207shadow global ones on that screen (for example `R` renames a playlist on the
208Playlists screen and toggles consume elsewhere).
209
210### Global
211
212| Key | Action |
213| --- | --- |
214| `1`–`7` | Switch screen |
215| `Tab` / `Shift+Tab` | Next / previous screen |
216| `p` | Toggle play/pause |
217| `s` / `x` | Pause / stop |
218| `>` / `<` | Next / previous track |
219| `f` / `b` | Seek forward / backward |
220| `+` `=` / `-` | Volume up / down |
221| `m` | Toggle mute |
222| `r` `z` `y` `R` | Toggle repeat, random, single, consume |
223| `c` | Clear the queue |
224| `U` | Rescan the music database |
225| `?` `F1` | Show key bindings |
226| `q` `Ctrl+c` | Quit |
227
228### Lists
229
230| Key | Action |
231| --- | --- |
232| `j` `k` / arrows | Move down / up |
233| `g` `G` / `Home` `End` | Top / bottom |
234| `Ctrl+d` `Ctrl+u`, `PageDown` `PageUp` | Half page / page |
235| `h` `l` / arrows | Back or previous column / open or next column |
236| `Enter` | Play or open the selected item |
237| `Space` | Add to the queue (toggles songs in the browser) |
238| `a` | Add to the queue, a new playlist or an existing one |
239| `v` / `V` | Mark item / clear marks |
240| `/`, `n` / `N` | Search, next / previous match |
241
242### Screens
243
244| Screen | Key | Action |
245| --- | --- | --- |
246| Queue | `d` `Delete` | Remove the song (or all marked songs) |
247| Queue | `J` / `K` | Move the song down / up |
248| Queue | `Z` / `S` | Shuffle / save as playlist |
249| Queue | `o` | Jump to the playing song |
250| Queue | `L` | Toggle the lyrics pane |
251| Playlists | `d`, `J` / `K` | Remove / move the selected song |
252| Playlists | `R` / `D` | Rename / delete the playlist |
253| Library | `t` | Switch between AlbumArtist and Artist |
254| Tags | `Enter` | Edit a tag, rename a file, or run the highlighted action |
255| Tags | `w` / `u` | Write / discard pending changes |
256| Lyrics | `F5` | Fetch lyrics again |
257
258In text fields, `Enter` submits, `Esc` cancels, `Ctrl+w` deletes a word and
259`Ctrl+a` / `Ctrl+e` jump to the start / end.
260
261## License
262
263rmptui is distributed under the
264[GNU Affero General Public License v3.0](LICENSE).