Beispiel #1
0
    async def Pause(self, stream: Stream[pb.Empty, pb.Empty]):
        command = self.client.pause(1)
        fut = asyncio.get_running_loop().create_future()
        await self.commands_queue.put((command, fut))
        await fut

        await stream.send_message(pb.Empty())
Beispiel #2
0
    async def Play(self, stream: Stream[pb.Empty, pb.Empty]):
        request = await stream.recv_message()

        fut = asyncio.get_event_loop().create_future()
        if request.HasField('id'):
            command = self.client.playid(request.id)
            await self.commands_queue.put((command, fut))
        else:
            command = self.client.play(request.pos)
            await self.commands_queue.put((command, fut))

        response = await fut  # could send this
        await stream.send_message(pb.Empty())
Beispiel #3
0
 async def QueueAdd(self, stream: Stream[pb.Uri, pb.Empty]):
     # do stuff
     request = await stream.recv_message()
     await self.client.add(request.uri)
     await stream.send_message(pb.Empty())