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')
log.setLevel(logging.DEBUG)
+async def search(fltr):
+ # Look for and add
+ await client.searchadd(fltr)
+
+
async def run():
- # Use defaults to access MPD server
- client = MPDClient()
# Make an initial connection to MPD server
# The connection is kept open an reused for later commands
await client.ping()
-
+ await client.clear()
+ filters = [
+ '(Artist == "Neurosis")',
+ '(Artist == "Isis")',
+ '(Artist == "Cult of Luna")',
+ ]
# Each task gathered here will run with it's own connection
- await asyncio.gather(...)
+ await asyncio.gather(*map(search, filters))
# Closes all connections to MPD server
await client.close()
if __name__ == '__main__':
+ # Use defaults to access MPD server
+ client = MPDClient()
asyncio.run(run())