rocksky 0.11.0 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 411359937d7cc586384c4b58c7e32f4824cc4cfb1ee0e3ec3f38c0071b0b3b30
4
- data.tar.gz: 97525f3e9c77f00c136a9f349f18747965dba4aa02f4e55bb1fb6587d926fc6f
3
+ metadata.gz: 4eb3afb1cb2e28cecb5bfa007812541ca97645b93c92d6dc3613740b0a30a68e
4
+ data.tar.gz: d7105f690b1831d6542358be0e218eb520999e083b5e324b0ad7467ac977b411
5
5
  SHA512:
6
- metadata.gz: 49ce584a23a45ecab4725b82308b6968468e2e3104267d4e5ca6696241d149ce224872d8eb303b8dd7680c2e4bc97e738feac641760dfb05c7d5330ef527d5e8
7
- data.tar.gz: 4cc152d4c19bfaa289a7422426abe6878d2fae69fda3f0063846b3ece0080c979f9d2b4077415f650bd34d4e7b466d13d3bac045c4e5c94a5e5495034253eee8
6
+ metadata.gz: 0c2101925359943adbf140a6854ddcaffe32867a48db8a539fd3c6fc3d631de00c40f2d607bff59536650571f0260eadacb75861accb8f1dad741d0b2873ffa8
7
+ data.tar.gz: c278a198a98864b9fb94b04f45a510970906a9b13f144ce91e980f25020d6a13ac554d9eeea7622c604d3ae42cae63b5dacebb125c62a6f20672d1ae34a9bf0f
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rocksky
4
+ # app.rocksky.equalizer.* — saved EQ presets (app.rocksky.equalizer records
5
+ # in the caller's repo).
6
+ #
7
+ # Units are rockbox's internal ones: band frequency in Hz, gain in tenths of
8
+ # dB (30 = +3.0 dB), q × 10 (7 = Q 0.7); precut in tenths of dB (-240..0).
9
+ module Equalizer
10
+ module_function
11
+
12
+ # An actor's presets ({ "presets" => [...] }). Omit +actor+ for the
13
+ # authenticated viewer's own — that read is auth-gated, so pass +token+.
14
+ def presets(actor: nil, token: nil, base: nil)
15
+ params = {}
16
+ params[:did] = actor if actor
17
+ Rocksky.get("app.rocksky.equalizer.listPresets", params, base: base, token: token)
18
+ end
19
+
20
+ # Create or update a preset; the rkey is +name+ slugified, so an existing
21
+ # name overwrites that preset. +bands+ is an array of
22
+ # { frequency:, gain:, q: } hashes. Returns the saved preset view.
23
+ def put_preset(name, bands, token:, precut: nil, base: nil)
24
+ body = { name: name, bands: bands }
25
+ body[:precut] = precut if precut
26
+ # putPreset's input is a JSON body, so it rides the body-carrying native
27
+ # call rather than the query-string Rocksky.post.
28
+ Rocksky.unwrap(C.rocksky_library_post(base.to_s, token.to_s,
29
+ "app.rocksky.equalizer.putPreset",
30
+ JSON.generate(body)))
31
+ end
32
+
33
+ # Delete a preset by rkey. Empty response.
34
+ def delete_preset(rkey, token:, base: nil)
35
+ Rocksky.post("app.rocksky.equalizer.deletePreset", { rkey: rkey }, base: base, token: token)
36
+ end
37
+ end
38
+ end
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "repo": "tsirysndr/rocksky",
3
- "tag": "bindings-v0.8.0",
3
+ "tag": "bindings-v0.11.0",
4
4
  "checksums": {
5
- "aarch64-apple-darwin": "31b58deb0f3d627d37b101f06b5b4a952401040f076b4cea7436aa338080a701",
6
- "aarch64-linux-gnu": "dca60c186ee83401e9afcdf1e7b31c308594f6dcda4cab25acf77254739d2a49",
7
- "x86_64-apple-darwin": "bdf2c98ddc866280712c928d78d4173c1760deac6d8c567417b90ea20fba1bb4",
8
- "x86_64-linux-gnu": "74dede20bb5892eff8ad321721a3f4584227bf2c97d78c2febeec095d2df46b6",
9
- "x86_64-unknown-freebsd": "e6af79359f73a9d42d6232eade70f5e3938e75b66bc240e1077d76334daa08fe",
10
- "x86_64-unknown-netbsd": "d1765e3c66d99a1160ddb3361ff9cfcf9c1335a056e68d089ea1c97ef6ff3f16"
5
+ "aarch64-apple-darwin": "fde925a15e9973eb509f6c18980c15eab8e168ee699290ffa09d54db0398e3ad",
6
+ "aarch64-linux-gnu": "f32cbea46108e1991a8676990dc6e2e6d8aadf6f4f7c18333e659c21d0a0a1c6",
7
+ "x86_64-apple-darwin": "b0608f09d1fee48492bbe093ed07d768f846992089eff0e5748475f06f159ef9",
8
+ "x86_64-linux-gnu": "17d9fb0c1c41a7d1cff8695063a32f3807d282b15722cc4fd99399c318b724a9",
9
+ "x86_64-unknown-freebsd": "ba099d9ccd5e23f26032e1cacba69e037c2a371b4b63cb83a7e27d060036eda8",
10
+ "x86_64-unknown-netbsd": "c9f837cdcc9d2a48b0631e3b8032fd42cc851c84d612c2abf31b08aa303995fe"
11
11
  }
