[Pkg-mpd-commits] [python-mpd] 04/91: various documentation generation fixes

Simon McVittie smcv at debian.org
Sat Feb 24 14:55:26 UTC 2018


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository python-mpd.

commit d5e521641a9f02114f45ef932a352809876fc424
Author: Jörg Thalheim <joerg at higgsboson.tk>
Date:   Sun Aug 7 14:17:16 2016 +0200

    various documentation generation fixes
---
 doc/generate_command_reference.py | 160 ++++---
 doc/topics/commands.rst           | 953 +++++++++++++++++++++++---------------
 2 files changed, 685 insertions(+), 428 deletions(-)

diff --git a/doc/generate_command_reference.py b/doc/generate_command_reference.py
index a5b67e8..87aa56c 100644
--- a/doc/generate_command_reference.py
+++ b/doc/generate_command_reference.py
@@ -1,81 +1,115 @@
 #!/usr/bin/env python
 
-import re, sys
+import re
+import sys
 import os.path
+from textwrap import TextWrapper
 try:
     from lxml import etree
 except ImportError:
     sys.stderr.write("Please install lxml to run this script.")
     sys.exit(1)
 
-url = "http://git.musicpd.org/cgit/cirrus/mpd.git/plain/doc/protocol.xml"
+DEPRECATED_COMMANDS = ["volume"]
+SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
 
-if len(sys.argv) > 1:
-    url += "?id=release-" + sys.argv[1]
 
-DIR = os.path.dirname(os.path.realpath(__file__))
-header_file = os.path.join(DIR, "commands_header.txt")
+def get_text(elements, itemize=False):
+    paragraphs = []
+    highlight_elements = ['varname', 'parameter']
+    strip_elements = [
+            'returnvalue',
+            'command',
+            'link',
+            'footnote',
+            'simpara',
+            'footnoteref',
+            'function'
+    ] + highlight_elements
+    for element in elements:
+        # put "Since MPD version..." in paranthese
+        etree.strip_tags(element, "application")
+        for e in element.xpath("footnote/simpara"):
+            e.text = "(" + e.text.strip() + ")"
 
-DEPRECATED_COMMANDS = ["volume"]
+        for e in element.xpath("|".join(highlight_elements)):
+            e.text = "*" + e.text.strip() + "*"
+        etree.strip_tags(element, *strip_elements)
+        if itemize:
+            initial_indent = "    * "
+            subsequent_indent = "      "
+        else:
+            initial_indent = "    "
+            subsequent_indent = "    "
+        wrapper = TextWrapper(subsequent_indent=subsequent_indent,
+                              initial_indent=initial_indent)
+        text = element.text.replace("\n", " ").strip()
+        text = re.subn(r'\s+', ' ', text)[0]
+        paragraphs.append(wrapper.fill(text))
+    return "\n\n".join(paragraphs)
 
-with open(header_file, 'r') as f:
-    print(f.read())
 
-tree = etree.parse(url)
-chapter = tree.xpath('/book/chapter/title[text()= "Command reference"]/..')[0]
-for section in chapter.xpath("section"):
-    title = section.xpath("title")[0].text
-    print(title)
-    print(len(title) * "-")
+def main(url):
+    header_file = os.path.join(SCRIPT_PATH, "commands_header.txt")
+    with open(header_file, 'r') as f:
+        print(f.read())
 
-    paragraphs = []
-    for paragraph in section.xpath("para"):
-        etree.strip_tags(paragraph, 'varname', 'command', 'parameter')
-        text = paragraph.text.rstrip()
-        paragraphs.append(text)
-    print("\n".join(paragraphs))
-    print("")
+    tree = etree.parse(url)
+    chapter = tree.xpath('/book/chapter[@id="command_reference"]')[0]
+    for section in chapter.xpath("section"):
+        title = section.xpath("title")[0].text
+        print(title)
+        print(len(title) * "-")
+
+        print(get_text(section.xpath("para")))
+        print("")
+
+        for entry in section.xpath("variablelist/varlistentry"):
+            cmd = entry.xpath("term/cmdsynopsis/command")[0].text
+            if cmd in DEPRECATED_COMMANDS:
+                continue
+            subcommand = ""
+            args = ""
+            begin_optional = False
+            first_argument = True
+
+            for arg in entry.xpath("term/cmdsynopsis/arg"):
+                choice = arg.attrib.get("choice", None)
+                if choice == "opt" and not begin_optional:
+                    begin_optional = True
+                    args += "["
+                if args != "" and args != "[":
+                    args += ", "
+                replaceables = arg.xpath("replaceable")
+                if len(replaceables) > 0:
+                    for replaceable in replaceables:
+                        args += replaceable.text.lower()
+                elif first_argument:
+                    subcommand = arg.text
+                else:
+                    args += '"{}"'.format(arg.text)
+                first_argument = False
+            if begin_optional:
+                args += "]"
+            if subcommand != "":
+                cmd += "_" + subcommand
+            print(".. function:: MPDClient." + cmd + "(" + args + ")")
+            description = get_text(entry.xpath("listitem/para"))
+            description = re.sub(r':$', r'::', description, flags=re.MULTILINE)
 
