aboutsummaryrefslogblamecommitdiffstats
path: root/doc/protocol.xml
blob: 05a65de23a43d9f8486ebc4c6d0e0b06e2bf3a53 (plain) (tree)


















                                                                                  
                                                              


                    





                                                                      


                                                                      







                                                          

                                                                     







                                                  
                                                                     
                                                                  
                                                                 




                                                              





                                                                      
                                                         
                                                               









                                                        






                                                                      














                                              
                                                                      











                                                                
                                                                        







                                        
                                                                                        



                          
                                                                                    




                                                                     




                                                                        
                                                                    








                                                                      



































                                                                        

                                                                   



                           
                                                                   



                                                                      
                                                        


                                                            




                                                                             


                                                       









                                          

                                                                     
                   













                                                   
                     
                                          
                                                 
                                                                                      


                         


                                                 
                                                   


                         





















                                                                    


                                                                   




                                            


                                                                  



                         













                                                                




                                          
                                                             




                                                    









                                                                                        




























                                                                     
                           
                           









                                         
                                  



















                                                                     
                                 





















                                                                          
                    








                                                                      
                                                 





                                                                                   





















                                                                        

                                                            











                                                                      
                                                            












                                                                    
                                                                 

                              

                       
                                          

                         
                                       




                                                                      
                                                 
                                                            
                                                        

                                                                                  
                   

                       






                                         
                                        

                         
                                     



                          
                                              


                       
                                         

                         

                                                                      



                          
                                                                                
                   





                                                                  

                       
                                        

                         

                                                           



                          

                                                        


                       
                                          

                         

                                                          



                          

                                                 


                       
                                            

                         
                                         



                          
                                                  
                   

                       
 






































                                                                        
                            


















                                                                    


                                                                   



















                                                                                  
                          









































                                                                        

                                                                 






                                        



                                                                              




                                                                   


                                                                         


                                                                      












                                                                     

                                                                     






















                                                                             














                                                                       








                                                                       
                                                       








                                                                   



                                                                 



                          



                                                                              
                                                       


                       














                                                                       









































                                                                        
                                                             




                                            
                                                                    
                               












                                                                      
                                                                 













                                                                      
                                                                 










                                                       
                                                

                         
                                             




                                                                     














                                                                        













                                                      
                                                                






                                                                      


















































                                                                     
                                                                        



                          
                                                         


































                                                                                                      


































                                                                      














                                                                       









                                                                     
                                                    







                                                                      
















                                                                        









                                                                     

                                                                

                   

                                                                     









































                                                                

                                                 

















                                                                     
                                                 










































                                                                      


                             




                                                                      























































                                                                      

















                                                                     














                                                                     


















                                                                     



                     






















                                           
                        































                                                                         


































































































                                                                  

            
<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
               "docbook/dtd/xml/4.2/docbookx.dtd">
