mirror of
https://github.com/LukeSpad/BeoGateway.git
synced 2024-12-23 21:51:51 +00:00
Add files via upload
This commit is contained in:
parent
0fb28405cd
commit
48c59ce5ac
6 changed files with 17 additions and 8 deletions
|
@ -118,7 +118,7 @@ class MusicController(object):
|
||||||
playlist.playOnce_(None)
|
playlist.playOnce_(None)
|
||||||
|
|
||||||
def get_playlist_names(self):
|
def get_playlist_names(self):
|
||||||
playlists = []
|
playlists = ["None"]
|
||||||
# Generate and return a list of playlists in Apple Music
|
# Generate and return a list of playlists in Apple Music
|
||||||
for playlist in self.app.sources().objectWithName_("Library").playlists():
|
for playlist in self.app.sources().objectWithName_("Library").playlists():
|
||||||
playlists.append(playlist.name())
|
playlists.append(playlist.name())
|
||||||
|
|
|
@ -192,7 +192,7 @@ class BLHIPClient(asynchat.async_chat):
|
||||||
|
|
||||||
def send_cmd(self, telegram):
|
def send_cmd(self, telegram):
|
||||||
try:
|
try:
|
||||||
self.push(telegram.encode("ascii") + "\r\n")
|
self.push(str(telegram + "\r\n"))
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR)
|
indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR)
|
||||||
self.handle_close()
|
self.handle_close()
|
||||||
|
|
|
@ -135,7 +135,7 @@ class MLCLIClient(asynchat.async_chat):
|
||||||
|
|
||||||
def send_cmd(self, telegram):
|
def send_cmd(self, telegram):
|
||||||
try:
|
try:
|
||||||
self.push(telegram + "\r\n")
|
self.push(str(telegram + "\r\n"))
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR)
|
indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR)
|
||||||
self.handle_close()
|
self.handle_close()
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MLConfig:
|
||||||
def _download_data(self):
|
def _download_data(self):
|
||||||
try:
|
try:
|
||||||
indigo.server.log('Downloading configuration data from Gateway...', level=logging.WARNING)
|
indigo.server.log('Downloading configuration data from Gateway...', level=logging.WARNING)
|
||||||
url = 'http://' + self._host + '/mlgwpservices.json'
|
url = 'http://' + str(self._host) + '/mlgwpservices.json'
|
||||||
# try Basic Auth next (this is needed for the BLGW)
|
# try Basic Auth next (this is needed for the BLGW)
|
||||||
response = requests.get(url, auth=HTTPBasicAuth(self._user, self._pwd))
|
response = requests.get(url, auth=HTTPBasicAuth(self._user, self._pwd))
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ class MLConfig:
|
||||||
room['Room_Name'] = str(zone['name']).split('/')[1]
|
room['Room_Name'] = str(zone['name']).split('/')[1]
|
||||||
elif gateway_type == 'mlgw':
|
elif gateway_type == 'mlgw':
|
||||||
# MLGW has no zoning concept - devices are arranged in rooms only
|
# MLGW has no zoning concept - devices are arranged in rooms only
|
||||||
|
room['Zone'] = 'NA'
|
||||||
room['Room_Name'] = str(zone['name'])
|
room['Room_Name'] = str(zone['name'])
|
||||||
|
|
||||||
# Get products
|
# Get products
|
||||||
|
|
|
@ -240,6 +240,14 @@ class MLGWClient(asynchat.async_chat):
|
||||||
for p in payload:
|
for p in payload:
|
||||||
telegram.append(p)
|
telegram.append(p)
|
||||||
|
|
||||||
|
# Convert telegram to byte string
|
||||||
|
# b_telegram = b''
|
||||||
|
# for t in telegram:
|
||||||
|
# if type(t) == int:
|
||||||
|
# b_telegram += (t).to_bytes(1, byteorder='little')
|
||||||
|
# else:
|
||||||
|
# b_telegram += bytes(t, 'ascii')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.push(str(bytearray(telegram)))
|
self.push(str(bytearray(telegram)))
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
|
@ -249,14 +257,14 @@ class MLGWClient(asynchat.async_chat):
|
||||||
indigo.server.log("Error sending data: " + str(e), level=logging.ERROR)
|
indigo.server.log("Error sending data: " + str(e), level=logging.ERROR)
|
||||||
self.handle_close()
|
self.handle_close()
|
||||||
else:
|
else:
|
||||||
self.last_sent = str(bytearray(telegram))
|
self.last_sent = str(list(telegram))
|
||||||
self.last_sent_at = time.time()
|
self.last_sent_at = time.time()
|
||||||
if msg_type != CONST.MLGW_PL.get("PING"):
|
if msg_type != CONST.MLGW_PL.get("PING"):
|
||||||
indigo.server.log(
|
indigo.server.log(
|
||||||
self.name + " >>-SENT--> "
|
self.name + " >>-SENT--> "
|
||||||
+ self._getpayloadtypestr(msg_type)
|
+ self._getpayloadtypestr(msg_type)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ str(list(telegram)),
|
+ self.last_sent,
|
||||||
level=logging.INFO)
|
level=logging.INFO)
|
||||||
else:
|
else:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
|
@ -264,7 +272,7 @@ class MLGWClient(asynchat.async_chat):
|
||||||
self.name + " >>-SENT--> "
|
self.name + " >>-SENT--> "
|
||||||
+ self._getpayloadtypestr(msg_type)
|
+ self._getpayloadtypestr(msg_type)
|
||||||
+ ": "
|
+ ": "
|
||||||
+ str(list(telegram)),
|
+ self.last_sent,
|
||||||
level=logging.DEBUG
|
level=logging.DEBUG
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ class MLtnClient(asynchat.async_chat):
|
||||||
|
|
||||||
def _send_cmd(self, telegram):
|
def _send_cmd(self, telegram):
|
||||||
try:
|
try:
|
||||||
self.push(telegram + "\r\n")
|
self.push(str(telegram + "\r\n"))
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR)
|
indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR)
|
||||||
self.handle_close()
|
self.handle_close()
|
||||||
|
|
Loading…
Reference in a new issue