-    for entry in section.xpath("variablelist/varlistentry"):
-        cmd = entry.xpath("term/cmdsynopsis/command")[0].text
-        if cmd in DEPRECATED_COMMANDS:
-            continue
-        subcommand = ""
-        args = ""
-        begin_optional = False
-        first_argument = True
+            print("\n")
+            print(description)
+            print("\n")
 
-        for arg in entry.xpath("term/cmdsynopsis/arg"):
-            choice = arg.attrib.get("choice", None)
-            if choice == "opt" and not begin_optional:
-                begin_optional = True
-                args += "["
-            if args != "" and args != "[":
-                args += ", "
-            replaceables = arg.xpath("replaceable")
-            if len(replaceables) > 0:
-                for replaceable in replaceables:
-                  args += replaceable.text.lower()
-            elif first_argument:
-                subcommand = arg.text
-            else:
-                args += '"{}"'.format(arg.text)
-            first_argument = False
-        if begin_optional:
-            args += "]"
-        if subcommand != "":
-            cmd += "_" + subcommand
-        print(".. function:: MPDClient." + cmd + "(" + args + ")")
-        lines = []
-        for para in entry.xpath("listitem/para"):
-            etree.strip_tags(para, 'varname', 'command', 'parameter')
-            t = [t.rstrip() for t in para.xpath("text()")]
-            lines.append(" ".join(t))
-        description = "\n".join(lines)
-        description = re.sub(r':$',r'::', description,flags=re.MULTILINE)
+            for screen in entry.xpath("listitem/screen | listitem/programlisting"):
+                for line in screen.text.split("\n"):
+                    print("        " + line)
+            for item in entry.xpath("listitem/itemizedlist/listitem"):
+                print(get_text(item.xpath("para"), itemize=True))
+                print("\n")
 
-        print(description)
-        print("\n")
-        for screen in entry.xpath("listitem/screen | listitem/programlisting"):
-            for line in screen.text.split("\n"):
-                print("                " + line)
+if __name__ == "__main__":
+    url = "http://git.musicpd.org/cgit/cirrus/mpd.git/plain/doc/protocol.xml"
+    if len(sys.argv) > 1:
+        url += "?id=release-" + sys.argv[1]
+    main(url)
diff --git a/doc/topics/commands.rst b/doc/topics/commands.rst
index d2a2e02..effc79b 100644
--- a/doc/topics/commands.rst
+++ b/doc/topics/commands.rst
@@ -13,47 +13,177 @@ Querying
 
 .. function:: MPDClient.clearerror()
 
-              Clears the current error message in status (this is also
-              accomplished by any command that starts playback).
+
+    Clears the current error message in status (this is also
+    accomplished by any command that starts playback).
 
 
 .. function:: MPDClient.currentsong()
 
-              Displays the song info of the current song (same song that
-              is identified in status).
+
+    Displays the song info of the current song (same song that is
+    identified in status).
 
 
 .. function:: MPDClient.idle([subsystems])
- 
-              Waits until there is a noteworthy change in one or more
-              of 's subsystems.  As soon
-              as there is one, it lists all changed systems in a line
-              in the format , where SUBSYSTEM is one of the
-              following::
-
-              While a client is waiting for idle 
-              results, the server disables timeouts, allowing a client
-              to wait for events as long as mpd runs.  The idle  command can be canceled by
-              sending the command noidle  (no other
-              commands are allowed). 
-              will then leave idle  mode and print
-              results immediately; might be empty at this time.
-
-              If the optional SUBSYSTEMS  argument
-              is used,  will only send
-              notifications when something changed in one of the
-              specified subsytems.
+
+
+    (Introduced with MPD 0.14) 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 changed::
+    SUBSYSTEM, where SUBSYSTEM is one of the following::
+
+    While a client is waiting for idle results, the server disables
+    timeouts, allowing a client to wait for events as long as mpd
+    runs. The idle command can be canceled by sending the command
+    noidle (no other commands are allowed). MPD will then leave idle
+    mode and print results immediately; might be empty at this time.
+
+    If the optional *SUBSYSTEMS* argument is used, MPD will only send
+    notifications when something changed in one of the specified
+    subsytems.
+
+
+    * database: the song database has been modified after update.
+
+
+    * update: a database update has started or finished. If the
+      database was modified during the update, the database event is
+      also emitted.
+
+
+    * stored_playlist: a stored playlist has been modified, renamed,
+      created or deleted
+
+
+    * playlist: the current playlist has been modified
+
+
+    * player: the player has been started, stopped or seeked
+
+
+    * mixer: the volume has been changed
+
+
+    * output: an audio output has been enabled or disabled
+
+
+    * options: options like
+
+
+    * sticker: the sticker database has been modified.
+
+
+    * subscription: a client has subscribed or unsubscribed to a
+      channel
+
+
+    * message: a message was received on a channel this client is
+      subscribed to; this event is only emitted when the queue is
+      empty
 
 
 .. function:: MPDClient.status()
 
