]> kaliko git repositories - python-musicpd.git/blob - doc/source/index.rst
76871d1af0e9eabd89c28b05efef13044efe1562
[python-musicpd.git] / doc / source / index.rst
1 .. include:: ../../README.rst
2
3 Installation
4 =============
5
6 **Latest stable release** from `PyPi <https://pypi.org/project/python-musicpd/>`_:
7
8 .. code:: bash
9
10    pip install python-musicpd
11
12 **Latest development version** using pip + git:
13
14 .. code:: bash
15
16     pip install git+https://gitlab.com/kaliko/python-musicpd.git@dev
17
18
19 Library overview
20 ----------------
21 Here is a snippet allowing to list the last modified artists in the media library:
22
23 .. code:: python3
24
25         #!/usr/bin/env python3
26         # coding: utf-8
27         import musicpd
28
29         def main():
30             cli = musicpd.MPDClient()
31             cli.connect()
32             # Gets files count in the library
33             nb_files = int(cli.stats()['songs'])
34             # Gets the last 100 files modified
35             files = cli.search('file', '', 'sort', 'Last-Modified', 'window', (nb_files-100,))
36             # Print last modified artists in media library
37             print(' / '.join({f.get('albumartist') for f in files}))
38             cli.disconnect()
39
40         # Script starts here
41         if __name__ == '__main__':
42             main()
43
44
45 Build documentation
46 --------------------
47
48 .. code:: bash
49
50     # Get the source
51     git clone https://gitlab.com/kaliko/python-musicpd.git && cd python-musicpd
52     # Installs sphinx if needed
53     python3 -m venv venv && . ./venv/bin/activate
54     pip install sphinx
55     # And build
56     python3 setup.py build_sphinx
57     # Or call sphinx
58     sphinx-build -d ./doc/build/doctrees doc/source -b html ./doc/build/html
59
60
61 Contents
62 =========
63
64 .. toctree::
65    :maxdepth: 2
66
67    use.rst
68    doc.rst
69    commands.rst
70    contribute.rst
71
72
73 Indices and tables
74 ==================
75
76 * :ref:`genindex`
77 * :ref:`search`
78
79
80 .. vim: spell spelllang=en