deep-roon-mcp 0.5.3 → 0.5.4

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/README.md CHANGED
@@ -39,6 +39,7 @@ Version 0.5: fifty-nine tools (fifty-three with a read-only library). Qobuz, TID
39
39
  | `roon_status` | How Deep Roon MCP stands: Core, pairing, internal protocol, self-test, newer version |
40
40
  | `roon_zones` | Roon's zones and groups |
41
41
  | `roon_now_playing` | What plays in each zone, with the volume |
42
+ | `roon_waveform` | The waveform of what plays in a zone, as Roon draws it in its seek bar (local files, and streams once played) |
42
43
  | `roon_queue` | A zone's queue, numbered (1 is what plays) |
43
44
  | `roon_cover` | The cover of what plays, as an image |
44
45
  | `roon_history` | Roon's play history, newest first |
@@ -15538,7 +15538,7 @@ var require_lib2 = __commonJS({
15538
15538
  var version2;
15539
15539
  var init_package = __esm({
15540
15540
  "package.json"() {
15541
- version2 = "0.5.3";
15541
+ version2 = "0.5.4";
15542
15542
  }
15543
15543
  });
15544
15544
 
@@ -49723,6 +49723,66 @@ async function nowPlaying() {
49723
49723
  });
49724
49724
  }
49725
49725
  __name(nowPlaying, "nowPlaying");
49726
+ function ints(c, v) {
49727
+ const o = obj(c, v);
49728
+ const list = o?.fields?.$items ?? o?.$items ?? (Array.isArray(o) ? o : null);
49729
+ if (Array.isArray(list)) return list.map(Number).filter((n) => Number.isFinite(n));
49730
+ return null;
49731
+ }
49732
+ __name(ints, "ints");
49733
+ var lastWave = /* @__PURE__ */ new Map();
49734
+ async function waveform(zone3, points = 100, raw = false) {
49735
+ return withCore(async (c) => {
49736
+ const zn = findZone(c, zone3);
49737
+ const z2 = c.graph.getObject(zn.oid);
49738
+ const v = field2(z2, "WaveformData");
49739
+ const vals = ints(c, v);
49740
+ const np = obj(c, field2(z2, "NowPlaying"));
49741
+ const tr = obj(c, field2(items(c, field2(np, "Tracks"))[0], "Track"));
49742
+ const r = { zone: zn.name };
49743
+ if (field2(tr, "Title")) r.title = field2(tr, "Title");
49744
+ if (raw) {
49745
+ r.shape = v === void 0 ? "absent" : isRef2(v) ? "ref" : Buffer.isBuffer(v) ? `buffer ${v.length}` : typeof v;
49746
+ if (Buffer.isBuffer(v)) r.bytes = [...v.subarray(0, 64)];
49747
+ if (isRef2(v)) r.object = Object.keys(obj(c, v)?.fields ?? {});
49748
+ if (vals) {
49749
+ r.count = vals.length;
49750
+ r.values = vals;
49751
+ }
49752
+ return r;
49753
+ }
49754
+ const none = "No waveform for this track yet: Roon makes one for a stream the first time it plays (within half a minute or so), and for a local file when it has analysed it.";
49755
+ if (!vals?.length) {
49756
+ r.waveform = null;
49757
+ r.note = none;
49758
+ return r;
49759
+ }
49760
+ const track = String(field2(tr, "TrackId") ?? field2(tr, "Title") ?? ""), sig = vals.join(","), was = lastWave.get(String(zn.oid));
49761
+ if (was && was.track !== track && was.sig === sig) {
49762
+ r.waveform = null;
49763
+ r.note = none;
49764
+ return r;
49765
+ }
49766
+ lastWave.set(String(zn.oid), { track, sig });
49767
+ const steps = Array.from({ length: Math.floor(vals.length / 2) }, (_, i) => Math.max(vals[2 * i], vals[2 * i + 1]));
49768
+ const n = Math.max(1, Math.min(points, steps.length)), per = steps.length / n;
49769
+ r.points = n;
49770
+ r.waveform = Array.from({ length: n }, (_, i) => {
49771
+ let som = 0, k = 0;
49772
+ for (let j = Math.floor(i * per); j < Math.max(Math.floor((i + 1) * per), Math.floor(i * per) + 1); j++) {
49773
+ som += steps[j];
49774
+ k++;
49775
+ }
49776
+ return Math.round(som / k / 255 * 100) / 100;
49777
+ });
49778
+ const pos = field2(z2, "SeekPosition");
49779
+ if (typeof pos === "number") r.position = duration3(pos);
49780
+ const l = field2(tr, "LengthSeconds");
49781
+ if (typeof l === "number") r.length = duration3(l);
49782
+ return r;
49783
+ });
49784
+ }
49785
+ __name(waveform, "waveform");
49726
49786
 
49727
49787
  // src/roon/radio.ts
49728
49788
  init_intern();
@@ -50618,6 +50678,16 @@ function registerReadTools(server, internal = true) {
50618
50678
  inputSchema: {},
50619
50679
  annotations: READ
50620
50680
  }, () => run(() => internal ? zones2() : zones3()));
50681
+ reg("roon_waveform", {
50682
+ title: "Waveform",
50683
+ description: "The waveform of the track that plays in a zone, as Roon draws it in its seek bar: `waveform` is a list of heights from 0 to 1 (`points` of them, default 100), left to right over the track, with the `position` and `length`. Draw it as Roon does: each height a thin bar mirrored around a centre line (as far above as below), the part before `position` in a colour and the rest grey. Roon makes one for a local file when it has analysed it, and for a stream (Qobuz, TIDAL) the first time it plays; until then `waveform` is null. Only for what plays now, not for any track.",
50684
+ inputSchema: {
50685
+ zone: external_exports.string().min(1).describe("The zone, by (part of) its name."),
50686
+ points: external_exports.number().int().min(10).max(2e3).optional().describe("How many heights (default 100)."),
50687
+ raw: external_exports.boolean().optional().describe("The values as the Core sends them, for debugging.")
50688
+ },
50689
+ annotations: READ
50690
+ }, ({ zone: zone3, points, raw }) => run(() => waveform(zone3, points ?? 100, raw === true)));
50621
50691
  reg("roon_now_playing", {
50622
50692
  title: "Now playing in Roon",
50623
50693
  description: "What plays in Roon, per zone: state (playing, loading, paused, stopped), the track with album, artist and format, the position, how many tracks are left in the queue, shuffle, repeat, Roon Radio and a sleep timer. Read this before saying anything about what Roon plays \u2014 it changes all the time.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deep-roon-mcp",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "An MCP server for Roon that reaches the parts the official API doesn't: reviews, biographies, Qobuz's and TIDAL's shelves, TIDAL's playlists, your history, search across your library and the streaming services",
5
5
  "license": "Apache-2.0",
6
6
  "author": "René Bouwmeester <21277119+renebouwmeester@users.noreply.github.com>",