-              Reports the current status of the player and the volume
-              level.
+
+    Reports the current status of the player and the volume level.
+
+
+    * *volume*: 0-100
+
+
+    * *repeat*: 0 or 1
+
+
+    * *random*: 0 or 1
+
+
+    * *single*: (Introduced with MPD 0.15) 0 or 1
+
+
+    * *consume*: 0 or 1
+
+
+    * *playlist*: 31-bit unsigned integer, the playlist version number
+
+
+    * *playlistlength*: integer, the length of the playlist
+
+
+    * *state*: play, stop, or pause
+
+
+    * *song*: playlist song number of the current song stopped on or
+      playing
+
+
+    * *songid*: playlist songid of the current song stopped on or
+      playing
+
+
+    * *nextsong*: playlist song number of the next song to be played
+
+
+    * *nextsongid*: playlist songid of the next song to be played
+
+
+    * *time*: total time elapsed (of current playing/paused song)
+
+
+    * *elapsed*: (Introduced with MPD 0.16) Total time elapsed within
+      the current song, but with higher resolution.
+
+
+    * *duration*: (Introduced with MPD 0.20) Duration of the current
+      song in seconds.
+
+
+    * *bitrate*: instantaneous bitrate in kbps
+
+
+    * *xfade*: crossfade in seconds
+
+
+    * *mixrampdb*: mixramp threshold in dB
+
+
+    * *mixrampdelay*: mixrampdelay in seconds
+
+
+    * *audio*: sampleRate:bits:channels
+
+
+    * *updating_db*: job id
+
+
+    * *error*: if there is an error, returns message here
 
 
 .. function:: MPDClient.stats()
 
-              Displays statistics.
+
+    Displays statistics.
+
+
+    * *artists*: number of artists
+
+
+    * *albums*: number of albums
+
+
+    * *songs*: number of songs
+
+
+    * *uptime*: daemon uptime in seconds
+
+
+    * *db_playtime*: sum of all song times in the db
+
+
+    * *db_update*: last db update in UNIX time
+
+
+    * *playtime*: time length of music played
 
 
 Playback options
@@ -61,65 +191,80 @@ Playback options
 
 
 .. function:: MPDClient.consume(state)
- 
-              Sets consume state to STATE , STATE  should be 0 or 1.
-	      When consume is activated, each song played is removed from playlist.
+
+
+    Sets consume state to *STATE*, *STATE* should be 0 or 1. When
+    consume is activated, each song played is removed from playlist.
 
 
 .. function:: MPDClient.crossfade(seconds)
 
-              Sets crossfading between songs.
+
+    Sets crossfading between songs.
 
 
 .. function:: MPDClient.mixrampdb(decibels)
 
-              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
+
+    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
 
 
 .. function:: MPDClient.mixrampdelay(seconds)
 
-              Additional time subtracted from the overlap calculated by mixrampdb. A value of "nan" disables MixRamp overlapping and falls back to crossfading.
+
+    Additional time subtracted from the overlap calculated by
+    mixrampdb. A value of "nan" disables MixRamp overlapping and falls
+    back to crossfading.
 
 
 .. function:: MPDClient.random(state)
 
-              Sets random state to STATE , STATE  should be 0 or 1.
+
+    Sets random state to *STATE*, *STATE* should be 0 or 1.
 
 
 .. function:: MPDClient.repeat(state)
 
-              Sets repeat state to STATE , STATE  should be 0 or 1.
+
+    Sets repeat state to *STATE*, *STATE* should be 0 or 1.
 
 
 .. function:: MPDClient.setvol(vol)
 
-              Sets volume to VOL , the range of
-              volume is 0-100.
+
+    Sets volume to *VOL*, the range of volume is 0-100.
 
 
 .. function:: MPDClient.single(state)
- 
-              Sets single state to STATE , STATE  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.
+
+
+    Sets single state to *STATE*, *STATE* 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.
 
 
 .. function:: MPDClient.replay_gain_mode(mode)
 
-              Sets the replay gain mode.  One of off , track , album , auto .
 
-              Changing the mode during playback may take several
-              seconds, because the new settings does not affect the
-              buffered data.
+    Sets the replay gain mode. One of *off*, *track*, *album*, *auto*
+    (added in MPD 0.16) .
+
+    Changing the mode during playback may take several seconds,
+    because the new settings does not affect the buffered data.
 
-              This command triggers the  idle event.
+    This command triggers the options idle event.
 
 
 .. function:: MPDClient.replay_gain_status()
 
-              Prints replay gain options.  Currently, only the
-              variable replay_gain_mode  is
-              returned.
+
+    Prints replay gain options. Currently, only the variable
+    *replay_gain_mode* is returned.
 
 
 Controlling playback
@@ -128,52 +273,60 @@ Controlling playback
 
 .. function:: MPDClient.next()
 
-              Plays next song in the playlist.
+
+    Plays next song in the playlist.
 
 
 .. function:: MPDClient.pause(pause)
 
-              Toggles pause/resumes playing, PAUSE  is 0 or 1.
+
+    Toggles pause/resumes playing, *PAUSE* is 0 or 1.
 
 
 .. function:: MPDClient.play(songpos)
 
-              Begins playing the playlist at song number SONGPOS .
+
+    Begins playing the playlist at song number *SONGPOS*.
 
 
 .. function:: MPDClient.playid(songid)
 
-              Begins playing the playlist at song SONGID .
+
+    Begins playing the playlist at song *SONGID*.
 
 
 .. function:: MPDClient.previous()
 
-              Plays previous song in the playlist.
+
+    Plays previous song in the playlist.
 
 
 .. function:: MPDClient.seek(songpos, time)
 
