]> kaliko git repositories - python-musicpd.git/blob - README.txt
TODO.txt: removing completed TODO item and pre-release section
[python-musicpd.git] / README.txt
1 python-mpd
2 ==========
3
4 Getting python-mpd
5 ------------------
6
7 The latest release of python-mpd can be found at
8 http://pypi.python.org/pypi/python-mpd/[].
9
10
11 Getting the latest source code
12 ------------------------------
13
14 If you would instead like to use the latest source code, you can grab a copy
15 of the development version from git by running the command:
16
17   git clone http://git.thejat.be/python-mpd.git
18
19
20 Installing from source
21 ----------------------
22
23 To install python-mpd from source, simply run the command:
24
25   python setup.py install
26
27 You can use the `--help` switch to `setup.py` for a complete list of commands
28 and their options.  See the http://docs.python.org/inst/inst.html[Installing
29 Python Modules] document for more details.
30
31
32 Using the client library
33 ------------------------
34
35 The client library can be used as follows:
36
37 ------------------------------------------------------------------------------
38 client = mpd.MPDClient()           # create client object
39 client.connect("localhost", 6600)  # connect to localhost:6600
40 print client.mpd_version           # print the mpd version
41 print client.cmd("one", 2)         # print result of the command "cmd one 2"
42 client.close()                     # send the close command
43 client.disconnect()                # disconnect from the server
44 ------------------------------------------------------------------------------
45
46 A list of supported commands, their arguments (as MPD currently understands
47 them), and the functions used to parse their responses can be found in
48 `doc/commands.txt`.  See
49 http://mpd.wikia.com/wiki/MusicPlayerDaemonCommands[MusicPlayerDaemonCommands]
50 on the http://mpd.wikia.com/[MPD Wiki] for more details.
51
52 Command lists are also supported using `command_list_ok_begin()` and
53 `command_list_end()`:
54
55 ------------------------------------------------------------------------------
56 client.command_list_ok_begin()       # start a command list
57 client.update()                      # insert the update command into the list
58 client.status()                      # insert the status command into the list
59 results = client.command_list_end()  # results will be a list with the results
60 ------------------------------------------------------------------------------
61
62 Commands may also return iterators instead of lists if `iterate` is set to
63 `True`:
64
65 ------------------------------------------------------------------------------
66 client.iterate = True
67 for song in client.listallinfo():
68     print song["file"]
69 ------------------------------------------------------------------------------
70
71 Extra care must be taken to exhaust the iterator before executing *any* other
72 commands.
73
74
75 Contacting the author
76 ---------------------
77
78 You can contact the author by emailing J. Alexander Treuman
79 <mailto:jat@spatialrift.net[]>.  He can also be found idling in #mpd on
80 irc.freenode.net as jat.