@kud/qobuz-cli 0.2.0 → 0.3.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.
- package/README.md +3 -1
- package/dist/index.js +65 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
- **Fast search & metadata** — search albums, tracks, and artists; inspect album, artist, and track details.
|
|
16
16
|
- **Library & playlists** — list, add, and remove favourites; list, show, create, and edit playlists.
|
|
17
|
+
- **Collection stats** — `qobuz stats` shows your genre mix, hi-res ratio, and top artists/labels from the local desktop library.
|
|
17
18
|
- **Media-key playback control** — `play`, `next`, `previous`, `forward`, and `rewind` drive the Qobuz desktop app via real media keys (macOS, requires Accessibility permission).
|
|
18
19
|
- **Quick open & copy** — `open` deep-links straight into the Qobuz app; `url` (alias `copy-url`) copies a link to the clipboard — bare `qobuz url` copies the **currently-playing** track.
|
|
19
20
|
- **Secure login** — stores a browser-borrowed token in the macOS Keychain; no password handling.
|
|
@@ -32,6 +33,7 @@ $ qobuz search "radiohead"
|
|
|
32
33
|
$ qobuz album 0634904032432
|
|
33
34
|
$ qobuz fav list
|
|
34
35
|
$ qobuz playlist create "Focus"
|
|
36
|
+
$ qobuz stats # collection analytics from the desktop library
|
|
35
37
|
$ qobuz play # toggle play/pause in Qobuz
|
|
36
38
|
$ qobuz next # skip track (also: previous, forward, rewind)
|
|
37
39
|
$ qobuz open album 0634904032432 # open in the Qobuz app
|
|
@@ -40,7 +42,7 @@ $ qobuz url album 0634904032432 # copy a specific item's deep link
|
|
|
40
42
|
$ qobuz url --plain # print the bare URL (no clipboard) for scripting
|
|
41
43
|
```
|
|
42
44
|
|
|
43
|
-
Full command set: `login`, `logout`, `search`, `album`, `artist`, `track`, `similar`, `fav` (list/add/remove), `playlist` (list/show/create/add/remove), `url` / `copy-url`, `open`, `play`, `next`, `previous` / `prev`, `forward` / `ff`, `rewind` / `rew`.
|
|
45
|
+
Full command set: `login`, `logout`, `search`, `album`, `artist`, `track`, `similar`, `fav` (list/add/remove), `playlist` (list/show/create/add/remove), `stats`, `url` / `copy-url`, `open`, `play`, `next`, `previous` / `prev`, `forward` / `ff`, `rewind` / `rew`.
|
|
44
46
|
|
|
45
47
|
> **macOS note** — playback commands (`play`, `next`, `previous`, `forward`, `rewind`) use real media keys and require Accessibility permission granted to your terminal. The first playback command compiles a small Swift helper via `swiftc`.
|
|
46
48
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { defineCommand as
|
|
4
|
+
import { defineCommand as defineCommand14, runMain } from "citty";
|
|
5
5
|
|
|
6
6
|
// src/help.ts
|
|
7
7
|
import { renderUsage } from "citty";
|
|
@@ -524,9 +524,67 @@ var similar = defineCommand10({
|
|
|
524
524
|
}
|
|
525
525
|
});
|
|
526
526
|
|
|
527
|
-
// src/commands/
|
|
527
|
+
// src/commands/stats.ts
|
|
528
528
|
import { defineCommand as defineCommand11 } from "citty";
|
|
529
|
-
|
|
529
|
+
import { readLibraryStats } from "@kud/qobuz";
|
|
530
|
+
var pct = (count, total) => total ? `${Math.round(1e3 * count / total) / 10}%` : "";
|
|
531
|
+
var section = (title, rows) => {
|
|
532
|
+
if (!rows.length) return;
|
|
533
|
+
const width = Math.max(...rows.map(([label]) => label.length));
|
|
534
|
+
console.log(`
|
|
535
|
+
${title}`);
|
|
536
|
+
for (const [label, value] of rows)
|
|
537
|
+
console.log(` ${label.padEnd(width)} ${value}`);
|
|
538
|
+
};
|
|
539
|
+
var stats = defineCommand11({
|
|
540
|
+
meta: {
|
|
541
|
+
name: "stats",
|
|
542
|
+
description: "Show collection analytics from your Qobuz desktop library"
|
|
543
|
+
},
|
|
544
|
+
args: {
|
|
545
|
+
limit: { type: "string", description: "Rows per breakdown", default: "10" }
|
|
546
|
+
},
|
|
547
|
+
run: async ({ args: args2 }) => {
|
|
548
|
+
const data = await readLibraryStats({ limit: Number(args2.limit) });
|
|
549
|
+
if (!data) {
|
|
550
|
+
console.error(
|
|
551
|
+
"No Qobuz library found \u2014 is the desktop app installed (macOS)?"
|
|
552
|
+
);
|
|
553
|
+
process.exit(1);
|
|
554
|
+
}
|
|
555
|
+
const { totals, quality, topGenres, topLabels, topArtists, recentlyAdded } = data;
|
|
556
|
+
console.log(
|
|
557
|
+
`Collection: ${totals.offlineAlbums} albums \xB7 ${totals.offlineArtists} artists \xB7 ${totals.offlineTracks} offline tracks \xB7 ${totals.savedTracks} saved tracks`
|
|
558
|
+
);
|
|
559
|
+
section(
|
|
560
|
+
"Quality (offline tracks)",
|
|
561
|
+
quality.map((q) => [
|
|
562
|
+
`${q.bitDepth}-bit`,
|
|
563
|
+
`${q.count} ${pct(q.count, totals.offlineTracks)}`
|
|
564
|
+
])
|
|
565
|
+
);
|
|
566
|
+
section(
|
|
567
|
+
"Top genres",
|
|
568
|
+
topGenres.map((g) => [g.name, String(g.count)])
|
|
569
|
+
);
|
|
570
|
+
section(
|
|
571
|
+
"Top artists (by albums)",
|
|
572
|
+
topArtists.map((a) => [a.name, String(a.count)])
|
|
573
|
+
);
|
|
574
|
+
section(
|
|
575
|
+
"Top labels",
|
|
576
|
+
topLabels.map((l) => [l.name, String(l.count)])
|
|
577
|
+
);
|
|
578
|
+
section(
|
|
579
|
+
"Added recently",
|
|
580
|
+
recentlyAdded.map((m) => [m.month, String(m.count)])
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
// src/commands/track.ts
|
|
586
|
+
import { defineCommand as defineCommand12 } from "citty";
|
|
587
|
+
var track = defineCommand12({
|
|
530
588
|
meta: { name: "track", description: "Show track details" },
|
|
531
589
|
args: {
|
|
532
590
|
id: { type: "positional", description: "Track ID", required: true }
|
|
@@ -546,7 +604,7 @@ var track = defineCommand11({
|
|
|
546
604
|
});
|
|
547
605
|
|
|
548
606
|
// src/commands/url.ts
|
|
549
|
-
import { defineCommand as
|
|
607
|
+
import { defineCommand as defineCommand13 } from "citty";
|
|
550
608
|
import { readNowPlayingTrackId } from "@kud/qobuz";
|
|
551
609
|
var currentTrackLink = async (client) => {
|
|
552
610
|
const trackId = await readNowPlayingTrackId();
|
|
@@ -570,7 +628,7 @@ var specificLink = (client, type, id) => {
|
|
|
570
628
|
}
|
|
571
629
|
return link;
|
|
572
630
|
};
|
|
573
|
-
var url =
|
|
631
|
+
var url = defineCommand13({
|
|
574
632
|
meta: {
|
|
575
633
|
name: "url",
|
|
576
634
|
description: "Copy a deep-link to the clipboard \u2014 the playing track, or a given item"
|
|
@@ -605,7 +663,7 @@ var url = defineCommand12({
|
|
|
605
663
|
});
|
|
606
664
|
|
|
607
665
|
// src/index.ts
|
|
608
|
-
var main =
|
|
666
|
+
var main = defineCommand14({
|
|
609
667
|
meta: {
|
|
610
668
|
name: "qobuz",
|
|
611
669
|
description: "Qobuz from the command line \u2014 search, library, and quick-open in the app"
|
|
@@ -620,6 +678,7 @@ var main = defineCommand13({
|
|
|
620
678
|
similar,
|
|
621
679
|
fav,
|
|
622
680
|
playlist,
|
|
681
|
+
stats,
|
|
623
682
|
url,
|
|
624
683
|
open,
|
|
625
684
|
play,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/qobuz-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Command-line interface for Qobuz — search, library, and quick-open in the app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"node": ">=20"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@kud/qobuz": "0.
|
|
28
|
+
"@kud/qobuz": "0.4.0",
|
|
29
29
|
"citty": "0.2.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|