-              Seeks to the position TIME  (in
-              seconds; fractions allowed) of entry SONGPOS  in the playlist.
+
+    Seeks to the position *TIME* (in seconds; fractions allowed) of
+    entry *SONGPOS* in the playlist.
 
 
 .. function:: MPDClient.seekid(songid, time)
 
-              Seeks to the position TIME  (in
-              seconds; fractions allowed) of song SONGID .
+
+    Seeks to the position *TIME* (in seconds; fractions allowed) of
+    song *SONGID*.
 
 
 .. function:: MPDClient.seekcur(time)
 
-              Seeks to the position TIME  (in
-              seconds; fractions allowed) within the current song.  If
-              prefixed by '+' or '-', then the time is relative to the
-              current playing position.
+
+    Seeks to the position *TIME* (in seconds; fractions allowed)
+    within the current song. If prefixed by '+' or '-', then the time
+    is relative to the current playing position.
 
 
 .. function:: MPDClient.stop()
 
-              Stops playing.
+
+    Stops playing.
 
 
 The current playlist
@@ -182,239 +335,259 @@ The current playlist
 
 .. function:: MPDClient.add(uri)
 
-              Adds the file URI  to the playlist
-              (directories add recursively). URI 
-              can also be a single file.
+
+    Adds the file *URI* to the playlist (directories add recursively).
+    *URI* can also be a single file.
 
 
 .. function:: MPDClient.addid(uri, position)
 
-              Adds a song to the playlist (non-recursive) and returns the song id.
- URI  is always a single file or
-              URL.  For example::
+
+    Adds a song to the playlist (non-recursive) and returns the song
+    id.
+
+    *URI* is always a single file or URL. For example::
 
 
-                
-                addid "foo.mp3"
-                Id: 999
-                OK
-                            
+        
+        addid "foo.mp3"
+        Id: 999
+        OK
+                    
 .. function:: MPDClient.clear()
 
-              Clears the current playlist.
+
+    Clears the current playlist.
 
 
 .. function:: MPDClient.delete()
 
-              Deletes a song from the playlist.
+
+    Deletes a song from the playlist.
 
 
 .. function:: MPDClient.deleteid(songid)
 
-              Deletes the song SONGID  from the
-              playlist
+
+    Deletes the song *SONGID* from the playlist
 
 
 .. function:: MPDClient.move(to)
 
-              Moves the song at FROM  or range of songs
-              at START:END  to TO 
-              in the playlist. 
+
+    Moves the song at *FROM* or range of songs at *START:END* to *TO*
+    in the playlist. (Ranges are supported since MPD 0.15)
 
 
 .. function:: MPDClient.moveid(from, to)
 
-              Moves the song with FROM  (songid) to TO  (playlist index) in the
-              playlist.  If TO  is negative, it
-              is relative to the current song in the playlist (if
-              there is one).
+
+    Moves the song with *FROM* (songid) to *TO* (playlist index) in
+    the playlist. If *TO* is negative, it is relative to the current
+    song in the playlist (if there is one).
 
 
 .. function:: MPDClient.playlist()
 
-              Displays the current playlist.
+
+    Displays the current playlist.
 
 
 .. function:: MPDClient.playlistfind(tag, needle)
 
-              Finds songs in the current playlist with strict
-              matching.
+
+    Finds songs in the current playlist with strict matching.
 
 
 .. function:: MPDClient.playlistid(songid)
 
-              Displays a list of songs in the playlist. SONGID  is optional and specifies a
-              single song to display info for.
+
+    Displays a list of songs in the playlist. *SONGID* is optional and
+    specifies a single song to display info for.
 
 
 .. function:: MPDClient.playlistinfo()
 
-              Displays a list of all songs in the playlist, or if the optional
-              argument is given, displays information only for the song SONGPOS  or the range of songs START:END  
+
+    Displays a list of all songs in the playlist, or if the optional
+    argument is given, displays information only for the song
+    *SONGPOS* or the range of songs *START:END*
 
 
 .. function:: MPDClient.playlistsearch(tag, needle)
 
-              Searches case-insensitively for partial matches in the
-              current playlist.
+
+    Searches case-insensitively for partial matches in the current
+    playlist.
 
 
 .. function:: MPDClient.plchanges(version, start:end)
 
-              Displays changed songs currently in the playlist since VERSION .  Start and end positions may
-              be given to limit the output to changes in the given
-              range.
 
-              To detect songs that were deleted at the end of the
-              playlist, use playlistlength returned by status command.
+    Displays changed songs currently in the playlist since *VERSION*.
+    Start and end positions may be given to limit the output to
+    changes in the given range.
+
+    To detect songs that were deleted at the end of the playlist, use
+    playlistlength returned by status command.
 
 
 .. function:: MPDClient.plchangesposid(version, start:end)
 
-              Displays changed songs currently in the playlist since VERSION .  This function only
-              returns the position and the id of the changed song, not
-              the complete metadata. This is more bandwidth efficient.
 
-              To detect songs that were deleted at the end of the
-              playlist, use playlistlength returned by status command.
+    Displays changed songs currently in the playlist since *VERSION*.
+    This function only returns the position and the id of the changed
+    song, not the complete metadata. This is more bandwidth efficient.
+
+    To detect songs that were deleted at the end of the playlist, use
+    playlistlength returned by status command.
 
 
 .. function:: MPDClient.prio(priority, start:end)
 
