protocol.xml 87.2 KB
Newer Older
1
<?xml version='1.0' encoding="utf-8"?>
2 3 4
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
                      "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">

5 6 7
<book>
  <title>The Music Player Daemon protocol</title>

8
  <chapter id="syntax">
9 10 11
    <title>General protocol syntax</title>

    <section>
12 13 14
      <title>Protocol overview</title>

      <para>
15 16 17 18 19
        The <application>MPD</application> command protocol exchanges
        line-based text records between client and server over TCP.
        Once the client is connected to the server, they conduct a
        conversation until the client closes the connection. The
        conversation flow is always initiated by the client.
20
      </para>
21 22

      <para>
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
        The client transmits a command sequence, terminated by the
        newline character <constant>\n</constant>.  The server will
        respond with one or more lines, the last of which will be a
        completion code.
      </para>

      <para>
        When the client connects to the server, the server will answer
        with the following line:

        <synopsis>OK MPD version</synopsis>

        where <varname>version</varname> is a version identifier such as
        0.12.2.  This version identifier is the version of the protocol
        spoken, not the real version of the daemon.  (There is no way to
        retrieve this real version identifier from the connection.)
39
      </para>
40 41
    </section>

42
    <section id="request_syntax">
43
      <title>Requests</title>
44 45 46

      <cmdsynopsis>
        <command>COMMAND</command>
47
        <arg rep="repeat"><replaceable>ARG</replaceable></arg>
48 49
      </cmdsynopsis>

50 51 52 53 54 55 56 57 58 59
      <para>
        If arguments contain spaces, they should be surrounded by double
        quotation marks.
      </para>

      <para>
        Argument strings are separated from the command and any other
        arguments by linear white-space (' ' or '\t').
      </para>

60
      <para>
61 62
        All data between the client and the server is encoded in
        UTF-8. (Note: In UTF-8 all standard ansi characters, 0-127 are
63
        the same as in standard ansi encoding.  Also, no ansi character
64 65 66
        appears in any multi-byte characters.  So, you can use
        standard C functions like <function>strlen</function>, and
        <function>strcpy</function> just fine with UTF-8 encoded
67 68 69
        strings. For example: <returnvalue>OK</returnvalue> encoded in
        UTF-8 is simply <returnvalue>OK</returnvalue>.  For more
        information on UTF=8:
70 71 72 73
        http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8)
      </para>
    </section>

74
    <section id="response_syntax">
75 76 77
      <title>Responses</title>

      <para>
78 79 80
        A command returns <returnvalue>OK</returnvalue> on completion or
        <returnvalue>ACK some error</returnvalue> on failure.  These
        denote the end of command execution.
81
      </para>
82

83
      <section id="failure_response_syntax">
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
        <title>Failure responses</title>

        <para>
          The nature of the error can be gleaned from the information
          that follows the <returnvalue>ACK</returnvalue>.
          <returnvalue>ACK</returnvalue> lines are of the form:

          <synopsis>ACK [error@command_listNum] {current_command} message_text\n</synopsis>

          These responses are generated by a call to
          <function>commandError</function>. They contain four separate
          terms. Let's look at each of them:

          <itemizedlist>
            <listitem>
              <para>
                <returnvalue>error</returnvalue>: numeric value of one
                of the <constant>ACK_ERROR</constant> constants defined
                in <filename>ack.h</filename>.
              </para>
            </listitem>
            <listitem>
              <para>
                <returnvalue>command_listNum</returnvalue>:
                offset of the command that caused the error in a <link
                  linkend="command_lists">Command List</link>.
                An error will always cause a command list to terminate
                at the command that causes the error.
              </para>
            </listitem>
            <listitem>
              <para>
                <returnvalue>current_command</returnvalue>:
                name of the command, in a <link
                  linkend="command_lists">Command List</link>,
                that was executing when the error occurred.
              </para>
            </listitem>
            <listitem>
              <para>
                <returnvalue>message_text</returnvalue>:
                some (hopefully) informative text that describes the
                nature of the error.
              </para>
            </listitem>
          </itemizedlist>
        </para>

        <example>
          <title>foo</title>
          <para>
            An example might help. Consider the following sequence
            sent from the client to the server.

            <synopsis>
              command_list_begin
              volume 86
              play 10240
              status
              command_list_end
            </synopsis>
          </para>

          <para>
            The server responds with:

            <returnvalue>
              ACK [50@1] {play} song doesn't exist: "10240"
            </returnvalue>
          </para>

          <para>
            This tells us that the play command, which was the
            second in the list (the first or only command is
            numbered 0), failed with error 50.  The number 50
            translates to <constant>ACK_ERROR_NO_EXIST</constant>--the
            song doesn't exist.  This is reiterated by the message text
            which also tells us which song doesn't exist.
          </para>

        </example>
      </section>
166 167
    </section>

168
    <section id="command_lists">
169 170 171
      <title>Command lists</title>

      <para>
172
        To facilitate faster adding of files etc. you can pass a list
173
        of commands all at once using a command list.  The command
174
        list begins with <command>command_list_begin</command> or
175 176 177 178 179
        <command>command_list_ok_begin</command> and ends with
        <command>command_list_end</command>.
      </para>

      <para>
180 181 182 183 184 185
        It does not execute any commands until the list has ended.
        The return value is whatever the return for a list of commands
        is.  On success for all commands,
        <returnvalue>OK</returnvalue> is returned.  If a command
        fails, no more commands are executed and the appropriate
        <returnvalue>ACK</returnvalue> error is returned. If
186
        <command>command_list_ok_begin</command> is used,
187
        <returnvalue>list_OK</returnvalue> is returned for each
188 189 190
        successful command executed in the command list.
      </para>
    </section>
191

192
    <section id="range_syntax">
193 194 195 196 197 198 199 200 201 202 203 204
      <title>Ranges</title>

      <para>
        Some commands (e.g. <link
        linkend="command_delete"><command>delete</command></link>)
        allow specifying a range in the form
        <parameter>START:END</parameter> (the <varname>END</varname>
        item is not included in the range, similar to ranges in the
        Python programming language).  If <varname>END</varname> is
        omitted, then the maximum possible value is assumed.
      </para>
    </section>
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223

    <section id="tags">
      <title>Tags</title>

      <para>
        The following tags are supported by
        <application>MPD</application>:
      </para>

      <xi:include href="include/tags.xml"
                  xmlns:xi="http://www.w3.org/2001/XInclude"/>

      <para>
        There can be multiple values for some of these tags.  For
        example, <application>MPD</application> may return multiple
        lines with a <varname>performer</varname> tag.  A tag value is
        a UTF-8 string.
      </para>
    </section>
224 225
  </chapter>

226
  <chapter id="recipes">
227 228
    <title>Recipes</title>

229
    <section id="queuing_recipe">
230 231 232
      <title>Queuing</title>

      <para>
233
        Often, users run <application>MPD</application> with "<link
234 235 236 237 238 239
        linkend="command_random">random</link>" enabled, but want to
        be able to insert songs "before" the rest of the playlist.
        That is commonly called "queuing".
      </para>

      <para>
240
        <application>MPD</application> implements this by allowing the client to specify a
241 242 243 244 245 246 247 248 249
        "priority" for each song in the playlist (commands <link
        linkend="command_prio"><command>prio</command></link> and
        <link
        linkend="command_prioid"><command>prioid</command></link>).  A
        higher priority means that the song is going to be played
        before the other songs.
      </para>

      <para>
250 251 252 253 254 255 256 257 258 259 260
        In "random" mode, <application>MPD</application> maintains an
        internal randomized sequence of songs.  In this sequence,
        songs with a higher priority come first, and all songs with
        the same priority are shuffled (by default, all songs are
        shuffled, because all have the same priority "0").  When you
        increase the priority of a song, it is moved to the front of
        the sequence according to its new priority, but always after
        the current one.  A song that has been played already (it's
        "before" the current song in that sequence) will only be
        scheduled for repeated playback if its priority has become
        bigger than the priority of the current song.  Decreasing the
