' '.join(self.resp.split('\n')[:2]),
self.version)
+
class MPDProto(asyncio.Protocol):
def __init__(self, future, payload):
logging.debug('payload: "%s"', payload)
(self.__class__.__name__, attr))
return lambda *args: wrapper(command, args)
- @asyncio.coroutine
- def _connect(self, proto):
+ async def _connect(self, proto):
# coroutine allowing Exception handling
# src: http://comments.gmane.org/gmane.comp.python.tulip/1401
try:
- yield from self._evloop.create_connection(lambda: proto,
- host=self._host,
- port=self._port)
+ await self._evloop.create_connection(lambda: proto,
+ host=self._host,
+ port=self._port)
except Exception as err:
proto.future.set_exception(ConnectionError(err))
"""Run event loop gathering tasks from self.futures
"""
if self.futures:
- self._evloop.run_until_complete(asyncio.gather(*self.futures))
- self.futures = []
+ self._evloop.run_until_complete(asyncio.gather(*self.futures))
+ self.futures = []
else:
logging.info('No task found in queue, need to set self.asio?')