-              Set the priority of the specified songs.  A higher
-              priority means that it will be played first when
-              "random" mode is enabled.
 
-              A priority is an integer between 0 and 255.  The default
-              priority of new songs is 0.
+    Set the priority of the specified songs. A higher priority means
+    that it will be played first when "random" mode is enabled.
+
+    A priority is an integer between 0 and 255. The default priority
+    of new songs is 0.
 
 
 .. function:: MPDClient.prioid(priority, id)
 
-              Same as ,
-              but address the songs with their id.
+
+    Same as prio, but address the songs with their id.
 
 
 .. function:: MPDClient.rangeid(id, start:end)
-  Specifies the portion of the
-              song that shall be played. START  and END  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.
+
+
+    (Since MPD 0.19) Specifies the portion of the song that shall be
+    played. *START* and *END* 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.
 
 
 .. function:: MPDClient.shuffle(start:end)
 
-              Shuffles the current playlist. START:END  is optional and specifies
-              a range of songs.
+
+    Shuffles the current playlist. *START:END* is optional and
+    specifies a range of songs.
 
 
 .. function:: MPDClient.swap(song1, song2)
 
-              Swaps the positions of SONG1  and SONG2 .
+
+    Swaps the positions of *SONG1* and *SONG2*.
 
 
 .. function:: MPDClient.swapid(song1, song2)
 
-              Swaps the positions of SONG1  and SONG2  (both song ids).
+
+    Swaps the positions of *SONG1* and *SONG2* (both song ids).
 
 
 .. function:: MPDClient.addtagid(songid, tag, value)
 
-              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.
+
+    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.
 
 
 .. function:: MPDClient.cleartagid(songid[, tag])
 
-              Removes tags from the specified song.  If TAG  is not specified, then all tag
-              values will be removed.  Editing song tags is only
-              possible for remote songs.
+
+    Removes tags from the specified song. If *TAG* is not specified,
+    then all tag values will be removed. Editing song tags is only
+    possible for remote songs.
 
 
 Stored playlists
 ----------------
