1MPC(1) mpc MPC(1)
2
3
4
6 mpc - mpc Documentation
7
9 mpc is a command-line client for the Music Player Daemon (MPD). It
10 connects to a MPD and controls it according to commands and arguments
11 passed to it. If no command is given, the current status is printed
12 (same as "mpc status").
13
15 mpc [options] <command> [<arguments>]
16
18 -f, --format
19 Configure the format used to display songs.
20
21 The metadata delimiters are:
22
23 ┌───────────────┬────────────────────────────┐
24 │Name │ Description │
25 ├───────────────┼────────────────────────────┤
26 │%name% │ A name for this song. │
27 │ │ This is not the song ti‐ │
28 │ │ tle. The exact meaning of │
29 │ │ this tag is not well-de‐ │
30 │ │ fined. It is often used by │
31 │ │ badly configured internet │
32 │ │ radio stations with broken │
33 │ │ tags to squeeze both the │
34 │ │ artist name and the song │
35 │ │ title in one tag. │
36 ├───────────────┼────────────────────────────┤
37 │%artist% │ Artist file tag │
38 ├───────────────┼────────────────────────────┤
39 │%album% │ Album file tag │
40 ├───────────────┼────────────────────────────┤
41 │%albumartist% │ Album Artist file tag │
42 ├───────────────┼────────────────────────────┤
43 │%comment% │ Comment file tag (not en‐ │
44 │ │ abled by default in │
45 │ │ mpd.conf's meta‐ │
46 │ │ data_to_use) │
47 ├───────────────┼────────────────────────────┤
48 │%composer% │ Composer file tag │
49 ├───────────────┼────────────────────────────┤
50 │%date% │ Date file tag │
51 ├───────────────┼────────────────────────────┤
52 │%originaldate% │ Original Date file tag │
53 ├───────────────┼────────────────────────────┤
54 │%disc% │ Disc file tag │
55 ├───────────────┼────────────────────────────┤
56 │%genre% │ Genre file tag │
57 ├───────────────┼────────────────────────────┤
58 │%performer% │ Performer file tag │
59 ├───────────────┼────────────────────────────┤
60 │%title% │ Title file tag │
61 ├───────────────┼────────────────────────────┤
62 │%track% │ Track file tag │
63 ├───────────────┼────────────────────────────┤
64 │%time% │ Duration of file │
65 └───────────────┴────────────────────────────┘
66
67 │%file% │ Path of file, relative to │
68 │ │ MPD's music_directory │
69 │ │ variable │
70 ├───────────────┼────────────────────────────┤
71 │%position% │ Queue track number │
72 ├───────────────┼────────────────────────────┤
73 │%id% │ Queue track id number │
74 ├───────────────┼────────────────────────────┤
75 │%prio% │ Priority in the (random) │
76 │ │ queue. │
77 ├───────────────┼────────────────────────────┤
78 │%mtime% │ Date and time of last file │
79 │ │ modification │
80 ├───────────────┼────────────────────────────┤
81 │%mdate% │ Date of last file modifi‐ │
82 │ │ cation │
83 └───────────────┴────────────────────────────┘
84
85 The [] operator is used to group output such that if no metadata
86 delimiters are found or matched between [ and ], then none of
87 the characters between [ and ] are output. & and | are logical
88 operators for and and or. # is used to escape characters. Some
89 useful examples for format are: "%file%" and "[[%artist% - ]%ti‐
90 tle%]|[%file%]". This command also takes the following defined
91 escape sequences:
92
93 ┌───┬─────────────────┐
94 │\ │ backslash │
95 ├───┼─────────────────┤
96 │\[ │ left bracket │
97 ├───┼─────────────────┤
98 │\] │ right bracket │
99 ├───┼─────────────────┤
100 │\a │ alert │
101 ├───┼─────────────────┤
102 │\b │ backspace │
103 ├───┼─────────────────┤
104 │\e │ escape │
105 ├───┼─────────────────┤
106 │\t │ tab │
107 ├───┼─────────────────┤
108 │\n │ newline │
109 ├───┼─────────────────┤
110 │\v │ vertical tab │
111 ├───┼─────────────────┤
112 │\f │ form-feed │
113 ├───┼─────────────────┤
114 │\r │ carriage return │
115 └───┴─────────────────┘
116
117 If not given, the value of the environment variable MPC_FORMAT
118 is used.
119
120 --wait Wait for operation to finish (e.g. database update).
121
122 --range=[START]:[END]
123 Operate on a range (e.g. when loading a playlist). START is the
124 first index of the range, END is the first index after the range
125 (i.e. excluding). START and END may be omitted, making the
126 range open to that end. Indexes start with zero.
127
128 -q, --quiet, --no-status
129 Prevents the current song status from being printed on comple‐
130 tion of some of the commands.
131
132 --verbose
133 Verbose output.
134
135 --host=HOST
136 The MPD server to connect to. This can be a hostname, IPv4/IPv6
137 address, an absolute path (i.e. local socket) or a name starting
138 with @ (i.e. an abstract socket, Linux only).
139
140 To use a password, provide a value of the form "password@host".
141
142 If not given, the value of the environment variable MPD_HOST is
143 used.
144
145 --port=PORT, -p PORT
146 The TCP port of the MPD server to connect to.
147
148 If not given, the value of the environment variable MPD_PORT is
149 used.
150
152 Commands can be used from the least unambiguous prefix (e.g insert or
153 ins).
154
155 Player Commands
156 consume <on|off> - Toggle consume mode if state (on
157 or off) is not specified.
158
159 crossfade [<seconds>] - Gets and sets the current amount of
160 crossfading between songs (0 disables crossfading).
161
162 current [--wait] - Show the currently playing song. With
163 --wait, mpc waits until the song changes (or until playback is
164 started/stopped) before it queries the current song from the
165 server.
166
167 queued - Show the currently queued (next) song.
168
169 mixrampdb [<db>] - Gets and sets the volume level at which
170 songs with MixRamp tags will be overlapped. This disables the
171 fading of the crossfade command and simply mixes the songs.
172 -50.0 will effectively remove any gaps, 0.0 will mash tracks to‐
173 gether. The amount of overlap is limited by the audio_buf‐
174 fer_size MPD configuration parameter.
175
176 mixrampdelay [<seconds>] - Gets and sets the current amount
177 of extra delay added to the value computed from the MixRamp
178 tags. (A negative value disables overlapping with MixRamp tags
179 and restores the previous value of crossfade).
180
181 next - Starts playing next song on queue.
182
183 pause - Pauses playing.
184
185 play <position> - Starts playing the song-number
186 specified. If none is specified, plays number 1.
187
188 prev - Starts playing previous song.
189
190 random <on|off> - Toggle random mode if state (on
191 or off) is not specified.
192
193 repeat <on|off> - Toggle repeat mode if state (on
194 or off) is not specified.
195
196 replaygain [<off|track|album>] - Sets the replay gain mode.
197 Without arguments, it prints the replay gain mode.
198
199 single <on|once|off> - Toggle single mode if state (on,
200 once, or off) is not specified. once toggles to off.
201
202 seek [+-][<HH:MM:SS>] or <[+-]<0-100>%> - Seeks by hour,
203 minute or seconds, hours or minutes can be omitted. If seeking
204 by percentage, seeks within the current song in the specified
205 manner. If a + or - is used, the seek is done relative to the
206 current song position. Absolute seeking by default.
207
208 seekthrough [+-][<HH:MM:SS>] - Seeks by hour,
209 minute or seconds, hours or minutes can be omitted, relatively
210 to the current position. If the duration exceeds the limit of
211 the current song, the seek command proceeds to seek through the
212 playlist until the duration is reached. If a + is used, the
213 seek is forward. If a - is used, the seek is backward. Forward
214 seeking by default.
215
216 stop - Stops playing.
217
218 toggle - Toggles between play and pause. If stopped starts
219 playing. Does not support start playing at song number (use
220 play).
221
222 Queue Commands
223 add <file> - Adds a song from the music database to the
224 queue. Can also read input from pipes. Use "mpc add /" to add
225 all files to the queue.
226
227 insert <file> - The insert command works similarly to
228 add except it adds song(s) after the currently playing one,
229 rather than at the end. When random mode is enabled, the new
230 song is queued after the current song.
231
232 clear - Empties the queue.
233
234 crop - Remove all songs except for the currently playing
235 song.
236
237 del <songpos> - Removes a queue number from the queue. Can
238 also read input from pipes (0 deletes the current playing song).
239
240 mv, move <from> <to> - Moves song at position <from> to the
241 position <to> in the queue.
242
243 searchplay <type> <query> [<type> <query>]... - Search the
244 queue for a matching song and play it.
245
246 shuffle - Shuffles all songs on the queue.
247
248 Playlist Commands
249 load <file> - Loads <file> as queue. The option
250 --range may be used to load only a portion of the file
251
252 lsplaylists: - Lists available playlists.
253
254 playlist [<playlist>] - Lists all songs in <playlist>. If
255 no <playlist> is specified, lists all songs in the current
256 queue.
257
258 rm <file> - Deletes a specific playlist.
259
260 save <file> - Saves playlist as <file>.
261
262 Database Commands
263 listall [<file>] - Lists <file> from database. If no
264 file is specified, lists all songs in the database.
265
266 ls [<directory>] - Lists all files/folders in
267 directory. If no directory is specified, lists all files in mu‐
268 sic directory.
269
270 search <type> <query> [<type> <query>]... - Searches for
271 substrings in song tags. Any number of tag type and query com‐
272 binations can be specified. Possible tag types are: artist, al‐
273 bum, title, track, name, genre, date, composer, performer, com‐
274 ment, disc, filename, or any (to match any tag).
275
276 search <expression> - Searches with a filter expression,
277 e.g.:
278
279 mpc search '((artist == "Kraftwerk") AND (title == "Metall auf
280 Metall"))'
281
282 Check the MPD protocol documentation for details. This syntax
283 can be used with find and findadd as well. (Requires libmpd‐
284 client 2.16 and MPD 0.21)
285
286 find <type> <query> [<type> <query>]... - Same as
287 search, but tag values must match query exactly instead of doing
288 a substring match.
289
290 findadd <type> <query> [<type> <query>]... - Same as
291 find, but add the result to the current queue instead of print‐
292 ing them.
293
294 list <type> [<type> <query>]... [group <type>]... - Return
295 a list of all tags of given tag type. Optional search
296 type/query limit results in a way similar to search. Results
297 can be grouped by one or more tags. Example:
298
299 mpc list album group artist
300
301 stats - Displays statistics about MPD.
302
303 update [--wait] [<path>] - Scans for updated files in the
304 music directory. The optional parameter path (relative to the
305 music directory) may limit the scope of the update.
306
307 With --wait, mpc waits until MPD has finished the update.
308
309 rescan [--wait] [<path>] - Like update, but also rescans
310 unmodified files.
311
312 File Commands
313 albumart <file> - Download album art for the given song and
314 write it to stdout.
315
316 readpicture <file> - Download a picture embedded in the
317 given song and write it to stdout.
318
319 Mount Commands
320 mount - Lists all mounts.
321
322 mount <mount-path> <storage-uri> - Create a new mount:
323 mounts a storage on the given path. Example:
324
325 mpc mount server nfs://10.0.0.5/mp3
326 mpc mount stick udisks://by-id-ata-FOO-part2
327
328 unmount <mount-path> - Remove a mount.
329
330 listneighbors - Print a list of "neighors"
331 (i.e. automatically detected storages which can be mounted).
332 This requires enabling at least one neighbor plugin in mpd.conf.
333 Example:
334
335 $ mpc listneighbors
336 upnp://uuid:01234567-89ab-cdef-0123-456789abcdef/urn:schemas-upnp-org:service:ContentDirectory:1
337 udisks://by-id-dm-name-_dev_sdb3
338 udisks://by-id-ata-FOO-part2
339
340 Sticker Commands
341 The sticker command allows you to get and set song stickers.
342
343 sticker <file> set <key> <value> - Set the value of a song
344 sticker.
345
346 sticker <file> get <key> - Print the value of a song
347 sticker.
348
349 sticker <file> list - List all stickers of a song.
350
351 sticker <file> delete <key> - Delete a song sticker.
352
353 sticker <dir> find <key> - Search for stickers with the
354 specified name, below the specified directory.
355
356 Output Commands
357 volume [+-]<num> - Sets the volume to <num> (0-100). If
358 + or - is used, then it adjusts the volume relative to the cur‐
359 rent volume.
360
361 outputs - Lists all available outputs
362
363 disable [only] <output # or name> [...] - Disables the
364 output(s); a list of one or more names or numbers is required.
365 If only is the first argument, all other outputs are enabled.
366
367 enable [only] <output # or name> [...] - Enables the
368 output(s); a list of one or more names or numbers is required.
369 If only is the first argument, all other outputs are disabled.
370
371 toggleoutput <output # or name> [...] - Changes the
372 status for the given output(s); a list of one or more names or
373 numbers is required.
374
375 Client-to-client Commands
376 channels - List the channels that other clients have
377 subscribed to.
378
379 sendmessage <channel> <message> - Send a message to the
380 specified channel.
381
382 waitmessage <channel> - Wait for at least one message on
383 the specified channel.
384
385 subscribe <channel> - Subscribe to the specified channel
386 and continuously receive messages.
387
388 Other Commands
389 idle [events] - Waits until an event occurs. Prints a list
390 of event names, one per line. See the MPD protocol documenta‐
391 tion for further information.
392
393 If you specify a list of events, only these events are consid‐
394 ered.
395
396 idleloop [events] - Similar to idle, but
397 re-enters "idle" state after events have been printed.
398
399 If you specify a list of events, only these events are consid‐
400 ered.
401
402 status [format] - Without an argument print a three line status
403 output equivalent to "mpc" with no arguments. If a format string
404 is given then the delimiters are processed exactly as how they
405 are for metadata. See the '-f' option in Options
406
407 ┌──────────────┬────────────────────────────┐
408 │Name │ Description │
409 ├──────────────┼────────────────────────────┤
410 │%totaltime% │ The total duration of the │
411 │ │ song. │
412 ├──────────────┼────────────────────────────┤
413 │%currenttime% │ The time that the client │
414 │ │ is currently at. │
415 └──────────────┴────────────────────────────┘
416
417 │%percenttime% │ The percentage of time │
418 │ │ elapsed for the current │
419 │ │ song. │
420 ├──────────────┼────────────────────────────┤
421 │%songpos% │ The position of the cur‐ │
422 │ │ rent song within the │
423 │ │ playlist. │
424 ├──────────────┼────────────────────────────┤
425 │%length% │ The number of songs within │
426 │ │ the playlist │
427 ├──────────────┼────────────────────────────┤
428 │%state% │ Either 'playing' or │
429 │ │ 'paused' │
430 ├──────────────┼────────────────────────────┤
431 │%volume% │ The current volume spaced │
432 │ │ out to 4 characters in‐ │
433 │ │ cluding a percent sign │
434 ├──────────────┼────────────────────────────┤
435 │%random% │ Current status of random │
436 │ │ mode. 'on' or 'off' │
437 ├──────────────┼────────────────────────────┤
438 │%repeat% │ Current status of repeat │
439 │ │ mode. 'on' or 'off' │
440 ├──────────────┼────────────────────────────┤
441 │%single% │ Current status of single │
442 │ │ mode. 'on', 'once', or │
443 │ │ 'off' │
444 ├──────────────┼────────────────────────────┤
445 │%consume% │ Current status of consume │
446 │ │ mode. 'on' or 'off' │
447 └──────────────┴────────────────────────────┘
448
449 version - Reports the version of the protocol spoken, not the real
450 version of the daemon.
451
453 All environment variables are overridden by any values specified via
454 command line switches.
455
456 MPC_FORMAT
457 Configure the format used to display songs. See option
458 --format.
459
460 MPD_HOST
461 The MPD server to connect to. See option --host.
462
463 MPD_PORT
464 The TCP port of the MPD server to connect to. See option
465 --port.
466
468 Report bugs on https://github.com/MusicPlayerDaemon/mpc/issues
469
470 Since MPD uses UTF-8, mpc needs to convert characters to the charset
471 used by the local system. If you get character conversion errors when
472 you're running mpc you probably need to set up your locale. This is
473 done by setting any of the LC_CTYPE, LANG or LC_ALL environment vari‐
474 ables (LC_CTYPE only affects character handling).
475
477 mpd(1)
478
480 See
481 https://raw.githubusercontent.com/MusicPlayerDaemon/mpc/master/AUTHORS
482
484 Max Kellermann
485
487 Copyright 2003-2021 The Music Player Daemon Project
488
489
490
491
4920.34 Jul 21, 2022 MPC(1)