261
        priority of a song will move it farther to the end of the
262
        sequence.  Changing the priority of the current song has no
263 264
        effect on the sequence.  During playback, a song's priority is
        reset to zero.
265 266 267 268
      </para>
    </section>
  </chapter>

269
  <chapter id="command_reference">
270 271 272 273
    <title>Command reference</title>

    <note>
      <para>
274 275 276 277 278 279
        For manipulating playlists and playing, there are two sets of
        commands.  One set uses the song id of a song in the playlist,
        while another set uses the playlist position of the song. The
        commands using song ids should be used instead of the commands
        that manipulate and control playback based on playlist
        position. Using song ids is a safer method when multiple
280
        clients are interacting with <application>MPD</application>.
281 282 283
      </para>
    </note>

284
    <section id="status_commands">
285
      <title>Querying <application>MPD</application>'s status</title>
286 287 288 289 290 291 292 293 294 295

      <variablelist>
        <varlistentry id="command_clearerror">
          <term>
            <cmdsynopsis>
              <command>clearerror</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
296
              Clears the current error message in status (this is also
297 298 299 300 301 302 303 304 305 306 307 308
              accomplished by any command that starts playback).
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_currentsong">
          <term>
            <cmdsynopsis>
              <command>currentsong</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
309
              Displays the song info of the current song (same song that
310 311 312 313 314 315 316 317
              is identified in status).
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_idle">
          <term>
            <cmdsynopsis>
              <command>idle</command>
318
              <arg choice="opt" rep="repeat"><replaceable>SUBSYSTEMS</replaceable></arg>
319 320 321 322
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
323 324
              <footnote id="since_0_14"><simpara>Introduced with
              <application>MPD</application> 0.14</simpara></footnote>
325
              Waits until there is a noteworthy change in one or more
326 327 328 329 330
              of <application>MPD</application>'s subsystems.  As soon
              as there is one, it lists all changed systems in a line
              in the format <returnvalue>changed:
              SUBSYSTEM</returnvalue>, where SUBSYSTEM is one of the
              following:
331 332 333 334 335
            </para>
            <itemizedlist>
              <listitem>
                <para>
                  <returnvalue>database</returnvalue>: the song database
336
                  has been modified after <command>update</command>.
337 338 339 340 341 342 343 344 345
                </para>
              </listitem>
              <listitem>
                <para>
                  <returnvalue>update</returnvalue>: a database update
                  has started or finished.  If the database was
                  modified during the update, the
                  <returnvalue>database</returnvalue> event is also
                  emitted.
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
                </para>
              </listitem>
              <listitem>
                <para>
                  <returnvalue>stored_playlist</returnvalue>: a stored
                  playlist has been modified, renamed, created or
                  deleted
                </para>
              </listitem>
              <listitem>
                <para>
                  <returnvalue>playlist</returnvalue>: the current
                  playlist has been modified
                </para>
              </listitem>
              <listitem>
                <para>
                  <returnvalue>player</returnvalue>: the player has been
                  started, stopped or seeked
                </para>
              </listitem>
              <listitem>
                <para>
                  <returnvalue>mixer</returnvalue>: the volume has been
                  changed
                </para>
              </listitem>
              <listitem>
                <para>
                  <returnvalue>output</returnvalue>: an audio output has
                  been enabled or disabled
                </para>
              </listitem>
              <listitem>
                <para>
                  <returnvalue>options</returnvalue>: options like
382
                  <option>repeat</option>, <option>random</option>,
383
                  <option>crossfade</option>, replay gain
384 385
                </para>
              </listitem>
386 387 388 389 390 391
              <listitem>
                <para>
                    <returnvalue>sticker</returnvalue>: the sticker database
                    has been modified.
                </para>
              </listitem>
392 393 394 395 396 397 398 399 400 401 402 403 404
              <listitem>
                <para>
                  <returnvalue>subscription</returnvalue>: a client
                  has subscribed or unsubscribed to a channel
                </para>
              </listitem>
              <listitem>
                <para>
                  <returnvalue>message</returnvalue>: a message was
                  received on a channel this client is subscribed to;
                  this event is only emitted when the queue is empty
                </para>
              </listitem>
405 406
            </itemizedlist>
            <para>
407
              While a client is waiting for <command>idle</command>
408 409 410 411
              results, the server disables timeouts, allowing a client
              to wait for events as long as mpd runs.  The
              <command>idle</command> command can be canceled by
              sending the command <command>noidle</command> (no other
412 413 414
              commands are allowed). <application>MPD</application>
              will then leave <command>idle</command> mode and print
              results immediately; might be empty at this time.
415
            </para>
416
            <para>
417 418 419 420
              If the optional <varname>SUBSYSTEMS</varname> argument
              is used, <application>MPD</application> will only send
              notifications when something changed in one of the
              specified subsytems.
421
            </para>
422 423 424 425 426 427 428 429 430 431
          </listitem>
        </varlistentry>
        <varlistentry id="command_status">
          <term>
            <cmdsynopsis>
              <command>status</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
432 433
              Reports the current status of the player and the volume
              level.
434
            </para>
435 436 437 438 439 440 441 442 443 444 445 446 447
            <itemizedlist>
              <listitem>
                <para>
                  <varname>volume</varname>:
                  <returnvalue>0-100</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>repeat</varname>:
                  <returnvalue>0 or 1</returnvalue>
                </para>
              </listitem>
448 449 450 451 452 453
              <listitem>
                <para>
                  <varname>random</varname>:
                  <returnvalue>0 or 1</returnvalue>
                </para>
              </listitem>
454 455
              <listitem>
               <para>
456
                <varname>single</varname>:
457
                <footnote id="since_0_15"><simpara>Introduced with <application>MPD</application> 0.15</simpara></footnote>
458 459 460
                <returnvalue>0 or 1</returnvalue>
               </para>
              </listitem>
461 462 463
              <listitem>
               <para>
                <varname>consume</varname>:
464
                <footnoteref linkend="since_0_15"/>
465
                <returnvalue>0 or 1</returnvalue>
466 467
               </para>
              </listitem>
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
              <listitem>
                <para>
                  <varname>playlist</varname>:
                  <returnvalue>31-bit unsigned integer, the playlist
                  version number</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>playlistlength</varname>:
                  <returnvalue>integer, the length of the
                  playlist</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>state</varname>:
                  <returnvalue>play, stop, or pause</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>song</varname>:
491 492 493
                  <returnvalue> playlist song number of the current
                  song stopped on or playing
                  </returnvalue>
494 495 496 497 498
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>songid</varname>:
499 500 501
                  <returnvalue>playlist songid of the current song
                  stopped on or playing
                  </returnvalue>
502 503
                </para>
              </listitem>
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
              <listitem>
                <para>
                  <varname>nextsong</varname>:
                  <footnoteref linkend="since_0_15"/>
                  <returnvalue> playlist song number of the next
                  song to be played
                  </returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>nextsongid</varname>:
                  <footnoteref linkend="since_0_15"/>
                  <returnvalue>playlist songid of the next song
                  to be played
                  </returnvalue>
520 521 522 523 524
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>time</varname>:
525
                  <returnvalue>total time elapsed (of current
526 527 528
                  playing/paused song)</returnvalue>
                </para>
              </listitem>
529 530 531
              <listitem>
                <para>
                  <varname>elapsed</varname>:
532
                  <footnote id="since_0_16"><simpara>Introduced with <application>MPD</application> 0.16</simpara></footnote>
533 534 535 536 537 538
                  <returnvalue>
                    Total time elapsed within the current song, but
                    with higher resolution.
                  </returnvalue>
                </para>
              </listitem>
539 540 541 542 543 544 545 546 547
              <listitem>
                <para>
                  <varname>duration</varname>:
                  <footnote id="since_0_20"><simpara>Introduced with <application>MPD</application> 0.20</simpara></footnote>
                  <returnvalue>
                    Duration of the current song in seconds.
                  </returnvalue>
                </para>
              </listitem>