+    Playlists are stored inside the configured playlist directory.
+    They are addressed with their file name (without the directory and
+    without the
 
-        Playlists are stored inside the configured playlist directory.
-        They are addressed with their file name (without the directory
-        and without the
-
-        Some of the commands described in this section can be used to
-        run playlist plugins instead of the hard-coded simple
+    Some of the commands described in this section can be used to run
+    playlist plugins instead of the hard-coded simple
 
 .. function:: MPDClient.listplaylist(name)
 
-              Lists the songs in the playlist.  Playlist plugins are
-              supported.
+
+    Lists the songs in the playlist. Playlist plugins are supported.
 
 
 .. function:: MPDClient.listplaylistinfo(name)
 
-              Lists the songs with metadata in the playlist.  Playlist
-              plugins are supported.
+
+    Lists the songs with metadata in the playlist. Playlist plugins
+    are supported.
 
 
 .. function:: MPDClient.listplaylists()
 
-              Prints a list of the playlist directory.
 
-              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.
+    Prints a list of the playlist directory.
+
+    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.
 
 
 .. function:: MPDClient.load(name[, start:end])
 
-              Loads the playlist into the current queue.  Playlist
-              plugins are supported.  A range may be specified to load
-              only a part of the playlist.
+
+    Loads the playlist into the current queue. Playlist plugins are
+    supported. A range may be specified to load only a part of the
+    playlist.
 
 
 .. function:: MPDClient.playlistadd(name, uri)
 
-              Adds URI  to the playlist .
-  will be created if it does
-             not exist.
+
+    Adds *URI* to the playlist
+
+
 
 
 .. function:: MPDClient.playlistclear(name)
 
-              Clears the playlist .
+
+    Clears the playlist
 
 
 .. function:: MPDClient.playlistdelete(name, songpos)
 
-              Deletes SONGPOS  from the
-              playlist .
+
+    Deletes *SONGPOS* from the playlist
 
 
 .. function:: MPDClient.playlistmove(name, from, to)
 
-              Moves the song at position FROM  in
-              the playlist  to the
-              position TO .
+
+    Moves the song at position *FROM* in the playlist
 
 
 .. function:: MPDClient.rename(name, new_name)
 
-              Renames the playlist  to .
+
+    Renames the playlist
 
 
 .. function:: MPDClient.rm(name)
 
-              Removes the playlist  from
-              the playlist directory.
+
+    Removes the playlist
 
 
 .. function:: MPDClient.save(name)
 
-              Saves the current playlist to  in the playlist directory.
+
+    Saves the current playlist to
 
 
 The music database
@@ -423,271 +596,299 @@ The music database
 
 .. function:: MPDClient.count(tag, needle[, ..., "group", grouptype])
 
-              Counts the number of songs and their total playtime in
-              the db matching TAG  exactly.
 
-              The group  keyword may be used to
-              group the results by a tag.  The following prints
-              per-artist counts::
+    Counts the number of songs and their total playtime in the db
+    matching *TAG* exactly.
 
+    The *group* keyword may be used to group the results by a tag. The
+    following prints per-artist counts::
 
-                count group artist
+
+        count group artist
 .. function:: MPDClient.find(type, what[, ..., startend])
 
-              Finds songs in the db that are exactly WHAT . TYPE  can
-              be any tag supported by , or one of the special
-              parameters::
- WHAT  is what to find.
- window  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.
+
+    Finds songs in the db that are exactly *WHAT*. *TYPE* can be any
+    tag supported by MPD, or one of the special parameters::
+
+    *WHAT* is what to find.
+
+    *window* 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.
+
+
+    * *any* checks all tag values
+
+
+    * *file* checks the full path (relative to the music directory)
+
+
+    * *base* restricts the search to songs in the given directory
+      (also relative to the music directory)
+
+
+    * *modified-since* compares the file's time stamp with the given
+      value (ISO 8601 or UNIX time stamp)
 
 
 .. function:: MPDClient.findadd(type, what[, ...])
 
-              Finds songs in the db that are exactly WHAT  and adds them to current playlist.
-              Parameters have the same meaning as for find .
+
+    Finds songs in the db that are exactly *WHAT* and adds them to
+    current playlist. Parameters have the same meaning as for find.
 
 
 .. function:: MPDClient.list(type[, filtertype, filterwhat, ..., "group", grouptype, ...])
 
-              Lists unique tags values of the specified type. TYPE  can be any tag supported by  or file .
 
-              Additional arguments may specify a filter like the one
-              in the .
+    Lists unique tags values of the specified type. *TYPE* can be any
+    tag supported by MPD or *file*.
 
-              The group  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::
+    Additional arguments may specify a filter like the one in the find
+    command.
 
+    The *group* 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::
 
-                list album group albumartist
+
+        list album group albumartist
 .. function:: MPDClient.listall(uri)
 
-              Lists all songs and directories in URI .
 
-              Do not use this command.  Do not manage a client-side
-              copy of 's database.  That
-              is fragile and adds huge overhead.  It will break with
-              large databases.  Instead, query  whenever you need
-              something.
+    Lists all songs and directories in *URI*.
+
+    Do not use this command. Do not manage a client-side copy of MPD's
+    database. That is fragile and adds huge overhead. It will break
+    with large databases. Instead, query MPD whenever you need
+    something.
 
 
 .. function:: MPDClient.listallinfo(uri)
 
-              Same as listall , except it also
-              returns metadata info in the same format as lsinfo .
 
-              Do not use this command.  Do not manage a client-side
-              copy of 's database.  That
-              is fragile and adds huge overhead.  It will break with
-              large databases.  Instead, query  whenever you need
-              something.
+    Same as listall, except it also returns metadata info in the same
+    format as lsinfo.
+
+    Do not use this command. Do not manage a client-side copy of MPD's
+    database. That is fragile and adds huge overhead. It will break
+    with large databases. Instead, query MPD whenever you need
+    something.
 
 
 .. function:: MPDClient.listfiles(uri)
 
-              Lists the contents of the directory URI , including files are not
-              recognized by . URI  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".
 
-              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.
+    Lists the contents of the directory *URI*, including files are not
+    recognized by MPD. *URI* 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".
+
+    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.
 
 
 .. function:: MPDClient.lsinfo(uri)
 
-              Lists the contents of the directory URI .
 
-              When listing the root directory, this currently returns
-              the list of stored playlists.  This behavior is
-              deprecated; use "listplaylists" instead.
+    Lists the contents of the directory *URI*.
+
+    When listing the root directory, this currently returns the list
+    of stored playlists. This behavior is deprecated; use
+    "listplaylists" instead.
 
-              This command may be used to list metadata of remote
-              files (e.g. URI beginning with "http://" or "smb://").
+    This command may be used to list metadata of remote files (e.g.
+    URI beginning with "http://" or "smb://").
 
-              Clients that are connected via UNIX domain socket may
-              use this command to read the tags of an arbitrary local
-              file (URI is an absolute path).
+    Clients that are connected via UNIX domain socket may use this
+    command to read the tags of an arbitrary local file (URI is an
+    absolute path).
 
 
 .. function:: MPDClient.readcomments(uri)
 
-              Read "comments" (i.e. key-value pairs) from the file
-              specified by "URI".  This "URI" can be a path relative
-              to the music directory or an absolute path.
 
-              This command may be used to list metadata of remote
-              files (e.g. URI beginning with "http://" or "smb://").
+    Read "comments" (i.e. key-value pairs) from the file specified by
+    "URI". This "URI" can be a path relative to the music directory or
+    an absolute path.
 
-              The response consists of lines in the form "KEY: VALUE".
-              Comments with suspicious characters (e.g. newlines) are
-              ignored silently.
+    This command may be used to list metadata of remote files (e.g.
+    URI beginning with "http://" or "smb://").
 
-              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.
+    The response consists of lines in the form "KEY: VALUE". Comments
+    with suspicious characters (e.g. newlines) are ignored silently.
+
+    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.
 
 
 .. function:: MPDClient.search(type, what[, ..., startend])
 
-              Searches for any song that contains WHAT . Parameters have the same meaning
-              as for find , except that search is not
-              case sensitive.
+
+    Searches for any song that contains *WHAT*. Parameters have the
+    same meaning as for find, except that search is not case
+    sensitive.
 
 
 .. function:: MPDClient.searchadd(type, what[, ...])
 
-              Searches for any song that contains WHAT 
-              in tag TYPE  and adds them to current playlist.
 
-              Parameters have the same meaning as for find ,
-              except that search is not case sensitive.
+    Searches for any song that contains *WHAT* in tag *TYPE* and adds
+    them to current playlist.
+
+    Parameters have the same meaning as for find, except that search
+    is not case sensitive.
 
 
 .. function:: MPDClient.searchaddpl(name, type, what[, ...])
 
-              Searches for any song that contains WHAT 
-              in tag TYPE  and adds them to the playlist
-              named NAME .
 
-              If a playlist by that name doesn't exist it is created.
+    Searches for any song that contains *WHAT* in tag *TYPE* and adds
+    them to the playlist named *NAME*.
 
-              Parameters have the same meaning as for find ,
-              except that search is not case sensitive.
+    If a playlist by that name doesn't exist it is created.
+
+    Parameters have the same meaning as for find, except that search
+    is not case sensitive.
 
 
 .. function:: MPDClient.update([uri])
 
-              Updates the music database: find new files, remove
-              deleted files, update modified files.
- URI  is a particular directory or
-              song/file to update.  If you do not specify it,
-              everything is updated.
 
-              Prints "updating_db: JOBID" where JOBID  is a positive number
-              identifying the update job.  You can read the current
-              job id in the status  response.
+    Updates the music database: find new files, remove deleted files,
+    update modified files.
+
+    *URI* is a particular directory or song/file to update. If you do
+    not specify it, everything is updated.
+
+    Prints "updating_db: JOBID" where *JOBID* is a positive number
+    identifying the update job. You can read the current job id in the
+    status response.
 
 
 .. function:: MPDClient.rescan([uri])
 
-              Same as update , but also rescans
-              unmodified files.
+
+    Same as update, but also rescans unmodified files.
 
 
 Mounts and neighbors
 --------------------
+    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.
 
-        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.
-
-        Multiple storages can be "mounted" together, similar to the
+    Multiple storages can be "mounted" together, similar to the mount
+    command on many operating systems, but without cooperation from
+    the kernel. No superuser privileges are necessary, beause this
+    mapping exists only inside the MPD process
 
 .. function:: MPDClient.mount(path, uri)
 
-              Mount the specified remote storage URI at the given
-              path.  Example::
 
+    Mount the specified remote storage URI at the given path. Example::
 
-                mount foo nfs://192.168.1.4/export/mp3
+
+        mount foo nfs://192.168.1.4/export/mp3
 .. function:: MPDClient.unmount(path)
 
-              Unmounts the specified path.  Example::
+
+    Unmounts the specified path. Example::
 
 
-                unmount foo
+        unmount foo
 .. function:: MPDClient.listmounts()
 
-              Queries a list of all mounts.  By default, this contains
-              just the configured music_directory .
-              Example::
 
+    Queries a list of all mounts. By default, this contains just the
+    configured *music_directory*. Example::
 
-                listmounts
-                mount: 
-                storage: /home/foo/music
-                mount: foo
-                storage: nfs://192.168.1.4/export/mp3
-                OK
-                
+
+        listmounts
+        mount: 
+        storage: /home/foo/music
+        mount: foo
+        storage: nfs://192.168.1.4/export/mp3
+        OK
+        
 .. function:: MPDClient.listneighbors()
 
-              Queries a list of "neighbors" (e.g. accessible file
-              servers on the local net).  Items on that list may be
-              used with the 
-              command.  Example::
+
+    Queries a list of "neighbors" (e.g. accessible file servers on the
+    local net). Items on that list may be used with the mount command.
+    Example::
 
 
-                listneighbors
-                neighbor: smb://FOO
-                name: FOO (Samba 4.1.11-Debian)
-                OK
-                
+        listneighbors
+        neighbor: smb://FOO
+        name: FOO (Samba 4.1.11-Debian)
+        OK
+        
 Stickers
 --------
+    "Stickers" 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.
 
-        "Stickers"
-
-        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 (
+    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).
 
-        Client developers should create a standard for common sticker
-        names, to ensure interoperability.
+    Client developers should create a standard for common sticker
+    names, to ensure interoperability.
 
-        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).
+    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).
 
 .. function:: MPDClient.sticker_get(type, uri, name)
 
