deadman-fm 0.1.2 → 0.1.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/dist/commands/interactive.js +29 -63
- package/package.json +1 -1
|
@@ -299,69 +299,34 @@ export async function interactive() {
|
|
|
299
299
|
// Option 1 — Create a station
|
|
300
300
|
// ---------------------------------------------------------------------------
|
|
301
301
|
async function handleCreate() {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
try {
|
|
327
|
-
const opener = process.platform === "darwin"
|
|
328
|
-
? "open"
|
|
329
|
-
: process.platform === "win32"
|
|
330
|
-
? "start"
|
|
331
|
-
: "xdg-open";
|
|
332
|
-
execSync(`${opener} "https://deadman.fm/create?name=${encodeURIComponent(stationName)}&genre=${encodeURIComponent(genre)}" 2>/dev/null`);
|
|
333
|
-
}
|
|
334
|
-
catch {
|
|
335
|
-
p.log.warn(`Visit: https://deadman.fm/create\nName: ${stationName} Genre: ${genre}`);
|
|
336
|
-
}
|
|
337
|
-
const stationIdRaw = await p.text({
|
|
338
|
-
message: "Station ID from the page (leave blank to skip)",
|
|
339
|
-
placeholder: "42",
|
|
340
|
-
});
|
|
341
|
-
guardCancel(stationIdRaw);
|
|
342
|
-
const stationIdParsed = stationIdRaw
|
|
343
|
-
? parseInt(stationIdRaw, 10)
|
|
344
|
-
: NaN;
|
|
345
|
-
const stationId = !isNaN(stationIdParsed) ? stationIdParsed : null;
|
|
346
|
-
if (stationId !== null) {
|
|
347
|
-
p.log.success(`Station #${stationId} created — "${stationName}" (${genre})`);
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
p.log.success(`Station "${stationName}" ready.`);
|
|
351
|
-
p.log.info("Run Sync music once your on-chain tx confirms.");
|
|
352
|
-
}
|
|
353
|
-
// Auto-flow into sync
|
|
354
|
-
const goSync = await p.confirm({
|
|
355
|
-
message: "Sync music to this station now?",
|
|
356
|
-
initialValue: true,
|
|
357
|
-
});
|
|
358
|
-
guardCancel(goSync);
|
|
359
|
-
if (goSync) {
|
|
360
|
-
await handleSyncForStation(stationName, stationId);
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
p.log.info("Pick Sync music any time to upload tracks.");
|
|
302
|
+
const stations = loadLocalStations();
|
|
303
|
+
if (stations.length === 0) {
|
|
304
|
+
p.log.warn("You don't own a station yet.");
|
|
305
|
+
p.log.info("Win one in the daily emoji auction at deadman.fm");
|
|
306
|
+
const openAuction = await p.confirm({
|
|
307
|
+
message: "Open the auction page?",
|
|
308
|
+
initialValue: true,
|
|
309
|
+
});
|
|
310
|
+
guardCancel(openAuction);
|
|
311
|
+
if (openAuction) {
|
|
312
|
+
try {
|
|
313
|
+
const opener = process.platform === "darwin"
|
|
314
|
+
? "open"
|
|
315
|
+
: process.platform === "win32"
|
|
316
|
+
? "start"
|
|
317
|
+
: "xdg-open";
|
|
318
|
+
execSync(`${opener} "https://deadman.fm" 2>/dev/null`);
|
|
319
|
+
p.log.success("Opened deadman.fm — win an emoji, then come back here to sync music.");
|
|
320
|
+
}
|
|
321
|
+
catch {
|
|
322
|
+
p.log.info("Visit: https://deadman.fm");
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return;
|
|
364
326
|
}
|
|
327
|
+
// Has stations — go straight to sync
|
|
328
|
+
p.log.success(`You own ${stations.length} station${stations.length === 1 ? "" : "s"}. Let's sync music.`);
|
|
329
|
+
await handleSync();
|
|
365
330
|
}
|
|
366
331
|
// ---------------------------------------------------------------------------
|
|
367
332
|
// Option 2 — Sync music (standalone entry point)
|
|
@@ -369,7 +334,8 @@ async function handleCreate() {
|
|
|
369
334
|
async function handleSync() {
|
|
370
335
|
const stations = loadLocalStations();
|
|
371
336
|
if (stations.length === 0) {
|
|
372
|
-
p.log.warn("
|
|
337
|
+
p.log.warn("You don't own a station yet.");
|
|
338
|
+
p.log.info("Win one in the daily auction at deadman.fm");
|
|
373
339
|
return;
|
|
374
340
|
}
|
|
375
341
|
let stationName;
|