548 549 550 551 552 553 554 555 556 557 558 559 560
              <listitem>
                <para>
                  <varname>bitrate</varname>:
                  <returnvalue>instantaneous bitrate in
                  kbps</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>xfade</varname>:
                  <returnvalue>crossfade in seconds</returnvalue>
                </para>
              </listitem>
561 562 563 564 565 566 567 568 569 570 571 572
              <listitem>
                <para>
                  <varname>mixrampdb</varname>:
                  <returnvalue>mixramp threshold in dB</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>mixrampdelay</varname>:
                  <returnvalue>mixrampdelay in seconds</returnvalue>
                </para>
              </listitem>
573 574 575 576 577 578 579 580
              <listitem>
                <para>
                  <varname>audio</varname>:
                  <returnvalue>sampleRate:bits:channels</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
Simon Hengel's avatar
Simon Hengel committed
581
                  <varname>updating_db</varname>:
582 583 584 585 586 587 588 589 590
                  <returnvalue>job id</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>error</varname>:
                  <returnvalue>if there is an error, returns message
                  here</returnvalue>
                </para>
591
                </listitem>
592
            </itemizedlist>
593 594 595 596 597 598 599 600 601 602
          </listitem>
        </varlistentry>
        <varlistentry id="command_stats">
          <term>
            <cmdsynopsis>
              <command>stats</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
603
              Displays statistics.
604 605 606 607 608 609 610 611 612
            </para>
            <itemizedlist>
              <listitem>
                <para>
                  <varname>artists</varname>: number of artists
                </para>
              </listitem>
              <listitem>
                <para>
613 614 615 616 617 618
                  <varname>albums</varname>: number of albums
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>songs</varname>: number of songs
619 620 621 622 623 624 625 626 627 628
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>uptime</varname>: daemon uptime in seconds
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>db_playtime</varname>: sum of all song
629
                  times in the db
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>db_update</varname>: last db update in UNIX
                  time
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>playtime</varname>: time length of music played
                </para>
              </listitem>
            </itemizedlist>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

649
    <section id="playback_option_commands">
650 651
      <title>Playback options</title>

Jeffrey Middleton's avatar
Jeffrey Middleton committed
652
      <variablelist>
653 654 655 656 657 658 659 660 661
        <varlistentry id="command_consume">
          <term>
            <cmdsynopsis>
              <command>consume</command>
              <arg choice="req"><replaceable>STATE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
662
              <footnoteref linkend="since_0_15"/>
663 664 665 666 667 668
              Sets consume state to <varname>STATE</varname>,
              <varname>STATE</varname> should be 0 or 1.
	      When consume is activated, each song played is removed from playlist.
            </para>
          </listitem>
        </varlistentry>
669 670 671 672 673 674 675 676 677 678 679 680 681
        <varlistentry id="command_crossfade">
          <term>
            <cmdsynopsis>
              <command>crossfade</command>
              <arg choice="req"><replaceable>SECONDS</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Sets crossfading between songs.
            </para>
          </listitem>
        </varlistentry>
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707
        <varlistentry id="command_mixrampdb">
          <term>
            <cmdsynopsis>
              <command>mixrampdb</command>
              <arg choice="req"><replaceable>deciBels</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Sets the threshold at which songs will be overlapped. Like crossfading but doesn't fade the track volume, just overlaps. The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume so use negative values, I prefer -17dB. In the absence of mixramp tags crossfading will be used. See http://sourceforge.net/projects/mixramp
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_mixrampdelay">
          <term>
            <cmdsynopsis>
              <command>mixrampdelay</command>
              <arg choice="req"><replaceable>SECONDS</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Additional time subtracted from the overlap calculated by mixrampdb. A value of "nan" disables MixRamp overlapping and falls back to crossfading.
            </para>
          </listitem>
        </varlistentry>
708 709 710 711 712 713 714 715 716
        <varlistentry id="command_random">
          <term>
            <cmdsynopsis>
              <command>random</command>
              <arg choice="req"><replaceable>STATE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
717 718
              Sets random state to <varname>STATE</varname>,
              <varname>STATE</varname> should be 0 or 1.
719 720 721 722 723 724 725 726 727 728 729 730
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_repeat">
          <term>
            <cmdsynopsis>
              <command>repeat</command>
              <arg choice="req"><replaceable>STATE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
731
              Sets repeat state to <varname>STATE</varname>,
732 733 734 735 736 737 738 739 740 741 742 743 744
              <varname>STATE</varname> should be 0 or 1.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_setvol">
          <term>
            <cmdsynopsis>
              <command>setvol</command>
              <arg choice="req"><replaceable>VOL</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
745
              Sets volume to <varname>VOL</varname>, the range of
746 747
              volume is 0-100.
            </para>
748 749
          </listitem>
        </varlistentry>
750
        <varlistentry id="command_single">
751 752
          <term>
            <cmdsynopsis>
753
              <command>single</command>
754 755 756 757 758
              <arg choice="req"><replaceable>STATE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
759
              <footnoteref linkend="since_0_15"/>
760
              Sets single state to <varname>STATE</varname>,
761
              <varname>STATE</varname> should be 0 or 1.
762 763
	      When single is activated, playback is stopped after current song, or
	      song is repeated if the 'repeat' mode is enabled.
764
            </para>
765 766
          </listitem>
        </varlistentry>
767 768 769 770 771 772 773 774 775 776 777 778
        <varlistentry id="command_replay_gain_mode">
          <term>
            <cmdsynopsis>
              <command>replay_gain_mode</command>
              <arg choice="req"><replaceable>MODE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Sets the replay gain mode.  One of
              <parameter>off</parameter>,
              <parameter>track</parameter>,
779 780 781
              <parameter>album</parameter>,
              <parameter>auto</parameter><footnote
                        id="replay_gain_auto_since_0_16">
782
                <simpara>added in <application>MPD</application> 0.16</simpara>
783
              </footnote>.
784 785 786 787 788 789
            </para>
            <para>
              Changing the mode during playback may take several
              seconds, because the new settings does not affect the
              buffered data.
            </para>
790 791 792 793
            <para>
              This command triggers the
              <returnvalue>options</returnvalue> idle event.
            </para>
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809
          </listitem>
        </varlistentry>
        <varlistentry id="command_replay_gain_status">
          <term>
            <cmdsynopsis>
              <command>replay_gain_status</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Prints replay gain options.  Currently, only the
              variable <varname>replay_gain_mode</varname> is
              returned.
            </para>
          </listitem>
        </varlistentry>
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828
        <varlistentry id="command_volume">
          <term>
            <cmdsynopsis>
              <command>volume</command>
              <arg choice="req"><replaceable>CHANGE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Changes volume by amount <varname>CHANGE</varname>.
            </para>
            <note>
              <para>
                <command>volume</command> is deprecated, use
                <command>setvol</command> instead.
              </para>
            </note>
          </listitem>
        </varlistentry>
829 830 831
      </variablelist>
    </section>

832
    <section id="playback_commands">
833 834 835
      <title>Controlling playback</title>

      <variablelist>
836
        <varlistentry id="command_next">
837 838
          <term>
            <cmdsynopsis>
839
              <command>next</command>
840 841 842 843
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
844
              Plays next song in the playlist.
845 846 847
            </para>
          </listitem>
        </varlistentry>
848
        <varlistentry id="command_pause">
849 850
          <term>
            <cmdsynopsis>
851 852
              <command>pause</command>
              <arg choice="req"><replaceable>PAUSE</replaceable></arg>
853 854 855 856
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
857
              Toggles pause/resumes playing, <varname>PAUSE</varname> is 0 or 1.
858
            </para>
859 860 861 862 863 864
            <note>
              <para>
                The use of pause command w/o the PAUSE argument is
                deprecated.
              </para>
            </note>
865 866
          </listitem>
        </varlistentry>
