X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=doc%2Fsource%2Findex.rst;h=d552f002115af0d852c1bf077b0760bbc4c57cce;hb=bb0e60a2c9555cc92677d6711ccbea9cb235c1ea;hp=c55d08dfe8be591c89a42f09363bddac9f3e1e5a;hpb=966e3a848b9d545530cc7c7a78c5185c69183b22;p=python-musicpd.git diff --git a/doc/source/index.rst b/doc/source/index.rst index c55d08d..d552f00 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -16,6 +16,31 @@ Installation pip install git+https://gitlab.com/kaliko/python-musicpd.git +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 +66,7 @@ Contents use.rst doc.rst + commands.rst contribute.rst @@ -48,8 +74,8 @@ Indices and tables ================== * :ref:`genindex` -* :ref:`modindex` * :ref:`search` +.. * :ref:`modindex` .. vim: spell spelllang=en