]> kaliko git repositories - python-musicpdaio.git/blobdiff - doc/source/tutorial/tutorial-00.py
Update documentation
[python-musicpdaio.git] / doc / source / tutorial / tutorial-00.py
index dea5826fc9465ba01ceaaf7a6e241393e9ab596a..6445a6e1c8436d82d45ed0cd52e19cd0dfc6cfbb 100644 (file)
@@ -1,7 +1,8 @@
+# mpd-client.py
 import asyncio
 import logging
 
-from mpdaio.client import MPDClient
+from mpdaio import MPDClient
 
 # Configure loggers
 logging.basicConfig(level=logging.INFO, format='%(levelname)-8s %(message)s')
@@ -25,6 +26,7 @@ async def run():
     # The connection is kept open an reused for later commands
     await client.ping()
 
+    # Get player status
     status = await client.status()
     if status.get('state') == 'play':
         current_song_id = status.get('songid')
@@ -37,6 +39,13 @@ async def run():
     else:
         log.info('Not playing')
 
+    # Add all songs form artist "The Doors"
+    await client.searchadd('(Artist == "The Doors")')
+    # Start playing
+    if (await client.status()).get('state') != 'play':
+        await client.play()
+
+
     # Closes any remaining connections to MPD server
     await client.close()