867
        <varlistentry id="command_play">
868 869
          <term>
            <cmdsynopsis>
870 871
              <command>play</command>
              <arg><replaceable>SONGPOS</replaceable></arg>
872 873 874 875
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
876 877
              Begins playing the playlist at song number
              <varname>SONGPOS</varname>.
878 879 880
            </para>
          </listitem>
        </varlistentry>
881
        <varlistentry id="command_playid">
882 883
          <term>
            <cmdsynopsis>
884 885
              <command>playid</command>
              <arg><replaceable>SONGID</replaceable></arg>
886 887 888 889
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
890 891
              Begins playing the playlist at song
              <varname>SONGID</varname>.
892 893 894
            </para>
          </listitem>
        </varlistentry>
895
        <varlistentry id="command_previous">
896 897
          <term>
            <cmdsynopsis>
898
              <command>previous</command>
899 900 901 902
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
903
              Plays previous song in the playlist.
904 905 906
            </para>
          </listitem>
        </varlistentry>
907

908 909 910 911 912 913 914 915 916 917 918
        <varlistentry id="command_seek">
          <term>
            <cmdsynopsis>
              <command>seek</command>
              <arg choice="req"><replaceable>SONGPOS</replaceable></arg>
              <arg choice="req"><replaceable>TIME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Seeks to the position <varname>TIME</varname> (in
919 920
              seconds; fractions allowed) of entry
              <varname>SONGPOS</varname> in the playlist.
921 922 923 924 925 926 927 928 929 930 931 932 933 934
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_seekid">
          <term>
            <cmdsynopsis>
              <command>seekid</command>
              <arg choice="req"><replaceable>SONGID</replaceable></arg>
              <arg choice="req"><replaceable>TIME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Seeks to the position <varname>TIME</varname> (in
935 936
              seconds; fractions allowed) of song
              <varname>SONGID</varname>.
937 938 939
            </para>
          </listitem>
        </varlistentry>
940 941 942 943 944 945 946 947 948 949

        <varlistentry id="command_seekcur">
          <term>
            <cmdsynopsis>
              <command>seekcur</command>
              <arg choice="req"><replaceable>TIME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
950 951 952 953
              Seeks to the position <varname>TIME</varname> (in
              seconds; fractions allowed) within the current song.  If
              prefixed by '+' or '-', then the time is relative to the
              current playing position.
954 955 956 957
            </para>
          </listitem>
        </varlistentry>

958 959 960 961 962 963 964 965
        <varlistentry id="command_stop">
          <term>
            <cmdsynopsis>
              <command>stop</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
966
              Stops playing.
967 968 969 970 971 972
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

973
    <section id="queue">
974 975 976 977 978 979 980 981 982 983 984 985
      <title>The current playlist</title>

      <variablelist>
        <varlistentry id="command_add">
          <term>
            <cmdsynopsis>
              <command>add</command>
              <arg choice="req"><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
986 987 988
              Adds the file <varname>URI</varname> to the playlist
              (directories add recursively). <varname>URI</varname>
              can also be a single file.
989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_addid">
          <term>
            <cmdsynopsis>
              <command>addid</command>
              <arg choice="req"><replaceable>URI</replaceable></arg>
              <arg><replaceable>POSITION</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Adds a song to the playlist (non-recursive) and returns the song id.
            </para>
            <para>
              <varname>URI</varname> is always a single file or
1006
              URL.  For example:
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030
            </para>
            <screen>
addid "foo.mp3"
Id: 999
OK
            </screen>
          </listitem>
        </varlistentry>
        <varlistentry id="command_clear">
          <term>
            <cmdsynopsis>
              <command>clear</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Clears the current playlist.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_delete">
          <term>
            <cmdsynopsis>
              <command>delete</command>
1031 1032 1033 1034
              <group>
                <arg choice="req"><replaceable>POS</replaceable></arg>
                <arg choice="req"><replaceable>START:END</replaceable></arg>
              </group>
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Deletes a song from the playlist.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_deleteid">
          <term>
            <cmdsynopsis>
              <command>deleteid</command>
              <arg choice="req"><replaceable>SONGID</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1052 1053
              Deletes the song <varname>SONGID</varname> from the
              playlist
1054 1055 1056 1057 1058 1059 1060
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_move">
          <term>
            <cmdsynopsis>
              <command>move</command>
1061 1062 1063 1064
              <group>
                  <arg choice="req"><replaceable>FROM</replaceable></arg>
                  <arg choice="req"><replaceable>START:END</replaceable></arg>
              </group>
1065 1066 1067 1068 1069
              <arg choice="req"><replaceable>TO</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1070 1071 1072
              Moves the song at <varname>FROM</varname> or range of songs
              at <varname>START:END</varname> to <varname>TO</varname>
              in the playlist.
1073
              <footnote id="range_since_0_15">
1074
                <simpara>Ranges are supported since <application>MPD</application> 0.15</simpara>
1075
              </footnote>
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_moveid">
          <term>
            <cmdsynopsis>
              <command>moveid</command>
              <arg choice="req"><replaceable>FROM</replaceable></arg>
              <arg choice="req"><replaceable>TO</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1089 1090
              Moves the song with <varname>FROM</varname> (songid) to
              <varname>TO</varname> (playlist index) in the
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113
              playlist.  If <varname>TO</varname> is negative, it
              is relative to the current song in the playlist (if
              there is one).
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_playlist">
          <term>
            <cmdsynopsis>
              <command>playlist</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Displays the current playlist.
            </para>
            <note>
              <para>
                Do not use this, instead use <command>playlistinfo</command>.
              </para>
            </note>
          </listitem>
        </varlistentry>
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
        <varlistentry id="command_playlistfind">
          <term>
            <cmdsynopsis>
              <command>playlistfind</command>
              <arg choice="req"><replaceable>TAG</replaceable></arg>
              <arg choice="req"><replaceable>NEEDLE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Finds songs in the current playlist with strict
              matching.
            </para>
          </listitem>
        </varlistentry>
1129 1130 1131 1132 1133 1134 1135 1136 1137
        <varlistentry id="command_playlistid">
          <term>
            <cmdsynopsis>
              <command>playlistid</command>
              <arg choice="req"><replaceable>SONGID</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1138
              Displays a list of songs in the playlist.
1139 1140 1141 1142 1143 1144 1145 1146 1147
              <varname>SONGID</varname> is optional and specifies a
              single song to display info for.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_playlistinfo">
          <term>
            <cmdsynopsis>
              <command>playlistinfo</command>
1148 1149 1150 1151
              <group>
                  <arg><replaceable>SONGPOS</replaceable></arg>
                  <arg><replaceable>START:END</replaceable></arg>
              </group>
1152 1153 1154 1155
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1156 1157 1158 1159
              Displays a list of all songs in the playlist, or if the optional
              argument is given, displays information only for the song
              <varname>SONGPOS</varname> or the range of songs
              <varname>START:END</varname>
1160
              <footnoteref linkend="range_since_0_15"/>
1161 1162 1163
            </para>
          </listitem>
        </varlistentry>
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173
        <varlistentry id="command_playlistsearch">
          <term>
            <cmdsynopsis>
              <command>playlistsearch</command>
              <arg choice="req"><replaceable>TAG</replaceable></arg>
              <arg choice="req"><replaceable>NEEDLE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1174
              Searches case-insensitively for partial matches in the
1175 1176 1177 1178
              current playlist.
            </para>
          </listitem>
        </varlistentry>
1179 1180 1181 1182 1183
        <varlistentry id="command_plchanges">
          <term>
            <cmdsynopsis>
              <command>plchanges</command>
              <arg choice="req"><replaceable>VERSION</replaceable></arg>
1184
              <arg><replaceable>START:END</replaceable></arg>
