ableton-js 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v3.6.1](https://github.com/leolabs/ableton.js/compare/v3.6.0...v3.6.1)
8
+
9
+ - :bug: Fix zlib expecting a string on Python 2 (Live 10) [`8480ab4`](https://github.com/leolabs/ableton.js/commit/8480ab4a5b6c253a905e1ba61de53d6728c68411)
10
+ - :bug: Fix ableton-js not working with Live 10 anymore, due to syntax that Python 2 doesn't support [`04ba830`](https://github.com/leolabs/ableton.js/commit/04ba8309a4b7912c022aa604a90fed47a7a56ed9)
11
+
7
12
  #### [v3.6.0](https://github.com/leolabs/ableton.js/compare/v3.5.0...v3.6.0)
8
13
 
14
+ > 16 January 2025
15
+
9
16
  - :label: Mark all raw object state as readonly [`ace0efd`](https://github.com/leolabs/ableton.js/commit/ace0efde39e5b598dd0a2878e0e29ecffedd495a)
10
17
  - :sparkles: Add options to override the caching mechanism [`85405d4`](https://github.com/leolabs/ableton.js/commit/85405d4be89bdc052f53bb862c5fe904620c554a)
11
18
 
@@ -21,7 +21,7 @@ class Session(Interface):
21
21
  """
22
22
  with self.controlSurface.component_guard():
23
23
  logger.info(
24
- f"Setting up session box with {num_tracks} tracks and {num_scenes} scenes.")
24
+ "Setting up session box with " + str(num_tracks) + " tracks and " + str(num_scenes) + " scenes.")
25
25
  self.session = self.sessionComponent(num_tracks, num_scenes)
26
26
  self.session.set_offsets(0, 0)
27
27
  self.controlSurface.set_highlighting_session_component(
@@ -33,7 +33,7 @@ class Session(Interface):
33
33
  Sets the offset of the SessionComponent instance.
34
34
  """
35
35
  logger.info(
36
- f"Moving session box offset to {track_offset} and {scene_offset}.")
36
+ "Moving session box offset to " + str(track_offset) + " and " + scene_offset + ".")
37
37
 
38
38
  if hasattr(self, 'session'):
39
39
  self.session.set_offsets(track_offset, scene_offset)
@@ -4,6 +4,7 @@ import struct
4
4
  import zlib
5
5
  import os
6
6
  import tempfile
7
+ import sys
7
8
 
8
9
  from .Logging import logger
9
10
 
@@ -87,7 +88,8 @@ class Socket(object):
87
88
  if self._socket:
88
89
  self.send("connect", {"port": self._server_addr[1]})
89
90
  except Exception as e:
90
- self.log_error_once("Couldn't read remote port file: " + str(e.args))
91
+ self.log_error_once(
92
+ "Couldn't read remote port file: " + str(e.args))
91
93
 
92
94
  def shutdown(self):
93
95
  logger.info("Shutting down...")
@@ -125,13 +127,15 @@ class Socket(object):
125
127
  with open(server_port_path, "w") as file:
126
128
  file.write(str(port))
127
129
  except Exception as e:
128
- self.log_error_once("Couldn't save port in file: " + str(e.args))
130
+ self.log_error_once(
131
+ "Couldn't save port in file: " + str(e.args))
129
132
  raise e
130
133
 
131
134
  try:
132
135
  self.send("connect", {"port": self._server_addr[1]})
133
136
  except Exception as e:
134
- logger.error("Couldn't send connect to " + str(self._client_addr) + ":")
137
+ logger.error("Couldn't send connect to " +
138
+ str(self._client_addr) + ":")
135
139
  logger.exception(e)
136
140
 
137
141
  self.show_message("Started server on port " + str(port))
@@ -143,7 +147,8 @@ class Socket(object):
143
147
  str(self._server_addr) + ': ' + \
144
148
  str(e.args) + ', trying again. ' + \
145
149
  'If this keeps happening, try restarting your computer.'
146
- self.log_error_once(msg + " (Client address: " + str(self._client_addr) + ")")
150
+ self.log_error_once(
151
+ msg + " (Client address: " + str(self._client_addr) + ")")
147
152
  self.show_message(msg)
148
153
  t = Live.Base.Timer(
149
154
  callback=self.init_socket, interval=5000, repeat=False)
@@ -160,15 +165,18 @@ class Socket(object):
160
165
  message_id_byte = struct.pack("B", self._message_id)
161
166
 
162
167
  if len(compressed) < self._chunk_limit:
163
- self._socket.sendto(message_id_byte + b'\x00\x01' + compressed, self._client_addr)
168
+ self._socket.sendto(
169
+ message_id_byte + b'\x00\x01' + compressed, self._client_addr)
164
170
  else:
165
171
  chunks = list(split_by_n(compressed, self._chunk_limit))
166
172
  count = len(chunks)
167
173
  count_byte = struct.pack("B", count)
168
174
  for i, chunk in enumerate(chunks):
169
- logger.info("Sending packet " + str(self._message_id) + " - " + str(i) + "/" + str(count))
175
+ logger.info("Sending packet " + str(self._message_id) +
176
+ " - " + str(i) + "/" + str(count))
170
177
  packet_byte = struct.pack("B", i)
171
- self._socket.sendto(message_id_byte + packet_byte + count_byte + chunk, self._client_addr)
178
+ self._socket.sendto(
179
+ message_id_byte + packet_byte + count_byte + chunk, self._client_addr)
172
180
 
173
181
  def send(self, name, obj=None, uuid=None):
174
182
  def jsonReplace(o):
@@ -188,7 +196,8 @@ class Socket(object):
188
196
  except socket.error as e:
189
197
  logger.error("Socket error:")
190
198
  logger.exception(e)
191
- logger.error("Server: " + str(self._server_addr) + ", client: " + str(self._client_addr) + ", socket: " + str(self._socket))
199
+ logger.error("Server: " + str(self._server_addr) + ", client: " +
200
+ str(self._client_addr) + ", socket: " + str(self._socket))
192
201
  logger.error("Data:" + data)
193
202
  except Exception as e:
194
203
  logger.error("Error " + name + "(" + str(uuid) + "):")
@@ -205,7 +214,17 @@ class Socket(object):
205
214
  if (data[0] == b'\xFF' or data[0] == 255):
206
215
  packet = self._receive_buffer
207
216
  self._receive_buffer = bytearray()
217
+
218
+ # Handle Python 2/3 compatibility for zlib.decompress
219
+ if sys.version_info[0] < 3:
220
+ packet = str(packet)
221
+
208
222
  unzipped = zlib.decompress(packet)
223
+
224
+ # Handle bytes to string conversion for Python 3
225
+ if sys.version_info[0] >= 3 and isinstance(unzipped, bytes):
226
+ unzipped = unzipped.decode('utf-8')
227
+
209
228
  payload = json.loads(unzipped)
210
229
  self.input_handler(payload)
211
230
 
@@ -1 +1 @@
1
- version = "3.6.0"
1
+ version = "3.6.1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Control Ableton Live from Node",
5
5
  "main": "index.js",
6
6
  "author": "Leo Bernard <admin@leolabs.org>",