-              Reads a sticker value for the specified object.
+
+    Reads a sticker value for the specified object.
 
 
 .. function:: MPDClient.sticker_set(type, uri, name, value)
 
-              Adds a sticker value to the specified object.  If a
-              sticker item with that name already exists, it is
-              replaced.
+
+    Adds a sticker value to the specified object. If a sticker item
+    with that name already exists, it is replaced.
 
 
 .. function:: MPDClient.sticker_delete(type, uri[, name])
 
-              Deletes a sticker value from the specified object.  If
-              you do not specify a sticker name, all sticker values
-              are deleted.
+
+    Deletes a sticker value from the specified object. If you do not
+    specify a sticker name, all sticker values are deleted.
 
 
 .. function:: MPDClient.sticker_list(type, uri)
 
-              Lists the stickers for the specified object.
+
+    Lists the stickers for the specified object.
 
 
 .. function:: MPDClient.sticker_find(type, uri, name)
 
-              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.
+
+    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.
 
 
 .. function:: MPDClient.sticker_find(type, uri, name, "=", value)
 
-              Searches for stickers with the given value.
 
-              Other supported operators are::
-              " ", " "
+    Searches for stickers with the given value.
+
+    Other supported operators are: "<", ">"
 
 
 Connection settings
@@ -696,26 +897,29 @@ Connection settings
 
 .. function:: MPDClient.close()
 