1185 1186 1187 1188 1189
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Displays changed songs currently in the playlist since
1190 1191 1192
              <varname>VERSION</varname>.  Start and end positions may
              be given to limit the output to changes in the given
              range.
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204
            </para>
            <para>
              To detect songs that were deleted at the end of the
              playlist, use playlistlength returned by status command.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_plchangesposid">
          <term>
            <cmdsynopsis>
              <command>plchangesposid</command>
              <arg choice="req"><replaceable>VERSION</replaceable></arg>
1205
              <arg><replaceable>START:END</replaceable></arg>
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Displays changed songs currently in the playlist since
              <varname>VERSION</varname>.  This function only
              returns the position and the id of the changed song, not
              the complete metadata. This is more bandwidth efficient.
            </para>
            <para>
              To detect songs that were deleted at the end of the
              playlist, use playlistlength returned by status command.
            </para>
          </listitem>
        </varlistentry>
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260

        <varlistentry id="command_prio">
          <term>
            <cmdsynopsis>
              <command>prio</command>
              <arg choice="req"><replaceable>PRIORITY</replaceable></arg>
              <arg choice="req" rep="repeat"><replaceable>START:END</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Set the priority of the specified songs.  A higher
              priority means that it will be played first when
              "random" mode is enabled.
            </para>

            <para>
              A priority is an integer between 0 and 255.  The default
              priority of new songs is 0.
            </para>
          </listitem>
        </varlistentry>

        <varlistentry id="command_prioid">
          <term>
            <cmdsynopsis>
              <command>prioid</command>
              <arg choice="req"><replaceable>PRIORITY</replaceable></arg>
              <arg choice="req" rep="repeat"><replaceable>ID</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Same as <link
              linkend="command_prio"><command>prio</command></link>,
              but address the songs with their id.
            </para>
          </listitem>
        </varlistentry>

1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
        <varlistentry id="command_rangeid">
          <term>
            <cmdsynopsis>
              <command>rangeid</command>
              <arg choice="req"><replaceable>ID</replaceable></arg>
              <arg choice="req"><replaceable>START:END</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1271
              <footnote id="since_0_19"><simpara>Since <application>MPD</application>
1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282
              0.19</simpara></footnote> Specifies the portion of the
              song that shall be played.  <varname>START</varname> and
              <varname>END</varname> are offsets in seconds
              (fractional seconds allowed); both are optional.
              Omitting both (i.e. sending just ":") means "remove the
              range, play everything".  A song that is currently
              playing cannot be manipulated this way.
            </para>
          </listitem>
        </varlistentry>

1283 1284 1285 1286
        <varlistentry id="command_shuffle">
          <term>
            <cmdsynopsis>
              <command>shuffle</command>
1287
              <arg><replaceable>START:END</replaceable></arg>
1288 1289 1290 1291 1292
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Shuffles the current playlist.
1293
              <varname>START:END</varname> is optional and specifies
1294
              a range of songs.
1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_swap">
          <term>
            <cmdsynopsis>
              <command>swap</command>
              <arg choice="req"><replaceable>SONG1</replaceable></arg>
              <arg choice="req"><replaceable>SONG2</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1308
              Swaps the positions of <varname>SONG1</varname> and
1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322
              <varname>SONG2</varname>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_swapid">
          <term>
            <cmdsynopsis>
              <command>swapid</command>
              <arg choice="req"><replaceable>SONG1</replaceable></arg>
              <arg choice="req"><replaceable>SONG2</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1323
              Swaps the positions of <varname>SONG1</varname> and
1324 1325 1326 1327
              <varname>SONG2</varname> (both song ids).
            </para>
          </listitem>
        </varlistentry>
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365

        <varlistentry id="command_addtagid">
          <term>
            <cmdsynopsis>
              <command>addtagid</command>
              <arg choice="req"><replaceable>SONGID</replaceable></arg>
              <arg choice="req"><replaceable>TAG</replaceable></arg>
              <arg choice="req"><replaceable>VALUE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Adds a tag to the specified song.  Editing song tags is
              only possible for remote songs.  This change is
              volatile: it may be overwritten by tags received from
              the server, and the data is gone when the song gets
              removed from the queue.
            </para>
          </listitem>
        </varlistentry>

        <varlistentry id="command_cleartagid">
          <term>
            <cmdsynopsis>
              <command>cleartagid</command>
              <arg choice="req"><replaceable>SONGID</replaceable></arg>
              <arg choice="opt"><replaceable>TAG</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Removes tags from the specified song.  If
              <varname>TAG</varname> is not specified, then all tag
              values will be removed.  Editing song tags is only
              possible for remote songs.
            </para>
          </listitem>
        </varlistentry>
1366 1367 1368
      </variablelist>
    </section>

1369
    <section id="playlist_files">
1370 1371
      <title>Stored playlists</title>

1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385
      <para>
        Playlists are stored inside the configured playlist directory.
        They are addressed with their file name (without the directory
        and without the <filename>.m3u</filename> suffix).
      </para>

      <para>
        Some of the commands described in this section can be used to
        run playlist plugins instead of the hard-coded simple
        <filename>m3u</filename> parser.  They can access playlists in
        the music directory (relative path including the suffix) or
        remote playlists (absolute URI with a supported scheme).
      </para>

1386
      <variablelist>
1387
        <varlistentry id="command_listplaylist">
1388 1389
          <term>
            <cmdsynopsis>
1390
              <command>listplaylist</command>
1391 1392 1393 1394 1395
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1396 1397
              Lists the songs in the playlist.  Playlist plugins are
              supported.
1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_listplaylistinfo">
          <term>
            <cmdsynopsis>
              <command>listplaylistinfo</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1410 1411
              Lists the songs with metadata in the playlist.  Playlist
              plugins are supported.
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_listplaylists">
          <term>
            <cmdsynopsis>
              <command>listplaylists</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Prints a list of the playlist directory.
            </para>
            <para>
1426
              After each playlist name the server sends its last
1427 1428 1429 1430 1431 1432 1433
              modification time as attribute "Last-Modified" in ISO
              8601 format.  To avoid problems due to clock differences
              between clients and the server, clients should not
              compare this value with their local clock.
            </para>
          </listitem>
        </varlistentry>
1434 1435 1436 1437 1438
        <varlistentry id="command_load">
          <term>
            <cmdsynopsis>
              <command>load</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
1439
              <arg choice="opt"><replaceable>START:END</replaceable></arg>
1440 1441 1442 1443
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1444
              Loads the playlist into the current queue.  Playlist
1445 1446
              plugins are supported.  A range may be specified to load
              only a part of the playlist.
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_playlistadd">
          <term>
            <cmdsynopsis>
              <command>playlistadd</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
              <arg choice="req"><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Adds <varname>URI</varname> to the playlist
              <filename>NAME.m3u</filename>.
            </para>
            <para>
             <filename>NAME.m3u</filename> will be created if it does
             not exist.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_playlistclear">
          <term>
            <cmdsynopsis>
              <command>playlistclear</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Clears the playlist <filename>NAME.m3u</filename>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_playlistdelete">
          <term>
            <cmdsynopsis>
              <command>playlistdelete</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
1487
              <arg choice="req"><replaceable>SONGPOS</replaceable></arg>
1488 1489 1490 1491
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1492
              Deletes <varname>SONGPOS</varname> from the
1493 1494 1495 1496 1497 1498 1499 1500 1501
              playlist <filename>NAME.m3u</filename>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_playlistmove">
          <term>
            <cmdsynopsis>
              <command>playlistmove</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
1502 1503
              <arg choice="req"><replaceable>FROM</replaceable></arg>
              <arg choice="req"><replaceable>TO</replaceable></arg>
1504 1505 1506 1507
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1508 1509 1510
              Moves the song at position <varname>FROM</varname> in
              the playlist <filename>NAME.m3u</filename> to the
              position <varname>TO</varname>.
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_rename">
          <term>
            <cmdsynopsis>
              <command>rename</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
              <arg choice="req"><replaceable>NEW_NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Renames the playlist <filename>NAME.m3u</filename> to <filename>NEW_NAME.m3u</filename>.
            </para>
          </listitem>
        </varlistentry>
