ableton-js 3.1.8 → 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 +8 -0
- package/README.md +1 -1
- package/midi-script/Socket.py +27 -4
- package/midi-script/version.py +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,16 @@ 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
|
+
|
|
7
13
|
#### [v3.1.8](https://github.com/leolabs/ableton.js/compare/v3.1.7...v3.1.8)
|
|
8
14
|
|
|
15
|
+
> 10 May 2023
|
|
16
|
+
|
|
9
17
|
- :fire: Remove the postinstall hook [`d55efec`](https://github.com/leolabs/ableton.js/commit/d55efec00110398610d9f62457f5daa86293d985)
|
|
10
18
|
- :bug: Fix type annotations which are unsupported in Live 10 [`b396684`](https://github.com/leolabs/ableton.js/commit/b3966844d1bf5f4d0f4c0d3b789b9386f82d7e72)
|
|
11
19
|
|
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://
|
|
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
|
package/midi-script/Socket.py
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
128
|
-
|
|
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()
|
package/midi-script/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "3.1.
|
|
1
|
+
version = "3.1.9"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ableton-js",
|
|
3
|
-
"version": "3.1.
|
|
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",
|