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