rocksky 0.11.0 → 0.11.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 411359937d7cc586384c4b58c7e32f4824cc4cfb1ee0e3ec3f38c0071b0b3b30
4
- data.tar.gz: 97525f3e9c77f00c136a9f349f18747965dba4aa02f4e55bb1fb6587d926fc6f
3
+ metadata.gz: 6285f01e3baa73b2791e6b64a2d4d331aa750abe5f50d1e4cafe6263073bf9ad
4
+ data.tar.gz: 1668269cb59db82bfaf6455e66e493f7dfd9a1c97c5037d9b3eac959a60dd3cf
5
5
  SHA512:
6
- metadata.gz: 49ce584a23a45ecab4725b82308b6968468e2e3104267d4e5ca6696241d149ce224872d8eb303b8dd7680c2e4bc97e738feac641760dfb05c7d5330ef527d5e8
7
- data.tar.gz: 4cc152d4c19bfaa289a7422426abe6878d2fae69fda3f0063846b3ece0080c979f9d2b4077415f650bd34d4e7b466d13d3bac045c4e5c94a5e5495034253eee8
6
+ metadata.gz: 50c4b9e1f82ce55ea8b9370946461dc8fd9bc6c87ce108ac304cf2835a66b0e6474c7cd07cd1c5a77c6794800cc7082a63abb1e45cc8395dfb8b7a07e82d3aed
7
+ data.tar.gz: 57b4fd741109bd4cc218d68520b22fef8f5dc5bfa2f1494ac7439722e892d5e60112eb026bb9cc65f8aaa784a537bbacf9078c939b27b859d646b854b85d1993
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "repo": "tsirysndr/rocksky",
3
- "tag": "bindings-v0.8.0",
3
+ "tag": "bindings-v0.10.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": "36607cf75cc05b79f93570efae0047dfe58f4beff38033f59e9c8c9e03c0e62e",
6
+ "aarch64-linux-gnu": "d5fcf8a3ca7acba5eaf45db0478360ade6ebfcea7f1dab582ff10696ec77c24e",
7
+ "x86_64-apple-darwin": "a19daa282e01fa68cb279da28bba52198c928c7771770d4e0a5e10e922a51aa9",
8
+ "x86_64-linux-gnu": "a6751be73f81d32639b85f3a1f2c6420b7a2346acbc59a5fd534156915d2f918",
9
+ "x86_64-unknown-freebsd": "e811d322e14ce51498928616c02f0c6228ea765a7f67efef00963a1bbe0c172e",
10
+ "x86_64-unknown-netbsd": "ce8e555d3ef6caee7dd7c7302feb14b73268ae46dcc9c517d8370c57c93624c6"
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.11.1"
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
@@ -348,4 +359,5 @@ end
348
359
 
349
360
  require_relative "rocksky/filter"
350
361
  require_relative "rocksky/library"
362
+ require_relative "rocksky/playlist"
351
363
  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.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rocksky
@@ -84,6 +84,7 @@ files:
84
84
  - lib/rocksky/library.rb
85
85
  - lib/rocksky/manifest.json
86
86
  - lib/rocksky/native.rb
87
+ - lib/rocksky/playlist.rb
87
88
  - lib/rocksky/remote.rb
88
89
  - lib/rocksky/version.rb
89
90
  - rocksky.gemspec