@ciphore/radiocli 0.2.3 → 0.2.5
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/CHANGELOG.md +147 -2
- package/CONTRIBUTING.md +46 -6
- package/README.md +108 -209
- package/SECURITY.md +23 -1
- package/dist/agent/alarm-service.js +10 -7
- package/dist/agent/cli.js +16 -1
- package/dist/agent/command-schema.js +47 -0
- package/dist/agent/headless-host.js +234 -67
- package/dist/agent/launcher.js +7 -67
- package/dist/agent/mcp-install.js +15 -15
- package/dist/agent/mcp-server.js +10 -5
- package/dist/agent/service.js +74 -39
- package/dist/agent/session.js +227 -53
- package/dist/agent/tui-session.js +213 -0
- package/dist/alarms/active-session.js +9 -12
- package/dist/alarms/cli.js +19 -3
- package/dist/alarms/guard.js +79 -36
- package/dist/alarms/inhibitor.js +27 -22
- package/dist/alarms/occurrence-cache.js +25 -0
- package/dist/alarms/power-guard-store.js +2 -10
- package/dist/alarms/runner.js +140 -45
- package/dist/alarms/schedule.js +37 -2
- package/dist/alarms/scheduler.js +202 -52
- package/dist/alarms/setup-verification.js +1 -2
- package/dist/alarms/system-volume-linux.js +160 -0
- package/dist/alarms/system-volume-ownership.js +335 -0
- package/dist/alarms/system-volume.js +188 -26
- package/dist/alarms/terminal-launcher.js +76 -136
- package/dist/alarms/tui-presence.js +2 -4
- package/dist/cli/arguments.js +212 -0
- package/dist/cli/completion.js +44 -0
- package/dist/cli/doctor.js +156 -0
- package/dist/cli/interactive.js +79 -0
- package/dist/cli/listener.js +227 -0
- package/dist/cli/output.js +121 -0
- package/dist/cli/render-tui.js +34 -0
- package/dist/cli.js +198 -154
- package/dist/platform/capabilities.js +60 -0
- package/dist/platform/desktop-media.js +61 -0
- package/dist/platform/desktop.js +36 -0
- package/dist/platform/diagnostics.js +273 -0
- package/dist/{player/command.js → platform/executables.js} +43 -9
- package/dist/platform/ipc.js +14 -0
- package/dist/platform/json-worker.js +111 -0
- package/dist/platform/launch-command.js +138 -0
- package/dist/platform/loopback.js +44 -0
- package/dist/platform/mpris.js +356 -0
- package/dist/platform/network.js +380 -0
- package/dist/platform/omarchy.js +147 -0
- package/dist/platform/packages.js +222 -0
- package/dist/platform/paths.js +40 -0
- package/dist/platform/runtime.js +67 -0
- package/dist/platform/shell.js +24 -0
- package/dist/platform/storage.js +48 -0
- package/dist/platform/support.js +214 -0
- package/dist/platform/terminal.js +63 -0
- package/dist/platform/terminals.js +223 -0
- package/dist/player/airplay-discovery.js +145 -60
- package/dist/player/airplay-policy.js +15 -0
- package/dist/player/airplay-process.js +63 -0
- package/dist/player/airplay-readiness.js +42 -0
- package/dist/player/airplay-sender-health.js +49 -49
- package/dist/player/airplay-sender-package.js +5 -0
- package/dist/player/airplay-sender-patch.js +102 -4
- package/dist/player/airplay-setup.js +51 -0
- package/dist/player/airplay-worker.js +97 -41
- package/dist/player/backend-install.js +17 -95
- package/dist/player/command-diagnostics.js +2 -2
- package/dist/player/ffmpeg-input.js +37 -0
- package/dist/player/mpv-desktop-media.js +194 -0
- package/dist/player/mpv-ipc-client.js +52 -2
- package/dist/player/player-controller.js +569 -82
- package/dist/player/radio-engine.js +282 -0
- package/dist/playlists/playlist.js +18 -16
- package/dist/providers/cache.js +293 -99
- package/dist/providers/discovery-session.js +111 -0
- package/dist/providers/provider-manager.js +106 -28
- package/dist/providers/radio-browser.js +418 -89
- package/dist/providers/radio-garden.js +18 -23
- package/dist/setup-playback.js +152 -0
- package/dist/setup.js +163 -168
- package/dist/storage/file-lock.js +113 -0
- package/dist/storage/read-settings.js +33 -0
- package/dist/storage/replace-file.js +20 -0
- package/dist/storage/repository.js +247 -0
- package/dist/storage/station-identity.js +21 -0
- package/dist/storage/station-schema.js +27 -0
- package/dist/storage/store.js +333 -107
- package/dist/streams/import-stream.js +163 -0
- package/dist/ui/AdaptiveContent.js +49 -32
- package/dist/ui/App.js +822 -481
- package/dist/ui/AppContent.js +5 -5
- package/dist/ui/airplay-settings.js +12 -5
- package/dist/ui/app-state.js +8 -1
- package/dist/ui/ascii.js +11 -2
- package/dist/ui/bidi-ranges.js +45 -0
- package/dist/ui/components/AdaptiveMarquee.js +20 -10
- package/dist/ui/components/Logo.js +5 -2
- package/dist/ui/components/Menu.js +2 -2
- package/dist/ui/components/ScreenHeader.js +1 -1
- package/dist/ui/components/StationList.js +6 -4
- package/dist/ui/components/TopTabs.js +1 -1
- package/dist/ui/display-context.js +8 -11
- package/dist/ui/format.js +37 -4
- package/dist/ui/help-content.js +9 -6
- package/dist/ui/layout.js +5 -2
- package/dist/ui/page-footer.js +3 -3
- package/dist/ui/rtl-output.js +137 -0
- package/dist/ui/screen-items.js +12 -6
- package/dist/ui/screen-meta.js +1 -1
- package/dist/ui/screens/AirPlayCodeScreen.js +6 -2
- package/dist/ui/screens/AirPlaySettingsScreen.js +10 -6
- package/dist/ui/screens/AlarmsScreen.js +5 -2
- package/dist/ui/screens/ExploreScreen.js +2 -1
- package/dist/ui/screens/HelpScreen.js +8 -4
- package/dist/ui/screens/HomeScreen.js +5 -1
- package/dist/ui/screens/MapScreen.js +1 -1
- package/dist/ui/screens/NowPlayingScreen.js +4 -4
- package/dist/ui/screens/SearchScreen.js +3 -1
- package/dist/ui/screens/SettingsScreen.js +28 -21
- package/dist/ui/screens/StatsScreen.js +3 -1
- package/dist/ui/system-actions.js +80 -52
- package/dist/ui/terminal-renderer.js +16 -0
- package/dist/ui/text-direction.js +9 -0
- package/dist/ui/use-alarm-tui.js +57 -42
- package/dist/ui/use-app-input.js +84 -30
- package/dist/ui/use-command-executor.js +50 -19
- package/dist/ui/visualizers/gallop.js +1 -1
- package/dist/ui/visualizers/receiver-style-registry.js +2 -1
- package/dist/update-check.js +10 -18
- package/docs/THIRD_PARTY_NOTICES.md +6 -4
- package/package.json +34 -11
- package/scripts/build-airplay-native.mjs +22 -0
- package/vendor/node-airtunes2/LICENSE +208 -0
- package/vendor/node-airtunes2/RADIOCLI_PATCH.md +29 -0
- package/vendor/node-airtunes2/README.md +225 -0
- package/vendor/node-airtunes2/UPSTREAM.json +50 -0
- package/vendor/node-airtunes2/binding.gyp +41 -0
- package/vendor/node-airtunes2/lib/ap2_test.js +4 -0
- package/vendor/node-airtunes2/lib/atv.js +307 -0
- package/vendor/node-airtunes2/lib/atvAuthenticator.js +136 -0
- package/vendor/node-airtunes2/lib/audio_out.js +69 -0
- package/vendor/node-airtunes2/lib/circular_buffer.js +133 -0
- package/vendor/node-airtunes2/lib/config.js +26 -0
- package/vendor/node-airtunes2/lib/device_airtunes.js +532 -0
- package/vendor/node-airtunes2/lib/devices.js +266 -0
- package/vendor/node-airtunes2/lib/ed25519.js +26 -0
- package/vendor/node-airtunes2/lib/homekit/credentials.js +86 -0
- package/vendor/node-airtunes2/lib/homekit/encryption.js +69 -0
- package/vendor/node-airtunes2/lib/homekit/number.js +44 -0
- package/vendor/node-airtunes2/lib/homekit/tlv.js +95 -0
- package/vendor/node-airtunes2/lib/http.js +189 -0
- package/vendor/node-airtunes2/lib/index.d.ts +141 -0
- package/vendor/node-airtunes2/lib/index.js +127 -0
- package/vendor/node-airtunes2/lib/ntp.js +37 -0
- package/vendor/node-airtunes2/lib/num_util.js +21 -0
- package/vendor/node-airtunes2/lib/packet_pool.js +43 -0
- package/vendor/node-airtunes2/lib/rtsp.js +1807 -0
- package/vendor/node-airtunes2/lib/srp.js +158 -0
- package/vendor/node-airtunes2/lib/udp_servers.js +214 -0
- package/vendor/node-airtunes2/lib/util.js +12 -0
- package/vendor/node-airtunes2/package.json +31 -0
- package/vendor/node-airtunes2/src/CADebugMacros.h +257 -0
- package/vendor/node-airtunes2/src/CAHostTimeBase.cpp +105 -0
- package/vendor/node-airtunes2/src/CAHostTimeBase.h +224 -0
- package/vendor/node-airtunes2/src/aes_utils.c +864 -0
- package/vendor/node-airtunes2/src/aes_utils.h +24 -0
- package/vendor/node-airtunes2/src/base64.c +136 -0
- package/vendor/node-airtunes2/src/base64.h +42 -0
- package/vendor/node-airtunes2/src/bindings.cc +29 -0
- package/vendor/node-airtunes2/src/codec.cc +170 -0
- package/vendor/node-airtunes2/src/coreaudio.cc +332 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { RadioBrowserProvider
|
|
1
|
+
import { RadioBrowserProvider } from './radio-browser.js';
|
|
2
2
|
import { RadioGardenProvider } from './radio-garden.js';
|
|
3
|
+
import { abortable, DiscoverySessions } from './discovery-session.js';
|
|
3
4
|
export class ProviderManager {
|
|
4
5
|
radioBrowser;
|
|
5
6
|
radioGarden;
|
|
7
|
+
discovery = new DiscoverySessions(state => JSON.stringify([state.browser, state.garden, state.browserSources, state.gardenSource, [...state.seen]]).length * 2 + state.seen.size * 128);
|
|
6
8
|
constructor(radioBrowser = new RadioBrowserProvider(), radioGarden = new RadioGardenProvider()) {
|
|
7
9
|
this.radioBrowser = radioBrowser;
|
|
8
10
|
this.radioGarden = radioGarden;
|
|
@@ -16,38 +18,118 @@ export class ProviderManager {
|
|
|
16
18
|
byCountry(countryCode, limit, offset) {
|
|
17
19
|
return this.radioBrowser.byCountry(countryCode, limit, offset);
|
|
18
20
|
}
|
|
21
|
+
byCountryPage(countryCode, options = {}) {
|
|
22
|
+
return this.radioBrowser.byCountryPage(countryCode, options);
|
|
23
|
+
}
|
|
19
24
|
byId(provider, id) {
|
|
20
25
|
if (provider !== 'radio-browser')
|
|
21
26
|
return Promise.resolve(null);
|
|
22
27
|
return this.radioBrowser.byId(id);
|
|
23
28
|
}
|
|
24
|
-
nearby(location, limit) {
|
|
25
|
-
return this.radioBrowser.nearby(location, limit);
|
|
29
|
+
nearby(location, limit, options = {}) {
|
|
30
|
+
return this.radioBrowser.nearby(location, limit, options);
|
|
26
31
|
}
|
|
27
|
-
detectLocation() {
|
|
28
|
-
return this.radioBrowser.detectLocation();
|
|
32
|
+
detectLocation(options = {}) {
|
|
33
|
+
return this.radioBrowser.detectLocation(options);
|
|
29
34
|
}
|
|
30
35
|
async search(query, settings, options = {}) {
|
|
31
|
-
const includeGarden =
|
|
36
|
+
const includeGarden = settings.enableRadioGarden || options.includeExperimental;
|
|
32
37
|
if (!includeGarden) {
|
|
33
38
|
return this.radioBrowser.search(query, options);
|
|
34
39
|
}
|
|
40
|
+
// Legacy array callers may still pass a displayed offset. Traverse the
|
|
41
|
+
// merged cursor so those offsets cannot skip Browser rows after Garden.
|
|
42
|
+
// Interactive clients keep nextCursor and avoid this repeated traversal.
|
|
43
|
+
let skip = Math.max(0, options.offset ?? 0);
|
|
44
|
+
const limit = options.limit ?? 80;
|
|
45
|
+
const items = [];
|
|
46
|
+
let cursor;
|
|
47
|
+
do {
|
|
48
|
+
const page = await this.searchPage(query, settings, { ...options, limit, cursor });
|
|
49
|
+
const start = Math.min(skip, page.items.length);
|
|
50
|
+
skip -= start;
|
|
51
|
+
items.push(...page.items.slice(start, start + limit - items.length));
|
|
52
|
+
cursor = page.nextCursor;
|
|
53
|
+
} while (items.length < limit && cursor);
|
|
54
|
+
return items;
|
|
55
|
+
}
|
|
56
|
+
searchPage(query, settings, options = {}) {
|
|
57
|
+
const includeGarden = settings.enableRadioGarden || options.includeExperimental;
|
|
58
|
+
if (!includeGarden)
|
|
59
|
+
return this.radioBrowser.searchPage(query, options);
|
|
60
|
+
const limit = options.limit ?? 80;
|
|
61
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 1000)
|
|
62
|
+
throw new Error('Discovery page size must be between 1 and 1000.');
|
|
63
|
+
const fingerprint = JSON.stringify([query.trim(), options.codec, options.language, options.countryCode?.toUpperCase(), options.minBitrate, limit]);
|
|
64
|
+
return this.discovery.page(fingerprint, options.cursor, () => ({
|
|
65
|
+
browserExhausted: false, browser: [], browserSources: [],
|
|
66
|
+
gardenLoaded: false, garden: [],
|
|
67
|
+
gardenSource: { provider: 'radio-garden', source: 'search-snapshot', consumed: 0, exhausted: false, status: 'available' },
|
|
68
|
+
seen: new Set(), primaryTurn: true
|
|
69
|
+
}), state => this.federatedPage(state, query, limit, options), options.signal);
|
|
70
|
+
}
|
|
71
|
+
async federatedPage(state, query, limit, options) {
|
|
72
|
+
const fetchBrowser = !state.browserExhausted && state.browser.length < limit;
|
|
73
|
+
const fetchGarden = !state.gardenLoaded;
|
|
35
74
|
const [browserResult, gardenResult] = await Promise.allSettled([
|
|
36
|
-
this.radioBrowser.
|
|
37
|
-
|
|
75
|
+
fetchBrowser ? abortable(this.radioBrowser.searchPage(query, { ...options, limit, cursor: state.browserCursor }), options.signal) : Promise.resolve(null),
|
|
76
|
+
// Garden currently exposes one finite search response, without a known
|
|
77
|
+
// offset contract. Retain all returned hits and page that snapshot.
|
|
78
|
+
fetchGarden ? abortable(this.radioGarden.search(query, { ...options, limit: Number.MAX_SAFE_INTEGER }), options.signal) : Promise.resolve(null)
|
|
38
79
|
]);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
80
|
+
options.signal?.throwIfAborted();
|
|
81
|
+
if (browserResult.status === 'fulfilled' && browserResult.value) {
|
|
82
|
+
const page = browserResult.value;
|
|
83
|
+
state.browserCursor = page.nextCursor;
|
|
84
|
+
state.browserExhausted = page.exhausted;
|
|
85
|
+
state.browserSources = page.sources;
|
|
86
|
+
state.browser.push(...page.items);
|
|
87
|
+
}
|
|
88
|
+
else if (browserResult.status === 'rejected') {
|
|
89
|
+
state.browserSources = state.browserSources.length
|
|
90
|
+
? state.browserSources.map(source => source.exhausted ? source : { ...source, status: 'unavailable', message: errorText(browserResult.reason) })
|
|
91
|
+
: [{ provider: 'radio-browser', source: 'search', consumed: 0, exhausted: false, status: 'unavailable', message: errorText(browserResult.reason) }];
|
|
92
|
+
}
|
|
93
|
+
if (gardenResult.status === 'fulfilled' && gardenResult.value) {
|
|
94
|
+
state.gardenLoaded = true;
|
|
95
|
+
state.gardenSource = { ...state.gardenSource, status: 'available', message: undefined, consumed: gardenResult.value.length, exhausted: true };
|
|
96
|
+
state.garden = gardenResult.value.filter(station => matchesFilters(station, options));
|
|
97
|
+
}
|
|
98
|
+
else if (gardenResult.status === 'rejected') {
|
|
99
|
+
state.gardenSource = { ...state.gardenSource, status: 'unavailable', message: errorText(gardenResult.reason) };
|
|
43
100
|
}
|
|
44
|
-
|
|
101
|
+
const items = [];
|
|
102
|
+
while (items.length < limit && (state.browser.length || state.garden.length)) {
|
|
103
|
+
const primary = state.primaryTurn ? state.browser : state.garden;
|
|
104
|
+
const secondary = state.primaryTurn ? state.garden : state.browser;
|
|
105
|
+
const station = primary.shift() ?? secondary.shift();
|
|
106
|
+
state.primaryTurn = !state.primaryTurn;
|
|
107
|
+
if (!station)
|
|
108
|
+
break;
|
|
109
|
+
const key = `${station.provider}:${station.id}`;
|
|
110
|
+
if (state.seen.has(key))
|
|
111
|
+
continue;
|
|
112
|
+
state.seen.add(key);
|
|
113
|
+
items.push(station);
|
|
114
|
+
}
|
|
115
|
+
if (!items.length) {
|
|
116
|
+
if (browserResult.status === 'rejected')
|
|
117
|
+
throw browserResult.reason;
|
|
118
|
+
if (gardenResult.status === 'rejected')
|
|
119
|
+
throw gardenResult.reason;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
items,
|
|
123
|
+
exhausted: state.browserExhausted && state.gardenLoaded && state.browser.length === 0 && state.garden.length === 0,
|
|
124
|
+
sources: [...state.browserSources, state.gardenSource]
|
|
125
|
+
};
|
|
45
126
|
}
|
|
46
|
-
async resolve(station) {
|
|
127
|
+
async resolve(station, options = {}) {
|
|
128
|
+
options.signal?.throwIfAborted();
|
|
47
129
|
if (station.provider === 'radio-garden') {
|
|
48
|
-
return this.radioGarden.resolve(station);
|
|
130
|
+
return abortable(this.radioGarden.resolve(station, options), options.signal);
|
|
49
131
|
}
|
|
50
|
-
return this.radioBrowser.resolve(station);
|
|
132
|
+
return abortable(this.radioBrowser.resolve(station, options), options.signal);
|
|
51
133
|
}
|
|
52
134
|
vote(station) {
|
|
53
135
|
return this.radioBrowser.vote(station);
|
|
@@ -63,16 +145,12 @@ export class ProviderManager {
|
|
|
63
145
|
};
|
|
64
146
|
}
|
|
65
147
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (secondaryStation)
|
|
75
|
-
merged.push(secondaryStation);
|
|
76
|
-
}
|
|
77
|
-
return merged;
|
|
148
|
+
function matchesFilters(station, options) {
|
|
149
|
+
return !(options.minBitrate && (station.bitrate ?? 0) < options.minBitrate)
|
|
150
|
+
&& !(options.codec && station.codec?.toLowerCase() !== options.codec.toLowerCase())
|
|
151
|
+
&& !(options.language && !station.language?.toLowerCase().includes(options.language.toLowerCase()))
|
|
152
|
+
&& !(options.countryCode && station.countryCode?.toUpperCase() !== options.countryCode.toUpperCase());
|
|
153
|
+
}
|
|
154
|
+
function errorText(error) {
|
|
155
|
+
return error instanceof Error ? error.message : String(error);
|
|
78
156
|
}
|