예제 #1
0
    async def _send_command(self, command):
        resp = await self.protocol.send_and_receive(messages.command(command))
        inner = resp.inner()

        if inner.errorCode != 0:
            raise exceptions.CommandError(
                "Command {0} failed: {1}, {2}".format(
                    command, inner.errorCode, inner.handlerReturnStatus))
예제 #2
0
    async def _send_command(self, command, **kwargs):
        resp = await self.protocol.send_and_receive(messages.command(command, **kwargs))
        inner = resp.inner()

        if inner.sendError == protobuf.SendError.NoError:
            return

        raise exceptions.CommandError(
            f"{CommandInfo_pb2.Command.Name(command)} failed: "
            f"SendError={protobuf.SendError.Enum.Name(inner.sendError)}, "
            "HandlerReturnStatus="
            f"{protobuf.HandlerReturnStatus.Enum.Name(inner.handlerReturnStatus)}"
        )
예제 #3
0
파일: __init__.py 프로젝트: Lee-View/pyatv
 def previous(self):
     """Press key previous."""
     return self.protocol.send(
         messages.command(CommandInfo_pb2.PreviousTrack))
예제 #4
0
파일: __init__.py 프로젝트: Lee-View/pyatv
 def next(self):
     """Press key next."""
     return self.protocol.send(messages.command(CommandInfo_pb2.NextTrack))
예제 #5
0
파일: __init__.py 프로젝트: Lee-View/pyatv
 def stop(self):
     """Press key stop."""
     return self.protocol.send(messages.command(CommandInfo_pb2.Stop))
예제 #6
0
파일: __init__.py 프로젝트: Lee-View/pyatv
 def pause(self):
     """Press key play."""
     return self.protocol.send(messages.command(CommandInfo_pb2.Pause))