1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558
        <varlistentry id="command_rm">
          <term>
            <cmdsynopsis>
              <command>rm</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Removes the playlist <filename>NAME.m3u</filename> from
              the playlist directory.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_save">
          <term>
            <cmdsynopsis>
              <command>save</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Saves the current playlist to
              <filename>NAME.m3u</filename> in the playlist directory.
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

1559
    <section id="database">
1560 1561 1562
      <title>The music database</title>

      <variablelist>
1563

1564 1565 1566 1567 1568 1569
        <varlistentry id="command_count">
          <term>
            <cmdsynopsis>
              <command>count</command>
              <arg choice="req"><replaceable>TAG</replaceable></arg>
              <arg choice="req"><replaceable>NEEDLE</replaceable></arg>
1570
              <arg choice="opt"><replaceable>...</replaceable></arg>
1571 1572
              <arg choice="opt">group</arg>
              <arg choice="opt"><replaceable>GROUPTYPE</replaceable></arg>
1573 1574 1575 1576 1577 1578 1579
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Counts the number of songs and their total playtime in
              the db matching <varname>TAG</varname> exactly.
            </para>
1580 1581 1582 1583 1584 1585
            <para>
              The <parameter>group</parameter> keyword may be used to
              group the results by a tag.  The following prints
              per-artist counts:
            </para>
            <programlisting>count group artist</programlisting>
1586 1587
          </listitem>
        </varlistentry>
1588

1589 1590 1591 1592 1593 1594
        <varlistentry id="command_find">
          <term>
            <cmdsynopsis>
              <command>find</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>WHAT</replaceable></arg>
1595
              <arg choice="opt"><replaceable>...</replaceable></arg>
1596
              <arg choice="opt">window <replaceable>START</replaceable>:<replaceable>END</replaceable></arg>
1597 1598 1599 1600
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1601
              Finds songs in the db that are exactly
1602
              <varname>WHAT</varname>.  <varname>TYPE</varname> can
1603
              be any tag supported by <application>MPD</application>, or one of the special
1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627
              parameters:
            </para>

            <itemizedlist>
              <listitem>
                <para>
                  <parameter>any</parameter> checks all tag values
                </para>
              </listitem>

              <listitem>
                <para>
                  <parameter>file</parameter> checks the full path
                  (relative to the music directory)
                </para>
              </listitem>

              <listitem>
                <para>
                  <parameter>base</parameter> restricts the search to
                  songs in the given directory (also relative to the
                  music directory)
                </para>
              </listitem>
1628 1629 1630 1631 1632 1633 1634 1635

              <listitem>
                <para>
                  <parameter>modified-since</parameter> compares the
                  file's time stamp with the given value (ISO 8601 or
                  UNIX time stamp)
                </para>
              </listitem>
1636 1637 1638 1639
            </itemizedlist>

            <para>
              <varname>WHAT</varname> is what to find.
1640
            </para>
1641 1642 1643 1644 1645 1646 1647

            <para>
              <varname>window</varname> can be used to query only a
              portion of the real response.  The parameter is two
              zero-based record numbers; a start number and an end
              number.
            </para>
1648 1649
          </listitem>
        </varlistentry>
1650 1651 1652 1653 1654 1655
        <varlistentry id="command_findadd">
          <term>
            <cmdsynopsis>
              <command>findadd</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>WHAT</replaceable></arg>
1656
              <arg choice="opt"><replaceable>...</replaceable></arg>
1657 1658 1659 1660 1661 1662
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Finds songs in the db that are exactly
              <varname>WHAT</varname> and adds them to current playlist.
1663
              Parameters have the same meaning as for <command>find</command>.
1664 1665 1666
            </para>
          </listitem>
        </varlistentry>
1667

1668 1669 1670 1671 1672
        <varlistentry id="command_list">
          <term>
            <cmdsynopsis>
              <command>list</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
1673 1674 1675
              <arg choice="opt"><replaceable>FILTERTYPE</replaceable></arg>
              <arg choice="opt"><replaceable>FILTERWHAT</replaceable></arg>
              <arg choice="opt"><replaceable>...</replaceable></arg>
1676 1677 1678
              <arg choice="opt">group</arg>
              <arg choice="opt"><replaceable>GROUPTYPE</replaceable></arg>
              <arg choice="opt"><replaceable>...</replaceable></arg>
1679 1680 1681 1682
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1683
              Lists unique tags values of the specified type.
1684 1685
              <varname>TYPE</varname> can be any tag supported by
              <application>MPD</application> or
1686
              <parameter>file</parameter>.
1687 1688
            </para>
            <para>
1689 1690 1691 1692
              Additional arguments may specify a filter like the one
              in the <link
              linkend="command_find"><command>find</command>
              command</link>.
1693
            </para>
1694 1695 1696 1697 1698 1699 1700
            <para>
              The <parameter>group</parameter> keyword may be used
              (repeatedly) to group the results by one or more tags.
              The following example lists all album names,
              grouped by their respective (album) artist:
            </para>
            <programlisting>list album group albumartist</programlisting>
1701 1702
          </listitem>
        </varlistentry>
1703

1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715
        <varlistentry id="command_listall">
          <term>
            <cmdsynopsis>
              <command>listall</command>
              <arg><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Lists all songs and directories in
              <varname>URI</varname>.
            </para>
1716 1717
            <para>
              Do not use this command.  Do not manage a client-side
1718 1719 1720 1721 1722
              copy of <application>MPD</application>'s database.  That
              is fragile and adds huge overhead.  It will break with
              large databases.  Instead, query
              <application>MPD</application> whenever you need
              something.
1723
            </para>
1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737
          </listitem>
        </varlistentry>
        <varlistentry id="command_listallinfo">
          <term>
            <cmdsynopsis>
              <command>listallinfo</command>
              <arg><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Same as <command>listall</command>, except it also
              returns metadata info in the same format as
              <command>lsinfo</command>.
1738 1739 1740
            </para>
            <para>
              Do not use this command.  Do not manage a client-side
1741 1742 1743 1744 1745
              copy of <application>MPD</application>'s database.  That
              is fragile and adds huge overhead.  It will break with
              large databases.  Instead, query
              <application>MPD</application> whenever you need
              something.
1746 1747 1748
            </para>
          </listitem>
        </varlistentry>
1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759
        <varlistentry id="command_listfiles">
          <term>
            <cmdsynopsis>
              <command>listfiles</command>
              <arg><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Lists the contents of the directory
              <varname>URI</varname>, including files are not
1760 1761 1762 1763 1764 1765 1766
              recognized by <application>MPD</application>.
              <varname>URI</varname> can be a path relative to the
              music directory or an URI understood by one of the
              storage plugins.  The response contains at least one
              line for each directory entry with the prefix "file: "
              or "directory: ", and may be followed by file attributes
              such as "Last-Modified" and "size".
1767 1768 1769 1770 1771 1772 1773 1774
            </para>
            <para>
              For example, "smb://SERVER" returns a list of all shares
              on the given SMB/CIFS server; "nfs://servername/path"
              obtains a directory listing from the NFS server.
            </para>
          </listitem>
        </varlistentry>
1775 1776 1777 1778 1779 1780 1781 1782 1783
        <varlistentry id="command_lsinfo">
          <term>
            <cmdsynopsis>
              <command>lsinfo</command>
              <arg><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1784 1785
              Lists the contents of the directory
              <varname>URI</varname>.
1786 1787 1788 1789 1790 1791
            </para>
            <para>
              When listing the root directory, this currently returns
              the list of stored playlists.  This behavior is
              deprecated; use "listplaylists" instead.
            </para>
1792 1793 1794 1795
            <para>
              This command may be used to list metadata of remote
              files (e.g. URI beginning with "http://" or "smb://").
            </para>
1796 1797 1798
            <para>
              Clients that are connected via UNIX domain socket may
              use this command to read the tags of an arbitrary local
1799
              file (URI is an absolute path).
