def send(self, func, args={}): args['method'] = func if self._user: args['username'] = self._user if self._pass: args['digest'] = htsmsg.HMFBin(self._pass) log.debug('htsp tx:') log.debug(args, pretty=True) self._sock.send(htsmsg.serialize(args))
def recv(self): ret = htsmsg.deserialize(self._sock, False) log.debug('htsp rx:') log.debug(ret, pretty=True) return ret