12
12
  }
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rocksky
4
+ # app.rocksky.playlist.* — the global, AT-Proto-backed playlists.
5
+ #
6
+ # Distinct from Rocksky::Library's playlist methods, which drive the
7
+ # Subsonic/Navidrome library (app.rocksky.library.*).
8
+ #
9
+ # Writes publish records to the caller's repo, so they need a +token+ and only
10
+ # show up in reads once the AppView has ingested the commit.
11
+ module Playlist
12
+ module_function
13
+
14
+ # The playlist catalog.
15
+ def list(limit: 50, offset: 0, filter: nil, base: nil)
16
+ params = { limit: limit, offset: offset }
17
+ params[:filter] = filter if filter
18
+ Rocksky.get("app.rocksky.playlist.getPlaylists", params, base: base)
19
+ end
20
+
21
+ # A single playlist with its tracks. +filter+ is an RSQL expression over the
22
+ # tracks (e.g. 'artist=="Daft Punk"').
23
+ def get(uri, filter: nil, base: nil)
24
+ params = { uri: uri }
25
+ params[:filter] = filter if filter
26
+ Rocksky.get("app.rocksky.playlist.getPlaylist", params, base: base)
27
+ end
28
+
29
+ # Create a playlist. Returns { "uri" => ..., "cid" => ... }.
30
+ def create(name, token:, description: nil, picture_url: nil, base: nil)
31
+ params = { name: name }
32
+ params[:description] = description if description
33
+ params[:pictureUrl] = picture_url if picture_url
34
+ Rocksky.post("app.rocksky.playlist.createPlaylist", params, base: base, token: token)
35
+ end
36
+
37
+ # Rename or re-describe a playlist. Owner only.
38
+ def update(uri, token:, name: nil, description: nil, picture_url: nil, base: nil)
39
+ params = { uri: uri }
40
+ params[:name] = name if name
41
+ params[:description] = description if description
42
+ params[:pictureUrl] = picture_url if picture_url
43
+ Rocksky.post("app.rocksky.playlist.updatePlaylist", params, base: base, token: token)
44
+ end
45
+
46
+ # Add songs by their app.rocksky.song AT-URIs. Owner only. Returns
47
+ # { "uris" => [...] } — the created entry records.
48
+ def add_songs(uri, songs, token:, base: nil)
49
+ Rocksky.post("app.rocksky.playlist.addSongs", { uri: uri, songs: songs },
50
+ base: base, token: token)
51
+ end
52
+
53
+ # Remove a song. An entry lives in the repo that added it, so only that repo
54
+ # can retract it.
55
+ def remove_track(uri, song_uri, token:, base: nil)
56
+ Rocksky.post("app.rocksky.playlist.removeTrack", { uri: uri, songUri: song_uri },
57
+ base: base, token: token)
58
+ end
59
+
60
+ # Delete a playlist and the caller's own entries. Owner only.
61
+ def remove(uri, token:, base: nil)
62
+ Rocksky.post("app.rocksky.playlist.removePlaylist", { uri: uri }, base: base, token: token)
63
+ end
64
+ end
65
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rocksky
4
- VERSION = "0.11.0"
4
+ VERSION = "0.12.0"
5
5
  end
