ableton-js 3.1.7 → 3.1.9

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,23 @@ 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.1.9](https://github.com/leolabs/ableton.js/compare/v3.1.8...v3.1.9)
8
+
9
+ - :bug: Fix issue that could block the main thread in Live sometimes when no client port file exists [`8990a5d`](https://github.com/leolabs/ableton.js/commit/8990a5d00e0ae3a314a385f6748be39dd87cde90)
10
+ - :memo: Update the link to unofficial API docs [`7a32f90`](https://github.com/leolabs/ableton.js/commit/7a32f90d273a3ef05aac22105e253235b66a6c97)
11
+ - :bug: Fix copying the scripts not working if the Remote Scripts folder doesn't exist yet [`71ecf44`](https://github.com/leolabs/ableton.js/commit/71ecf44aadb843509c4ad92b27ddd0b27badfda1)
12
+
13
+ #### [v3.1.8](https://github.com/leolabs/ableton.js/compare/v3.1.7...v3.1.8)
14
+
15
+ > 10 May 2023
16
+
17
+ - :fire: Remove the postinstall hook [`d55efec`](https://github.com/leolabs/ableton.js/commit/d55efec00110398610d9f62457f5daa86293d985)
18
+ - :bug: Fix type annotations which are unsupported in Live 10 [`b396684`](https://github.com/leolabs/ableton.js/commit/b3966844d1bf5f4d0f4c0d3b789b9386f82d7e72)
19
+
7
20
  #### [v3.1.7](https://github.com/leolabs/ableton.js/compare/v3.1.6...v3.1.7)
8
21
 
22
+ > 27 April 2023
23
+
9
24
  - :mute: Don't clutter the logs by default [`333ff7b`](https://github.com/leolabs/ableton.js/commit/333ff7bf0a51bc3eace927a3b7ae0ff740ac616f)
10
25
  - :sparkles: Add the `appointed_device` property [`ae47bd2`](https://github.com/leolabs/ableton.js/commit/ae47bd2e0ed8b68f5bfab561709eab65238bce06)
11
26
  - :wrench: Copy the MIDI script into the User Library instead of into the app [`c4050d6`](https://github.com/leolabs/ableton.js/commit/c4050d664755fdae41152e9c376d91eea2071c94)
package/README.md CHANGED
@@ -6,7 +6,7 @@ Ableton.js lets you control your instance or instances of Ableton using Node.js.
6
6
  It tries to cover as many functions as possible.
7
7
 
8
8
  This package is still a work-in-progress. My goal is to expose all of
9
- [Ableton's MIDI Remote Script](https://julienbayle.studio/PythonLiveAPI_documentation/Live10.0.2.xml)
9
+ [Ableton's MIDI Remote Script](https://nsuspray.github.io/Live_API_Doc/11.0.0.xml)
10
10
  functions to TypeScript. If you'd like to contribute, please feel free to do so.
11
11
 
12
12
  ## Sponsored Message
@@ -27,7 +27,7 @@ class Interface(object):
27
27
  self.socket = socket
28
28
  self.log_message = c_instance.log_message
29
29
 
30
- def log_debug(self, message: str):
30
+ def log_debug(self, message):
31
31
  if DEBUG:
32
32
  self.log_message(message)
33
33
 
@@ -37,6 +37,8 @@ class Socket(object):
37
37
  self.input_handler = handler
38
38
  self._server_addr = ("127.0.0.1", 0)
39
39
  self._client_addr = ("127.0.0.1", 39031)
40
+ self._port_file_last_modified = 0
41
+ self._last_error = ""
40
42
  self._socket = None
41
43
 
42
44
  self.read_remote_port()
@@ -46,6 +48,11 @@ class Socket(object):
46
48
  interval=1000, repeat=True)
47
49
  self.file_timer.start()
48
50
 
51
+ def log_once(self, msg):
52
+ if self._last_error != msg:
53
+ self._last_error = msg
54
+ self.log_message(msg)
55
+
49
56
  def read_last_server_port(self):
50
57
  try:
51
58
  with open(server_port_path) as file:
@@ -60,6 +67,22 @@ class Socket(object):
60
67
 
61
68
  def read_remote_port(self):
62
69
  '''Reads the port our client is listening on'''
70
+
71
+ try:
72
+ file = os.stat(client_port_path)
73
+
74
+ print("Client port file modified: " + str(file.st_mtime) +
75
+ " – last: " + str(self._port_file_last_modified))
76
+
77
+ if file.st_mtime > self._port_file_last_modified:
78
+ self._port_file_last_modified = file.st_mtime
79
+ else:
80
+ # If the file hasn't changed, don't try to open it
81
+ return
82
+ except Exception as e:
83
+ self.log_once("Couldn't stat remote port file: " + str(e.args))
84
+ return
85
+
63
86
  try:
64
87
  old_port = self._client_addr[1]
65
88
 
@@ -74,7 +97,7 @@ class Socket(object):
74
97
  if self._socket:
75
98
  self.send("connect", {"port": self._server_addr[1]})
76
99
  except Exception as e:
77
- self.log_message("Couldn't read file: " + str(e.args))
100
+ self.log_once("Couldn't read remote port file: " + str(e.args))
78
101
 
79
102
  def shutdown(self):
80
103
  self.log_message("Shutting down...")
@@ -106,7 +129,7 @@ class Socket(object):
106
129
  with open(server_port_path, "w") as file:
107
130
  file.write(str(port))
108
131
  except Exception as e:
109
- self.log_message("Couldn't save port in file: " + str(e.args))
132
+ self.log_once("Couldn't save port in file: " + str(e.args))
110
133
  raise e
111
134
 
112
135
  try:
@@ -124,8 +147,8 @@ class Socket(object):
124
147
  str(self._server_addr) + ': ' + \
125
148
  str(e.args) + ', trying again. ' + \
126
149
  'If this keeps happening, try restarting your computer.'
127
- self.log_message(msg)
128
- self.log_message("Client address: " + str(self._client_addr))
150
+ self.log_once(msg + "(Client address: " +
151
+ str(self._client_addr) + ")")
129
152
  self.show_message(msg)
130
153
  t = Timer(5, self.init_socket)
131
154
  t.start()
@@ -1 +1 @@
1
- version = "3.1.7"
1
+ version = "3.1.9"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "3.1.7",
3
+ "version": "3.1.9",
4
4
  "description": "Control Ableton Live from Node",
5
5
  "main": "index.js",
6
6
  "author": "Leo Bernard <admin@leolabs.org>",
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "scripts": {
18
18
  "ableton:clean": "rm -f midi-script/AbletonJS/*.pyc",
19
- "ableton:copy-script": "set -- ~/Music/Ableton/User\\ Library/Remote\\ Scripts && rm -rf \"$1/AbletonJS\" && cp -r \"$(pwd)/midi-script\" \"$1/AbletonJS\" && rm -rf \"$1/AbletonJS/_Framework\"",
19
+ "ableton:copy-script": "set -- ~/Music/Ableton/User\\ Library/Remote\\ Scripts && mkdir -p \"$1\" && rm -rf \"$1/AbletonJS\" && cp -r \"$(pwd)/midi-script\" \"$1/AbletonJS\" && rm -rf \"$1/AbletonJS/_Framework\"",
20
20
  "ableton10:launch": "set -- /Applications/Ableton*10* && open \"$1\"",
21
21
  "ableton11:launch": "set -- /Applications/Ableton*11* && open \"$1\"",
22
22
  "ableton:logs": "tail -n 50 -f ~/Library/Preferences/Ableton/*/Log.txt | grep -i -e RemoteScriptError -e RemoteScriptMessage",
@@ -24,7 +24,6 @@
24
24
  "ableton10:start": "yarn ableton:kill; yarn ableton:clean && yarn ableton:copy-script && yarn ableton10:launch && yarn ableton:logs",
25
25
  "ableton11:start": "yarn ableton:kill; yarn ableton:clean && yarn ableton:copy-script && yarn ableton11:launch && yarn ableton:logs",
26
26
  "prepublishOnly": "yarn build",
27
- "postinstall": "node hooks/postinstall.js",
28
27
  "build:doc": "jsdoc2md --files src/**/*.ts --configure ./jsdoc2md.json > ./API.md",
29
28
  "version": "node hooks/prepublish.js && git add midi-script/version.py && auto-changelog -p -l 100 && git add CHANGELOG.md",
30
29
  "build": "tsc",
@@ -32,6 +31,7 @@
32
31
  },
33
32
  "devDependencies": {
34
33
  "@types/jest": "^26.0.23",
34
+ "@types/lodash": "^4.14.194",
35
35
  "@types/node": "^15.6.1",
36
36
  "@types/node-uuid": "^0.0.28",
37
37
  "@types/semver": "^7.3.6",
@@ -39,6 +39,7 @@
39
39
  "auto-changelog": "^2.3.0",
40
40
  "jest": "^27.0.3",
41
41
  "jest-extended": "^0.11.5",
42
+ "lodash": "^4.17.21",
42
43
  "p-all": "^3",
43
44
  "ts-jest": "^27.0.1",
44
45
  "ts-node": "^10.0.0",
@@ -1,3 +0,0 @@
1
- console.warn(
2
- "\x1b[33m🚨 Ableton.js changed the default ports from 9000 and 9001 to 9010 and 9011. Please update the Python plugin as well.\x1b[0m",
3
- );