From b4809c9b9381ab02fc3d439005e5b6d89d32e5a2 Mon Sep 17 00:00:00 2001 From: Kaliko Jack Date: Thu, 19 Jun 2014 14:38:01 +0200 Subject: [PATCH] Document range capability --- README.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.rst b/README.rst index 2bd88dc..ca91f0e 100644 --- a/README.rst +++ b/README.rst @@ -54,6 +54,16 @@ Command lists are also supported using `command_list_ok_begin()` and client.status() # insert the status command into the list results = client.command_list_end() # results will be a list with the results +Provide a 2-tuple as argument for command supporting ranges (cf. `MPD protocol documentation`_ for more details):: + + # An intelligent clear + # clears played track in the queue, currentsong included + pos = client.currentsong().get('pos', 0) + # the 2-tuple range object accepts str, no need to convert to int + client.delete((0, pos)) + # missing end interpreted as highest value possible, pay attention still need a tuple. + client.delete((pos,)) # purge queue from current to the end + Commands may also return iterators instead of lists if `iterate` is set to `True`:: -- 2.39.5