1800
            </para>
1801 1802
          </listitem>
        </varlistentry>
1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813
        <varlistentry id="command_readcomments">
          <term>
            <cmdsynopsis>
              <command>readcomments</command>
              <arg><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Read "comments" (i.e. key-value pairs) from the file
              specified by "URI".  This "URI" can be a path relative
1814
              to the music directory or an absolute path.
1815
            </para>
1816 1817 1818 1819
            <para>
              This command may be used to list metadata of remote
              files (e.g. URI beginning with "http://" or "smb://").
            </para>
1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831
            <para>
              The response consists of lines in the form "KEY: VALUE".
              Comments with suspicious characters (e.g. newlines) are
              ignored silently.
            </para>
            <para>
              The meaning of these depends on the codec, and not all
              decoder plugins support it.  For example, on Ogg files,
              this lists the Vorbis comments.
            </para>
          </listitem>
        </varlistentry>
1832 1833 1834 1835 1836 1837
        <varlistentry id="command_search">
          <term>
            <cmdsynopsis>
              <command>search</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>WHAT</replaceable></arg>
1838
              <arg choice="opt"><replaceable>...</replaceable></arg>
1839
              <arg choice="opt">window <replaceable>START</replaceable>:<replaceable>END</replaceable></arg>
1840 1841 1842 1843
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1844
              Searches for any song that contains
1845 1846 1847
              <varname>WHAT</varname>. Parameters have the same meaning
              as for <command>find</command>, except that search is not
              case sensitive.
1848 1849 1850
            </para>
          </listitem>
        </varlistentry>
1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895
        <varlistentry id="command_searchadd">
          <term>
            <cmdsynopsis>
              <command>searchadd</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>WHAT</replaceable></arg>
              <arg choice="opt"><replaceable>...</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Searches for any song that contains <varname>WHAT</varname>
              in tag <varname>TYPE</varname> and adds them to current playlist.
            </para>
            <para>
              Parameters have the same meaning as for <command>find</command>,
              except that search is not case sensitive.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_searchaddpl">
          <term>
            <cmdsynopsis>
              <command>searchaddpl</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>WHAT</replaceable></arg>
              <arg choice="opt"><replaceable>...</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Searches for any song that contains <varname>WHAT</varname>
              in tag <varname>TYPE</varname> and adds them to the playlist
              named <varname>NAME</varname>.
            </para>
            <para>
              If a playlist by that name doesn't exist it is created.
            </para>
            <para>
              Parameters have the same meaning as for <command>find</command>,
              except that search is not case sensitive.
            </para>
          </listitem>
        </varlistentry>
1896 1897 1898 1899
        <varlistentry id="command_update">
          <term>
            <cmdsynopsis>
              <command>update</command>
1900
              <arg choice="opt"><replaceable>URI</replaceable></arg>
1901 1902 1903 1904
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
1905 1906
              Updates the music database: find new files, remove
              deleted files, update modified files.
1907 1908 1909
            </para>
            <para>
              <varname>URI</varname> is a particular directory or
1910 1911
              song/file to update.  If you do not specify it,
              everything is updated.
1912 1913 1914
            </para>
            <para>
              Prints "updating_db: JOBID" where
1915 1916 1917
              <varname>JOBID</varname> is a positive number
              identifying the update job.  You can read the current
              job id in the <command>status</command> response.
1918 1919 1920
            </para>
          </listitem>
        </varlistentry>
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934
        <varlistentry id="command_rescan">
          <term>
            <cmdsynopsis>
              <command>rescan</command>
              <arg choice="opt"><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Same as <command>update</command>, but also rescans
              unmodified files.
            </para>
          </listitem>
        </varlistentry>
1935 1936 1937
      </variablelist>
    </section>

1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044
    <section id="mount">
      <title>Mounts and neighbors</title>

      <para>
        A "storage" provides access to files in a directory tree.  The
        most basic storage plugin is the "local" storage plugin which
        accesses the local file system, and there are plugins to
        access NFS and SMB servers.
      </para>

      <para>
        Multiple storages can be "mounted" together, similar to the
        <application>mount</application> command on many operating
        systems, but without cooperation from the kernel.  No
        superuser privileges are necessary, beause this mapping exists
        only inside the <application>MPD</application> process
      </para>

      <variablelist>

        <varlistentry id="command_mount">
          <term>
            <cmdsynopsis>
              <command>mount</command>
              <arg choice="req"><replaceable>PATH</replaceable></arg>
              <arg choice="req"><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>

          <listitem>
            <para>
              Mount the specified remote storage URI at the given
              path.  Example:
            </para>

            <programlisting>mount foo nfs://192.168.1.4/export/mp3</programlisting>
          </listitem>
        </varlistentry>

        <varlistentry id="command_umount">
          <term>
            <cmdsynopsis>
              <command>unmount</command>
              <arg choice="req"><replaceable>PATH</replaceable></arg>
            </cmdsynopsis>
          </term>

          <listitem>
            <para>
              Unmounts the specified path.  Example:
            </para>

            <programlisting>unmount foo</programlisting>
          </listitem>
        </varlistentry>

        <varlistentry id="command_listmounts">
          <term>
            <cmdsynopsis>
              <command>listmounts</command>
            </cmdsynopsis>
          </term>

          <listitem>
            <para>
              Queries a list of all mounts.  By default, this contains
              just the configured <varname>music_directory</varname>.
              Example:
            </para>

            <programlisting>listmounts
mount: 
storage: /home/foo/music
mount: foo
storage: nfs://192.168.1.4/export/mp3
OK
</programlisting>
          </listitem>
        </varlistentry>

        <varlistentry id="command_listneighbors">
          <term>
            <cmdsynopsis>
              <command>listneighbors</command>
            </cmdsynopsis>
          </term>

          <listitem>
            <para>
              Queries a list of "neighbors" (e.g. accessible file
              servers on the local net).  Items on that list may be
              used with the <link
              linkend="command_mount"><command>mount</command></link>
              command.  Example:
            </para>

            <programlisting>listneighbors
neighbor: smb://FOO
name: FOO (Samba 4.1.11-Debian)
OK
</programlisting>
          </listitem>
        </varlistentry>

      </variablelist>
    </section>

2045
    <section id="stickers">
2046 2047 2048
      <title>Stickers</title>

      <para>
2049
        "Stickers"<footnoteref linkend="since_0_15"/> are pieces of
2050 2051
        information attached to existing
        <application>MPD</application> objects (e.g. song files,
2052
        directories, albums).  Clients can create arbitrary name/value
2053 2054
        pairs.  <application>MPD</application> itself does not assume
        any special meaning in them.
2055 2056 2057 2058 2059 2060
      </para>

      <para>
        The goal is to allow clients to share additional (possibly
        dynamic) information about songs, which is neither stored on
        the client (not available to other clients), nor stored in the
2061 2062
        song files (<application>MPD</application> has no write
        access).
2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111
      </para>

      <para>
        Client developers should create a standard for common sticker
        names, to ensure interoperability.
      </para>

      <para>
        Objects which may have stickers are addressed by their object
        type ("song" for song objects) and their URI (the path within
        the database for songs).
      </para>

      <variablelist>
        <varlistentry id="command_sticker_get">
          <term>
            <cmdsynopsis>
              <command>sticker</command>
              <arg choice="plain">get</arg>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>URI</replaceable></arg>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Reads a sticker value for the specified object.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_sticker_set">
          <term>
            <cmdsynopsis>
              <command>sticker</command>
              <arg choice="plain">set</arg>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>URI</replaceable></arg>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
              <arg choice="req"><replaceable>VALUE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Adds a sticker value to the specified object.  If a
              sticker item with that name already exists, it is
              replaced.
            </para>
          </listitem>
        </varlistentry>
2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129
        <varlistentry id="command_sticker_delete">
          <term>
            <cmdsynopsis>
              <command>sticker</command>
              <arg choice="plain">delete</arg>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>URI</replaceable></arg>
              <arg choice="opt"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Deletes a sticker value from the specified object.  If
              you do not specify a sticker name, all sticker values
              are deleted.
            </para>
          </listitem>
        </varlistentry>
