X-Git-Url: http://git.kaliko.me/?p=python-musicpd.git;a=blobdiff_plain;f=doc%2Fsource%2Findex.rst;h=ac14145e7a724e3716fba99b0c06ae15f678fd91;hp=c55d08dfe8be591c89a42f09363bddac9f3e1e5a;hb=80fdad9f2cad5b3759351ab38bf32cad863cd3cb;hpb=966e3a848b9d545530cc7c7a78c5185c69183b22 diff --git a/doc/source/index.rst b/doc/source/index.rst index c55d08d..ac14145 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,3 +1,6 @@ +.. SPDX-FileCopyrightText: 2018-2021 kaliko +.. SPDX-License-Identifier: LGPL-3.0-or-later + .. include:: ../../README.rst Installation @@ -13,8 +16,33 @@ Installation .. code:: bash - pip install git+https://gitlab.com/kaliko/python-musicpd.git + pip install git+https://gitlab.com/kaliko/python-musicpd.git@dev + + +Library overview +---------------- +Here is a snippet allowing to list the last modified artists in the media library: + +.. code:: python3 + + #!/usr/bin/env python3 + # coding: utf-8 + import musicpd + + def main(): + cli = musicpd.MPDClient() + cli.connect() + # Gets files count in the library + nb_files = int(cli.stats()['songs']) + # Gets the last 100 files modified + files = cli.search('file', '', 'sort', 'Last-Modified', 'window', (nb_files-100,)) + # Print last modified artists in media library + print(' / '.join({f.get('albumartist') for f in files})) + cli.disconnect() + # Script starts here + if __name__ == '__main__': + main() Build documentation @@ -41,6 +69,7 @@ Contents use.rst doc.rst + commands.rst contribute.rst @@ -48,7 +77,6 @@ Indices and tables ================== * :ref:`genindex` -* :ref:`modindex` * :ref:`search`