python-mpd

python-mpd Git Source Tree

Root/README.txt

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

Archive Download this file

Branches

Tags