-              Closes the connection to .  will try to send the
-              remaining output buffer before it actually closes the
-              connection, but that cannot be guaranteed.  This command
-              will not generate a response.
+
+    Closes the connection to MPD. MPD will try to send the remaining
+    output buffer before it actually closes the connection, but that
+    cannot be guaranteed. This command will not generate a response.
 
 
 .. function:: MPDClient.kill()
 
-              Kills .
+
+    Kills MPD.
 
 
 .. function:: MPDClient.password(password)
 
-              This is used for authentication with the server. PASSWORD  is simply the plaintext
-              password.
+
+    This is used for authentication with the server. *PASSWORD* is
+    simply the plaintext password.
 
 
 .. function:: MPDClient.ping()
 
-              Does nothing but return "OK".
+
+    Does nothing but return "OK".
 
 
 Audio output devices
@@ -724,123 +928,142 @@ Audio output devices
 
 .. function:: MPDClient.disableoutput(id)
 
-              Turns an output off.
+
+    Turns an output off.
 
 
 .. function:: MPDClient.enableoutput(id)
 
-              Turns an output on.
+
+    Turns an output on.
 
 
 .. function:: MPDClient.toggleoutput(id)
 
-              Turns an output on or off, depending on the current
-              state.
+
+    Turns an output on or off, depending on the current state.
 
 
 .. function:: MPDClient.outputs()
 
-              Shows information about all outputs.
 
-              Return information::
+    Shows information about all outputs.
+
+    Return information::
+
+
+        
+        outputid: 0
+        outputname: My ALSA Device
+        outputenabled: 0
+        OK
+                    
+    * *outputid*: ID of the output. May change between executions
+
+
+    * *outputname*: Name of the output. It can be any.
+
+
+    * *outputenabled*: Status of the output. 0 if disabled, 1 if
+      enabled.
 
 
-                
-                outputid: 0
-                outputname: My ALSA Device
-                outputenabled: 0
-                OK
-                            
 Reflection
 ----------
 
 
 .. function:: MPDClient.config()
 
-              Dumps configuration values that may be interesting for
-              the client.  This command is only permitted to "local"
-              clients (connected via UNIX domain socket).
 
-              The following response attributes are available::
+    Dumps configuration values that may be interesting for the client.
+    This command is only permitted to "local" clients (connected via
+    UNIX domain socket).
+
+    The following response attributes are available::
 
 
 .. function:: MPDClient.commands()
 
-              Shows which commands the current user has access to.
+
+    Shows which commands the current user has access to.
 
 
 .. function:: MPDClient.notcommands()
 
-              Shows which commands the current user does not have
-              access to.
+
+    Shows which commands the current user does not have access to.
 
 
 .. function:: MPDClient.tagtypes()
 
-              Shows a list of available song metadata.
+
+    Shows a list of available song metadata.
 
 
 .. function:: MPDClient.urlhandlers()
 
-              Gets a list of available URL handlers.
+
+    Gets a list of available URL handlers.
 
 
 .. function:: MPDClient.decoders()
 
-              Print a list of decoder plugins, followed by their
-              supported suffixes and MIME types.  Example response::
+
+    Print a list of decoder plugins, followed by their supported
+    suffixes and MIME types. Example response::
 
 
-                plugin: mad
-                suffix: mp3
-                suffix: mp2
-                mime_type: audio/mpeg
-                plugin: mpcdec
-                suffix: mpc
+        plugin: mad
+        suffix: mp3
+        suffix: mp2
+        mime_type: audio/mpeg
+        plugin: mpcdec
+        suffix: mpc
 Client to client
 ----------------
+    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.
 
-        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.
+    Each time a client subscribes or unsubscribes, the global idle
+    event *subscription* is generated. In conjunction with the
+    channels command, this may be used to auto-detect clients
+    providing additional services.
 
-        Each time a client subscribes or unsubscribes, the global idle
-        event subscription is generated.  In
-        conjunction with the channels command, this
-        may be used to auto-detect clients providing additional
-        services.
-
-        New messages are indicated by the message
-        idle event.
+    New messages are indicated by the *message* idle event.
 
 .. function:: MPDClient.subscribe(name)
 
-              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.
+
+    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.
 
 
 .. function:: MPDClient.unsubscribe(name)
 
-              Unsubscribe from a channel.
+
+    Unsubscribe from a channel.
 
 
 .. function:: MPDClient.channels()
 
-              Obtain a list of all channels.  The response is a list
-              of "channel:" lines.
+
+    Obtain a list of all channels. The response is a list of
+    "channel:" lines.
 
 
 .. function:: MPDClient.readmessages()
 
-              Reads messages for this client.  The response is a list
-              of "channel:" and "message:" lines.
+
+    Reads messages for this client. The response is a list of
+    "channel:" and "message:" lines.
 
 
 .. function:: MPDClient.sendmessage(channel, text)
 
-              Send a message to the specified channel.
+
+    Send a message to the specified channel.
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list