<book>
  <title>The Music Player Daemon protocol</title>

  <chapter>
    <title>General protocol syntax</title>

    <section>
      <title>Requests</title>

      <para>
        If arguments contain spaces, they should be surrounded by double quotation
        marks.
      </para>

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

      <para>
        All data between the client and the server is encoded in
        UTF-8. (Note: In UTF-8 all standard ansi characters, 0-127 are
        the same as a standard ansi encoding.  Also, no ansi character
        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
        strings. For example: <returnvalue>OK</returnvalue> encoded in
        UTF-8 is simply <returnvalue>OK</returnvalue>.  For more
        information on UTF=8:
        http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8)
      </para>
    </section>

    <section>
      <title>Responses</title>

      <para>
        A command returns <returnvalue>OK</returnvalue> on completion
        or <returnvalue>ACK some error</returnvalue> on failure.
        These denote the end of command execution.
      </para>
    </section>

    <section>
      <title>Command lists</title>

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

      <para>
        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
        <command>command_list_ok_begin</command> is used,
        <returnvalue>list_OK</returnvalue> is returned for each
        successful command executed in the command list.
      </para>
    </section>
  </chapter>

  <chapter>
    <title>Command reference</title>

    <note>
      <para>
        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
        clients are interacting with MPD.
      </para>
    </note>

    <section>
      <title>Querying MPD's status</title>

      <variablelist>
        <varlistentry id="command_clearerror">
          <term>
            <cmdsynopsis>
              <command>clearerror</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Clears the current error message in status (this is also
              accomplished by any command that starts playback).
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_currentsong">
          <term>
            <cmdsynopsis>
              <command>currentsong</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Displays the song info of the current song (same song that
              is identified in status).
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_idle">
          <term>
            <cmdsynopsis>
              <command>idle</command>
              <arg choice="opt" rep="repeat"><replaceable>SUBSYSTEMS</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              <footnote id="since_0_14"><simpara>Since MPD 0.14</simpara></footnote>
              Waits until there is a noteworthy change in one or more
              of MPD'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:
            </para>
            <itemizedlist>
              <listitem>
                <para>
                  <returnvalue>database</returnvalue>: the song database
                  has been modified after <command>update</command>.
                </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.
                </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
                  <option>repeat</option>, <option>random</option>,
                  <option>crossfade</option>
                </para>
              </listitem>
            </itemizedlist>
            <para>
              While a client is waiting for <command>idle</command>
              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
              commands are allowed). MPD will then leave
              <command>idle</command> mode and print results
              immediately; might be empty at this time.
            </para>
            <para>
              If the optional <varname>SUBSYSTEMS</varname> argument is used,
              MPD will only send notifications when something changed in
              one of the specified subsytems.
            </para>
            <simpara>
              Since <application>MPD</application> 0.14
            </simpara>
          </listitem>
        </varlistentry>
        <varlistentry id="command_status">
          <term>
            <cmdsynopsis>
              <command>status</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Reports the current status of the player and the volume
              level.
            </para>
            <itemizedlist>
              <listitem>
                <para>
                  <varname>volume</varname>:
                  <returnvalue>0-100</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>repeat</varname>:
                  <returnvalue>0 or 1</returnvalue>
                </para>
              </listitem>
              <listitem>
               <para>
                <varname>single</varname>:
                <returnvalue>0 or 1</returnvalue>
                <footnote id="since_0_15"><simpara>Since MPD 0.15</simpara></footnote>
               </para>
              </listitem>
              <listitem>
               <para>
                <varname>consume</varname>:
                <returnvalue>0 or 1</returnvalue>
                <footnoteref linkend="since_0_15"/>
               </para>
              </listitem>
              <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>:
                  <returnvalue> playlist song number of the current
                  song stopped on or playing
                  </returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>songid</varname>:
                  <returnvalue>playlist songid of the current song
                  stopped on or playing
                  </returnvalue>
                </para>
              </listitem>
              <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>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>time</varname>:
                  <returnvalue>total time elapsed (of current
                  playing/paused song)</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>elapsed</varname>:
                  <footnote id="since_0_16"><simpara>Since MPD 0.16</simpara></footnote>
                  <returnvalue>
                    Total time elapsed within the current song, but
                    with higher resolution.
                  </returnvalue>
                </para>
              </listitem>
              <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>
              <listitem>
                <para>
                  <varname>audio</varname>:
                  <returnvalue>sampleRate:bits:channels</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>updatings_db</varname>:
                  <returnvalue>job id</returnvalue>
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>error</varname>:
                  <returnvalue>if there is an error, returns message
                  here</returnvalue>
                </para>
                </listitem>
            </itemizedlist>
          </listitem>
        </varlistentry>
        <varlistentry id="command_stats">
          <term>
            <cmdsynopsis>
              <command>stats</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Displays statistics.
            </para>
            <itemizedlist>
              <listitem>
                <para>
                  <varname>artists</varname>: number of artists
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>songs</varname>: number of albums
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>uptime</varname>: daemon uptime in seconds
                </para>
              </listitem>
              <listitem>
                <para>
                  <varname>db_playtime</varname>: sum of all song
                  times in the db
                </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>

    <section>
      <title>Playback options</title>

      <variablelist>
        <varlistentry id="command_consume">
          <term>
            <cmdsynopsis>
              <command>consume</command>
              <arg choice="req"><replaceable>STATE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              <footnoteref linkend="since_0_15"/>
              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>
        <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>
        <varlistentry id="command_random">
          <term>
            <cmdsynopsis>
              <command>random</command>
              <arg choice="req"><replaceable>STATE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Sets random state to <varname>STATE</varname>,
              <varname>STATE</varname> should be 0 or 1.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_repeat">
          <term>
            <cmdsynopsis>
              <command>repeat</command>
              <arg choice="req"><replaceable>STATE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Sets repeat state to <varname>STATE</varname>,
              <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>
              Sets volume to <varname>VOL</varname>, the range of
              volume is 0-100.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_single">
          <term>
            <cmdsynopsis>
              <command>single</command>
              <arg choice="req"><replaceable>STATE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              <footnoteref linkend="since_0_15"/>
              Sets single state to <varname>STATE</varname>,
              <varname>STATE</varname> should be 0 or 1.
	      When single is activated, playback is stopped after current song, or
	      song is repeated if the 'repeat' mode is enabled.
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

    <section>
      <title>Controlling playback</title>

      <variablelist>
        <varlistentry id="command_next">
          <term>
            <cmdsynopsis>
              <command>next</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Plays next song in the playlist.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_pause">
          <term>
            <cmdsynopsis>
              <command>pause</command>
              <arg choice="req"><replaceable>PAUSE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Toggles pause/resumes playing, <varname>PAUSE</varname> is 0 or 1.
            </para>
            <note>
              <para>
                The use of pause command w/o the PAUSE argument is
                deprecated.
              </para>
            </note>
          </listitem>
        </varlistentry>
        <varlistentry id="command_play">
          <term>
            <cmdsynopsis>
              <command>play</command>
              <arg><replaceable>SONGPOS</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Begins playing the playlist at song number
              <varname>SONGPOS</varname>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_playid">
          <term>
            <cmdsynopsis>
              <command>playid</command>
              <arg><replaceable>SONGID</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Begins playing the playlist at song
              <varname>SONGID</varname>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_previous">
          <term>
            <cmdsynopsis>
              <command>previous</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Plays previous song in the playlist.
            </para>
          </listitem>
        </varlistentry>

        <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
              seconds) of entry <varname>SONGPOS</varname> in the
              playlist.
            </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
              seconds) of song <varname>SONGID</varname>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_stop">
          <term>
            <cmdsynopsis>
              <command>stop</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Stops playing.
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

    <section>
      <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>
              Adds the file <varname>URI</varname> to the playlist
              (directories add recursively). <varname>URI</varname>
              can also be a single file.
            </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
              URL.  <varname>POSITION</varname> is optional, a
              negative number means it is relative to the currently
              playing song in the playlist (if there is one).
              For example:
            </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>
              <arg choice="req"><replaceable>SONGPOS</replaceable></arg>
            </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>
              Deletes the song <varname>SONGID</varname> from the
              playlist
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_move">
          <term>
            <cmdsynopsis>
              <command>move</command>
              <group>
                  <arg choice="req"><replaceable>FROM</replaceable></arg>
                  <arg choice="req"><replaceable>START:END</replaceable></arg>
              </group>
              <arg choice="req"><replaceable>TO</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Moves the song at <varname>FROM</varname> or range of songs
              at <varname>START:END</varname> to <varname>TO</varname>
              in the playlist.
              <footnote id="range_since_0_15">
                <simpara>Ranges are supported since MPD 0.15</simpara>
              </footnote>
            </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>
              Moves the song with <varname>FROM</varname> (songid) to
              <varname>TO</varname> (playlist index) in the
              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>
        <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>
        <varlistentry id="command_playlistid">
          <term>
            <cmdsynopsis>
              <command>playlistid</command>
              <arg choice="req"><replaceable>SONGID</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Displays a list of songs in the playlist.
              <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>
              <group>
                  <arg><replaceable>SONGPOS</replaceable></arg>
                  <arg><replaceable>START:END</replaceable></arg>
              </group>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              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>
              <footnoteref linkend="range_since_0_15"/>
            </para>
          </listitem>
        </varlistentry>
        <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>
              Searches case-sensitively for partial matches in the
              current playlist.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_plchanges">
          <term>
            <cmdsynopsis>
              <command>plchanges</command>
              <arg choice="req"><replaceable>VERSION</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Displays changed songs currently in the playlist since
              <varname>VERSION</varname>.
            </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>
            </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>
        <varlistentry id="command_shuffle">
          <term>
            <cmdsynopsis>
              <command>shuffle</command>
              <arg><replaceable>START:END</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Shuffles the current playlist.
              <varname>START:END</varname> is optional and specifies
              a range of songs.
            </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>
              Swaps the positions of <varname>SONG1</varname> and
              <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>
              Swaps the positions of <varname>SONG1</varname> and
              <varname>SONG2</varname> (both song ids).
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

    <section>
      <title>Stored playlists</title>

      <variablelist>
        <varlistentry id="command_listplaylist">
          <term>
            <cmdsynopsis>
              <command>listplaylist</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Lists the files in the playlist
              <filename>NAME.m3u</filename>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_listplaylistinfo">
          <term>
            <cmdsynopsis>
              <command>listplaylistinfo</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Lists songs in the playlist <filename>NAME.m3u</filename>.
            </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>
              After each playlist name the server sends its last
              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>
        <varlistentry id="command_load">
          <term>
            <cmdsynopsis>
              <command>load</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Loads the playlist <filename>NAME.m3u</filename> from
              the playlist directory.
            </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>
              <arg choice="req"><replaceable>SONGPOS</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Deletes <varname>SONGPOS</varname> from the
              playlist <filename>NAME.m3u</filename>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_playlistmove">
          <term>
            <cmdsynopsis>
              <command>playlistmove</command>
              <arg choice="req"><replaceable>NAME</replaceable></arg>
              <arg choice="req"><replaceable>SONGID</replaceable></arg>
              <arg choice="req"><replaceable>SONGPOS</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Moves <varname>SONGID</varname> in the playlist
              <filename>NAME.m3u</filename> to the position
              <varname>SONGPOS</varname>.
            </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>
        <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>

    <section>
      <title>The music database</title>

      <variablelist>
        <varlistentry id="command_count">
          <term>
            <cmdsynopsis>
              <command>count</command>
              <arg choice="req"><replaceable>TAG</replaceable></arg>
              <arg choice="req"><replaceable>NEEDLE</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Counts the number of songs and their total playtime in
              the db matching <varname>TAG</varname> exactly.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_find">
          <term>
            <cmdsynopsis>
              <command>find</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>WHAT</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Finds songs in the db that are exactly
              <varname>WHAT</varname>.  <varname>TYPE</varname> should
              be <parameter>album</parameter>,
              <parameter>artist</parameter>, or
              <parameter>title</parameter>.  <varname>WHAT</varname>
              is what to find.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_findadd">
          <term>
            <cmdsynopsis>
              <command>findadd</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>WHAT</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Finds songs in the db that are exactly
              <varname>WHAT</varname> and adds them to current playlist.
              <varname>TYPE</varname> can be any tag supported by MPD.
              <varname>WHAT</varname> is what to find.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_list">
          <term>
            <cmdsynopsis>
              <command>list</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg><replaceable>ARTIST</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Lists all tags of the specified type.
              <varname>TYPE</varname> should be album or artist.
            </para>
            <para>
              <varname>ARTIST</varname> is an optional parameter when
              type is album, this specifies to list albums by an
              artist.
            </para>
          </listitem>
        </varlistentry>
        <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>
          </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>.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_lsinfo">
          <term>
            <cmdsynopsis>
              <command>lsinfo</command>
              <arg><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Lists the contents of the directory
              <varname>URI</varname>.
            </para>
            <para>
              When listing the root directory, this currently returns
              the list of stored playlists.  This behavior is
              deprecated; use "listplaylists" instead.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_search">
          <term>
            <cmdsynopsis>
              <command>search</command>
              <arg choice="req"><replaceable>TYPE</replaceable></arg>
              <arg choice="req"><replaceable>WHAT</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Searches for any song that contains
              <varname>WHAT</varname>.  <varname>TYPE</varname> can be
              <parameter>title</parameter>,
              <parameter>artist</parameter>,
              <parameter>album</parameter> or
              <parameter>filename</parameter>.  Search is not case
              sensitive.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_update">
          <term>
            <cmdsynopsis>
              <command>update</command>
              <arg><replaceable>URI</replaceable></arg>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Updates the music database.
            </para>
            <para>
              <varname>URI</varname> is a particular directory or
              song/file to update.
            </para>
            <para>
              Prints "updating_db: JOBID" where
              <varname>JOBID</varname> is the job id requested for
              your update, and is displayed in status, while the
              requested update is happening.
            </para>
            <para>
              To update a number of paths/songs at once, use
              command_list, it will be much more faster/efficient.
              Also, if you use a command_list for updating, only one
              <command>update</command> job id will be returned per
              sequence of updates.
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

    <section>
      <title>Stickers</title>

      <para>
        "Stickers"<footnoteref linkend="since_0_15"/> are pieces of
        information attached to existing MPD objects (e.g. song files,
        directories, albums).  Clients can create arbitrary name/value
        pairs.  MPD itself does not assume any special meaning in
        them.
      </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
        song files (MPD has no write access).
      </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>
        <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>
        <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>
        <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>
      </variablelist>
    </section>

    <section>
      <title>Connection settings</title>

      <variablelist>
        <varlistentry id="command_close">
          <term>
            <cmdsynopsis>
              <command>close</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Closes the connection to MPD.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_kill">
          <term>
            <cmdsynopsis>
              <command>kill</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Kills MPD.
            </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>

    <section>
      <title>Audio output devices</title>

      <variablelist>
        <varlistentry id="command_disableoutput">
          <term>
            <cmdsynopsis>
              <command>disableoutput</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Turns an output off.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_enableoutput">
          <term>
            <cmdsynopsis>
              <command>enableoutput</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Turns an output on.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry id="command_outputs">
          <term>
            <cmdsynopsis>
              <command>outputs</command>
            </cmdsynopsis>
          </term>
          <listitem>
            <para>
              Shows information about all outputs.
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>

    <section>
      <title>Reflection</title>

      <variablelist>
        <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>
      </variablelist>
    </section>
  </chapter>
</book>