data/lib/rocksky.rb CHANGED
@@ -27,10 +27,11 @@ module Rocksky
27
27
  "char* rocksky_top_tracks(const char*, unsigned int, unsigned int)",
28
28
  "char* rocksky_global_stats(const char*)",
29
29
  "char* rocksky_get(const char*, const char*, const char*, const char*)",
30
+ "char* rocksky_post(const char*, const char*, const char*, const char*)",
30
31
  "char* rocksky_update_seen(const char*, const char*, const char*)",
31
32
  "char* rocksky_library_get(const char*, const char*, const char*, const char*)",
32
33
  "char* rocksky_library_post(const char*, const char*, const char*, const char*)",
33
- "char* rocksky_match_song(const char*, const char*, const char*, const char*, const char*)",
34
+ "char* rocksky_match_song(const char*, const char*, const char*, const char*, const char*, const char*)",
34
35
  "char* rocksky_top_tracks_interval(const char*, unsigned int, unsigned int, const char*, unsigned int, const char*, const char*)",
35
36
  "char* rocksky_top_artists_interval(const char*, unsigned int, unsigned int, const char*, unsigned int, const char*, const char*)",
36
37
  "char* rocksky_song_hash(const char*, const char*, const char*)",
@@ -183,6 +184,14 @@ module Rocksky
183
184
  unwrap(C.rocksky_get(base.to_s, nsid, JSON.generate(params), token.to_s))
184
185
  end
185
186
 
187
+ # Universal write escape hatch — call any app.rocksky.* procedure whose
188
+ # arguments ride the query string. Most are auth-gated, so pass +token+.
189
+ #
190
+ # Rocksky.post("app.rocksky.playlist.removePlaylist", { uri: uri }, token: tok)
191
+ def self.post(nsid, params = {}, base: nil, token: nil)
192
+ unwrap(C.rocksky_post(base.to_s, nsid, JSON.generate(params), token.to_s))
193
+ end
194
+
186
195
  # ---- notifications (auth-gated; +token+ required) ----
187
196
 
188
197
  # The authenticated viewer's unread-notification count. Returns
@@ -208,8 +217,10 @@ module Rocksky
208
217
  end
209
218
 
210
219
  # Resolve full canonical metadata for a bare title + artist (matchSong).
211
- def self.match_song(title, artist, mb_id: nil, isrc: nil, base: nil)
212
- unwrap(C.rocksky_match_song(base.to_s, title, artist, mb_id.to_s, isrc.to_s))
220
+ # +album+ steers the match toward that release (case-insensitive) so a
221
+ # remaster/live/single edition doesn't shadow the intended album.
222
+ def self.match_song(title, artist, album: nil, mb_id: nil, isrc: nil, base: nil)
223
+ unwrap(C.rocksky_match_song(base.to_s, title, artist, album.to_s, mb_id.to_s, isrc.to_s))
213
224
  end
214
225
 
215
226
  # Top tracks chart over a typed date window. +interval+ is +:all+, or a pair
@@ -346,6 +357,8 @@ module Rocksky
346
357
  end
347
358
  end
348
359
 
360
+ require_relative "rocksky/equalizer"
349
361
  require_relative "rocksky/filter"
350
362
  require_relative "rocksky/library"
363
+ require_relative "rocksky/playlist"
351
364
  require_relative "rocksky/remote"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocksky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rocksky
@@ -80,10 +80,12 @@ files:
80
80
  - README.md
81
81
  - exe/rocksky-console
82
82
  - lib/rocksky.rb
83
+ - lib/rocksky/equalizer.rb
83
84
  - lib/rocksky/filter.rb
84
85
  - lib/rocksky/library.rb
85
86
  - lib/rocksky/manifest.json
86
87
  - lib/rocksky/native.rb
88
+ - lib/rocksky/playlist.rb
87
89
  - lib/rocksky/remote.rb
88
90
  - lib/rocksky/version.rb
89
91
  - rocksky.gemspec