2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144
        <varlistentry id="command_sticker_list">
          <term>
            <cmdsynopsis>
              <command>sticker</command>
              <arg choice="plain">list</arg>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Lists the stickers for the specified object.
            </para>
          </listitem>
        </varlistentry>
2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163
        <varlistentry id="command_sticker_find">
          <term>
            <cmdsynopsis>
              <command>sticker</command>
              <arg choice="plain">find</arg>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>URI</replaceable></arg>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Searches the sticker database for stickers with the
              specified name, below the specified directory (URI).
              For each matching song, it prints the URI and that one
              sticker's value.
            </para>
          </listitem>
        </varlistentry>
2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180

        <varlistentry id="command_sticker_find_equals">
          <term>
            <cmdsynopsis>
              <command>sticker</command>
              <arg choice="plain">find</arg>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>URI</replaceable></arg>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
              <arg choice="plain">=</arg>
              <arg choice="req"><replaceable>VALUE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Searches for stickers with the given value.
            </para>
2181 2182 2183 2184 2185

            <para>
              Other supported operators are:
              "<function>&lt;</function>", "<function>&gt;</function>"
            </para>
2186 2187
          </listitem>
        </varlistentry>
2188 2189 2190
      </variablelist>
    </section>

2191
    <section id="connection_commands">
2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202
      <title>Connection settings</title>

      <variablelist>
        <varlistentry id="command_close">
          <term>
            <cmdsynopsis>
              <command>close</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
2203 2204
              Closes the connection to <application>MPD</application>.
              <application>MPD</application> will try to send the
2205 2206 2207
              remaining output buffer before it actually closes the
              connection, but that cannot be guaranteed.  This command
              will not generate a response.
2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_kill">
          <term>
            <cmdsynopsis>
              <command>kill</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
2219
              Kills <application>MPD</application>.
2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_password">
          <term>
            <cmdsynopsis>
              <command>password</command>
              <arg choice="req"><replaceable>PASSWORD</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              This is used for authentication with the server.
              <varname>PASSWORD</varname> is simply the plaintext
              password.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_ping">
          <term>
            <cmdsynopsis>
              <command>ping</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Does nothing but return "OK".
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
2252

2253
    <section id="output_commands">
2254 2255 2256 2257 2258 2259 2260
      <title>Audio output devices</title>

      <variablelist>
        <varlistentry id="command_disableoutput">
          <term>
            <cmdsynopsis>
              <command>disableoutput</command>
2261
              <arg choice="req"><replaceable>ID</replaceable></arg>
2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Turns an output off.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_enableoutput">
          <term>
            <cmdsynopsis>
              <command>enableoutput</command>
2274
              <arg choice="req"><replaceable>ID</replaceable></arg>
2275 2276 2277 2278 2279 2280 2281 2282
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Turns an output on.
            </para>
          </listitem>
        </varlistentry>
2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296
        <varlistentry id="command_toggleoutput">
          <term>
            <cmdsynopsis>
              <command>toggleoutput</command>
              <arg choice="req"><replaceable>ID</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Turns an output on or off, depending on the current
              state.
            </para>
          </listitem>
        </varlistentry>
2297 2298 2299 2300 2301 2302 2303 2304 2305 2306
        <varlistentry id="command_outputs">
          <term>
            <cmdsynopsis>
              <command>outputs</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Shows information about all outputs.
            </para>
2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332
            <screen>
outputid: 0
outputname: My ALSA Device
outputenabled: 0
OK
            </screen>
            <para>
              Return information:
            </para>
            <itemizedlist>
              <listitem>
                <para>
                  <varname>outputid</varname>: ID of the output. May change between executions
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>outputname</varname>: Name of the output. It can be any.
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>outputenabled</varname>: Status of the output. 0 if disabled, 1 if enabled.
                </para>
              </listitem>
            </itemizedlist>
2333 2334 2335 2336 2337
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

2338
    <section id="reflection_commands">
2339 2340 2341
      <title>Reflection</title>

      <variablelist>
2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382
        <varlistentry id="command_config">
          <term>
            <cmdsynopsis>
              <command>config</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Dumps configuration values that may be interesting for
              the client.  This command is only permitted to "local"
              clients (connected via UNIX domain socket).
            </para>
            <para>
              The following response attributes are available:
            </para>
            <informaltable>
              <tgroup cols="2">
                <thead>
                  <row>
                    <entry>
                      Name
                    </entry>
                    <entry>
                      Description
                    </entry>
                  </row>
                </thead>
                <tbody>
                  <row>
                    <entry>
                      <varname>music_directory</varname>
                    </entry>
                    <entry>
                      The absolute path of the music directory.
                    </entry>
                  </row>
                </tbody>
              </tgroup>
            </informaltable>
          </listitem>
        </varlistentry>
2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431
        <varlistentry id="command_commands">
          <term>
            <cmdsynopsis>
              <command>commands</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Shows which commands the current user has access to.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_notcommands">
          <term>
            <cmdsynopsis>
              <command>notcommands</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Shows which commands the current user does not have
              access to.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_tagtypes">
          <term>
            <cmdsynopsis>
              <command>tagtypes</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Shows a list of available song metadata.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_urlhandlers">
          <term>
            <cmdsynopsis>
              <command>urlhandlers</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Gets a list of available URL handlers.
            </para>
          </listitem>
        </varlistentry>
2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450
        <varlistentry id="command_decoders">
          <term>
            <cmdsynopsis>
              <command>decoders</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Print a list of decoder plugins, followed by their
              supported suffixes and MIME types.  Example response:
            </para>
            <programlisting>plugin: mad
suffix: mp3
suffix: mp2
mime_type: audio/mpeg
plugin: mpcdec
suffix: mpc</programlisting>
          </listitem>
        </varlistentry>
2451 2452
      </variablelist>
    </section>
2453

2454
    <section id="client_to_client">
2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472
      <title>Client to client</title>

      <para>
        Clients can communicate with each others over "channels".  A
        channel is created by a client subscribing to it.  More than
        one client can be subscribed to a channel at a time; all of
        them will receive the messages which get sent to it.
      </para>

      <para>
        Each time a client subscribes or unsubscribes, the global idle
        event <varname>subscription</varname> is generated.  In
        conjunction with the <command>channels</command> command, this
        may be used to auto-detect clients providing additional
        services.
      </para>

      <para>
2473
        New messages are indicated by the <varname>message</varname>
2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552
        idle event.
      </para>

      <variablelist>
        <varlistentry id="command_subscribe">
          <term>
            <cmdsynopsis>
              <command>subscribe</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Subscribe to a channel.  The channel is created if it
              does not exist already.  The name may consist of
              alphanumeric ASCII characters plus underscore, dash, dot
              and colon.
            </para>
          </listitem>
        </varlistentry>

        <varlistentry id="command_unsubscribe">
          <term>
            <cmdsynopsis>
              <command>unsubscribe</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Unsubscribe from a channel.
            </para>
          </listitem>
        </varlistentry>

        <varlistentry id="command_channels">
          <term>
            <cmdsynopsis>
              <command>channels</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Obtain a list of all channels.  The response is a list
              of "channel:" lines.
            </para>
          </listitem>
        </varlistentry>

        <varlistentry id="command_readmessages">
          <term>
            <cmdsynopsis>
              <command>readmessages</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Reads messages for this client.  The response is a list
              of "channel:" and "message:" lines.
            </para>
          </listitem>
        </varlistentry>

        <varlistentry id="command_sendmessage">
          <term>
            <cmdsynopsis>
              <command>sendmessage</command>
              <arg choice="req"><replaceable>CHANNEL</replaceable></arg>
              <arg choice="req"><replaceable>TEXT</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Send a message to the specified channel.
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
2553 2554
  </chapter>
</book>