]> kaliko git repositories - python-musicpd.git/blob - doc/source/index.rst
Add module name in logger in example
[python-musicpd.git] / doc / source / index.rst
1 .. SPDX-FileCopyrightText: 2018-2023  kaliko <kaliko@azylum.org>
2 .. SPDX-License-Identifier: LGPL-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     # Call sphinx
59     sphinx-build -d ./doc/build/doctrees doc/source -b html ./doc/build/html
60
61
62 Contents
63 =========
64
65 .. toctree::
66    :maxdepth: 2
67
68    self
69    use.rst
70    doc.rst
71    commands.rst
72    examples.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