rocksky 0.9.0 → 0.10.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/rocksky/manifest.json +7 -7
- data/lib/rocksky/remote.rb +25 -5
- data/lib/rocksky/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 506387a27a8e92d1310a65f855110efff853b6079d9dbb65d6a3e1e56932cc18
|
|
4
|
+
data.tar.gz: 9d190b167472ba41881d547b527e501e446a75d844cefd4ff5b3200cd461cc94
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a82ef8bb90f40689b29067ba2debfe55eb8e099ed0897c3a69b795a3f03e76c49b10ba42d2035377027ea6701b53ac7be2195b2aead08f0a609ebd4e3058e9c
|
|
7
|
+
data.tar.gz: 78ca04c14127de3ae2b6993a942129ad1d9118679f1c8458807d315744e703932ae3c861fb32349fb615dff4d4086207bc38e19a2361d27a8fa047291576addf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
- Remote-player protocol: now-playing records accept optional audio info —
|
|
6
|
+
`codec` (audio codec/container, e.g. "mp3", "flac") and `sampleRate` (sample
|
|
7
|
+
rate in Hz, e.g. 44100). A player includes them in the `track` payload when
|
|
8
|
+
set (`codec` / `sample_rate` on the wire, omitted otherwise); a controller's
|
|
9
|
+
`:now_playing` event exposes them on the `:track` hash.
|
|
10
|
+
|
|
11
|
+
## 0.9.1
|
|
12
|
+
|
|
13
|
+
- Fix a segfault when tearing down a `RemotePlayer` / `RemoteController`.
|
|
14
|
+
`#close` freed the native handle while the `#listen` background thread was
|
|
15
|
+
still blocked inside `#next_command` / `#next_event` (a use-after-free). It now
|
|
16
|
+
stops the background task and **joins** the listen thread — so the poll has
|
|
17
|
+
returned — before freeing. `#next_command` / `#next_event` also no-op once the
|
|
18
|
+
handle is released.
|
|
19
|
+
|
|
3
20
|
## 0.3.0
|
|
4
21
|
|
|
5
22
|
- `feed.get_stories` now accepts optional `feed:` (at-uri) and `following:`
|
data/lib/rocksky/manifest.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"repo": "tsirysndr/rocksky",
|
|
3
|
-
"tag": "bindings-v0.
|
|
3
|
+
"tag": "bindings-v0.7.0",
|
|
4
4
|
"checksums": {
|
|
5
|
-
"aarch64-apple-darwin": "
|
|
6
|
-
"aarch64-linux-gnu": "
|
|
7
|
-
"x86_64-apple-darwin": "
|
|
8
|
-
"x86_64-linux-gnu": "
|
|
9
|
-
"x86_64-unknown-freebsd": "
|
|
10
|
-
"x86_64-unknown-netbsd": "
|
|
5
|
+
"aarch64-apple-darwin": "e9a772586564269dccf8448d46162b85fe5290307b818b3a4fc26ff634c2ab57",
|
|
6
|
+
"aarch64-linux-gnu": "fbfc5d12a8c532f437577f1c2e36c794760e78bb66749af33eef17d14a60cafc",
|
|
7
|
+
"x86_64-apple-darwin": "81e5628ea2f269ac8efefce85fa5eae093b1d49848aba580da9f267a36f85115",
|
|
8
|
+
"x86_64-linux-gnu": "3d3de1e3b691416676dd1c09879b14944a5c85d1d8911650113e6ee7783326e2",
|
|
9
|
+
"x86_64-unknown-freebsd": "b0ad8071e2a6baf1096d4f82221c440e56bf9426e435244ade8687f08edabf69",
|
|
10
|
+
"x86_64-unknown-netbsd": "08e9ff48d6273e63d6ebdc5eb3882777bc9bd227bc9126478a98c5041e2f1f05"
|
|
11
11
|
}
|
|
12
12
|
}
|
data/lib/rocksky/remote.rb
CHANGED
|
@@ -27,7 +27,8 @@ module Rocksky
|
|
|
27
27
|
#
|
|
28
28
|
# Records (now-playing / queue items) are passed as Hashes with camelCase keys
|
|
29
29
|
# (title, artist, album, albumArtist, albumArt, durationMs, elapsedMs,
|
|
30
|
-
# isPlaying / songUri, albumUri, trackNumber), matching the
|
|
30
|
+
# isPlaying, codec, sampleRate / songUri, albumUri, trackNumber), matching the
|
|
31
|
+
# wire record shape.
|
|
31
32
|
class RemotePlayer
|
|
32
33
|
# Connect and register a controllable player in the background. +token+ is a
|
|
33
34
|
# Rocksky access token (JWT); +name+ is the device-picker label; +url+
|
|
@@ -57,6 +58,8 @@ module Rocksky
|
|
|
57
58
|
# Block until the next controller command, returned as a symbol-keyed Hash
|
|
58
59
|
# (e.g. +{ action: "play" }+), or +nil+ once disconnected.
|
|
59
60
|
def next_command
|
|
61
|
+
return nil if @ptr.null?
|
|
62
|
+
|
|
60
63
|
cmd = Rocksky.unwrap(C.rocksky_remote_player_next_command(@ptr))
|
|
61
64
|
cmd && Rocksky.symbolize(cmd)
|
|
62
65
|
end
|
|
@@ -77,7 +80,10 @@ module Rocksky
|
|
|
77
80
|
|
|
78
81
|
# Advertise the currently-playing track. Call whenever it changes, and
|
|
79
82
|
# periodically (~every 1–4s) with a fresh +elapsedMs+ so controllers show
|
|
80
|
-
# smooth progress. +track+ is a camelCase Hash.
|
|
83
|
+
# smooth progress. +track+ is a camelCase Hash. Optional audio info —
|
|
84
|
+
# +codec+ (audio codec/container, e.g. "mp3", "flac") and +sampleRate+
|
|
85
|
+
# (sample rate in Hz, e.g. 44100) — is included in the track payload when
|
|
86
|
+
# set, and omitted otherwise.
|
|
81
87
|
def set_now_playing(track)
|
|
82
88
|
Rocksky.unwrap(C.rocksky_remote_player_set_now_playing(@ptr, JSON.generate(track)))
|
|
83
89
|
end
|
|
@@ -103,7 +109,12 @@ module Rocksky
|
|
|
103
109
|
def close
|
|
104
110
|
return if @ptr.null?
|
|
105
111
|
|
|
106
|
-
|
|
112
|
+
# Stop the background task so a blocked #next_command returns nil and the
|
|
113
|
+
# #listen loop exits, then WAIT for that thread to leave the native call
|
|
114
|
+
# before freeing — freeing the handle while a poll is in flight is a
|
|
115
|
+
# use-after-free (segfault).
|
|
116
|
+
C.rocksky_remote_player_disconnect(@ptr)
|
|
117
|
+
@thread&.join unless @thread == Thread.current
|
|
107
118
|
@thread = nil
|
|
108
119
|
C.rocksky_remote_player_free(@ptr)
|
|
109
120
|
@ptr = Fiddle::Pointer.new(0)
|
|
@@ -157,7 +168,9 @@ module Rocksky
|
|
|
157
168
|
# Register a handler for a server event type, one of +:devices+,
|
|
158
169
|
# +:device_registered+, +:device_unregistered+, +:primary_changed+,
|
|
159
170
|
# +:now_playing+, +:status+, +:queue+. The block receives the full
|
|
160
|
-
# symbol-keyed event Hash.
|
|
171
|
+
# symbol-keyed event Hash. A +:now_playing+ event carries the advertised
|
|
172
|
+
# track under +:track+, including optional +:codec+ / +:sampleRate+ audio
|
|
173
|
+
# info when the player supplied it. Returns +self+ for chaining.
|
|
161
174
|
def on(event_type, &block)
|
|
162
175
|
@handlers[event_type.to_sym] = block
|
|
163
176
|
self
|
|
@@ -166,6 +179,8 @@ module Rocksky
|
|
|
166
179
|
# Block until the next update, returned as a symbol-keyed Hash (each carries a
|
|
167
180
|
# +:type+), or +nil+ once disconnected.
|
|
168
181
|
def next_event
|
|
182
|
+
return nil if @ptr.null?
|
|
183
|
+
|
|
169
184
|
ev = Rocksky.unwrap(C.rocksky_remote_controller_next_event(@ptr))
|
|
170
185
|
ev && Rocksky.symbolize(ev)
|
|
171
186
|
end
|
|
@@ -244,7 +259,12 @@ module Rocksky
|
|
|
244
259
|
def close
|
|
245
260
|
return if @ptr.null?
|
|
246
261
|
|
|
247
|
-
|
|
262
|
+
# Stop the background task so a blocked #next_event returns nil and the
|
|
263
|
+
# #listen loop exits, then WAIT for that thread to leave the native call
|
|
264
|
+
# before freeing — freeing the handle while a poll is in flight is a
|
|
265
|
+
# use-after-free (segfault).
|
|
266
|
+
C.rocksky_remote_controller_disconnect(@ptr)
|
|
267
|
+
@thread&.join unless @thread == Thread.current
|
|
248
268
|
@thread = nil
|
|
249
269
|
C.rocksky_remote_controller_free(@ptr)
|
|
250
270
|
@ptr = Fiddle::Pointer.new(0)
|
data/lib/rocksky/version.rb
CHANGED