fluncle 0.163.0 → 0.165.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.
Files changed (2) hide show
  1. package/bin/fluncle.mjs +71 -27
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -561,7 +561,7 @@ function parseVersion(version) {
561
561
  var currentVersion;
562
562
  var init_version = __esm(() => {
563
563
  init_output();
564
- currentVersion = "0.163.0".trim() ? "0.163.0".trim() : "0.1.0";
564
+ currentVersion = "0.165.0".trim() ? "0.165.0".trim() : "0.1.0";
565
565
  });
566
566
 
567
567
  // src/update-notifier.ts
@@ -995,6 +995,46 @@ var init_recent = __esm(() => {
995
995
  init_api();
996
996
  });
997
997
 
998
+ // src/commands/fresh.ts
999
+ var exports_fresh = {};
1000
+ __export(exports_fresh, {
1001
+ freshCommand: () => freshCommand
1002
+ });
1003
+ function coordinate(track) {
1004
+ return track.logId ?? COORD_FALLBACK;
1005
+ }
1006
+ function freshRows(tracks) {
1007
+ const coordWidth = tracks.reduce((width, track) => {
1008
+ return Math.max(width, coordinate(track).length);
1009
+ }, 0);
1010
+ return tracks.map((track) => {
1011
+ const released = track.releaseDate.slice(0, 10);
1012
+ const label = `${track.artists.join(", ")} — ${track.title}`;
1013
+ return `${coordinate(track).padEnd(coordWidth)} ${released} ${label}`;
1014
+ });
1015
+ }
1016
+ async function freshCommand({
1017
+ json,
1018
+ limit
1019
+ }) {
1020
+ const response = await publicApiGet(`/api/v1/tracks/fresh?limit=${limit}`);
1021
+ if (json) {
1022
+ printJson2({ ok: true, ...response });
1023
+ return;
1024
+ }
1025
+ if (response.tracks.length === 0) {
1026
+ console.log(`Nothing new out in the last ${response.windowDays} days.`);
1027
+ return;
1028
+ }
1029
+ console.log(freshRows(response.tracks).join(`
1030
+ `));
1031
+ }
1032
+ var COORD_FALLBACK = "—";
1033
+ var init_fresh = __esm(() => {
1034
+ init_api();
1035
+ init_output();
1036
+ });
1037
+
998
1038
  // src/commands/artists.ts
999
1039
  var exports_artists = {};
1000
1040
  __export(exports_artists, {
@@ -1531,13 +1571,13 @@ var init_mixtapes = __esm(() => {
1531
1571
  });
1532
1572
 
1533
1573
  // src/format.ts
1534
- function coordinate(track) {
1535
- return track.logId ?? COORD_FALLBACK;
1574
+ function coordinate2(track) {
1575
+ return track.logId ?? COORD_FALLBACK2;
1536
1576
  }
1537
1577
  function artistTitle(track) {
1538
1578
  return `${track.artists.join(", ")} — ${track.title}`;
1539
1579
  }
1540
- var COORD_FALLBACK = "—";
1580
+ var COORD_FALLBACK2 = "—";
1541
1581
  var init_format = __esm(() => {
1542
1582
  init_util();
1543
1583
  });
@@ -1748,13 +1788,13 @@ async function selectRecentTrack(tracks) {
1748
1788
  }
1749
1789
  function buildSelectorLines(tracks, selectedIndex, columns) {
1750
1790
  const coordWidth = tracks.reduce((width, track) => {
1751
- return Math.max(width, coordinate(track).length);
1791
+ return Math.max(width, coordinate2(track).length);
1752
1792
  }, 0);
1753
1793
  return [
1754
1794
  "Select a track to open in Spotify",
1755
1795
  ...tracks.map((track, index) => {
1756
1796
  const prefix = index === selectedIndex ? "> " : " ";
1757
- const label = `${coordinate(track).padEnd(coordWidth)} ${artistTitle(track)}`;
1797
+ const label = `${coordinate2(track).padEnd(coordWidth)} ${artistTitle(track)}`;
1758
1798
  const line = truncateTerminalLine(`${prefix}${label}`, Math.max(columns, 20));
1759
1799
  return index === selectedIndex ? `\x1B[7m${line}\x1B[0m` : line;
1760
1800
  }),
@@ -2189,7 +2229,7 @@ function parseVersion2(version) {
2189
2229
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
2190
2230
  var init_version2 = __esm(() => {
2191
2231
  init_output();
2192
- currentVersion2 = "0.163.0".trim() ? "0.163.0".trim() : "0.1.0";
2232
+ currentVersion2 = "0.165.0".trim() ? "0.165.0".trim() : "0.1.0";
2193
2233
  });
2194
2234
 
2195
2235
  // ../../packages/registry/src/index.ts
@@ -5353,7 +5393,7 @@ import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:f
5353
5393
  async function logbookGapsCommand(limit) {
5354
5394
  const query = typeof limit === "number" ? `?limit=${encodeURIComponent(String(limit))}` : "";
5355
5395
  const response = await adminApiGet(`/api/admin/logbook/gaps${query}`);
5356
- return response.gaps;
5396
+ return { gaps: response.gaps, spent: response.spent };
5357
5397
  }
5358
5398
  function resolveBody(options) {
5359
5399
  if (options.body !== undefined) {
@@ -6481,11 +6521,11 @@ __export(exports_format, {
6481
6521
  trackDetailLines: () => trackDetailLines,
6482
6522
  rowLabel: () => rowLabel,
6483
6523
  foundDate: () => foundDate,
6484
- coordinate: () => coordinate2,
6524
+ coordinate: () => coordinate3,
6485
6525
  artistTitle: () => artistTitle2
6486
6526
  });
6487
- function coordinate2(track) {
6488
- return track.logId ?? COORD_FALLBACK2;
6527
+ function coordinate3(track) {
6528
+ return track.logId ?? COORD_FALLBACK3;
6489
6529
  }
6490
6530
  function artistTitle2(track) {
6491
6531
  return `${track.artists.join(", ")} — ${track.title}`;
@@ -6502,10 +6542,10 @@ function stripCoordinateSuffix(title, logId) {
6502
6542
  }
6503
6543
  function trackRows(tracks) {
6504
6544
  const coordWidth = tracks.reduce((width, track) => {
6505
- return Math.max(width, coordinate2(track).length);
6545
+ return Math.max(width, coordinate3(track).length);
6506
6546
  }, 0);
6507
6547
  return tracks.map((track) => {
6508
- return `${coordinate2(track).padEnd(coordWidth)} ${rowLabel(track)}`;
6548
+ return `${coordinate3(track).padEnd(coordWidth)} ${rowLabel(track)}`;
6509
6549
  });
6510
6550
  }
6511
6551
  function foundDate(addedAt) {
@@ -6513,14 +6553,14 @@ function foundDate(addedAt) {
6513
6553
  }
6514
6554
  function vehicleRows(rows) {
6515
6555
  const coordWidth = rows.reduce((width, row) => {
6516
- return Math.max(width, coordinate2(row).length);
6556
+ return Math.max(width, coordinate3(row).length);
6517
6557
  }, 0);
6518
6558
  return rows.map((row) => {
6519
- return `${coordinate2(row).padEnd(coordWidth)} ${foundDate(row.addedAt)} ${row.vehicle ?? COORD_FALLBACK2} · ${row.register ?? COORD_FALLBACK2}`;
6559
+ return `${coordinate3(row).padEnd(coordWidth)} ${foundDate(row.addedAt)} ${row.vehicle ?? COORD_FALLBACK3} · ${row.register ?? COORD_FALLBACK3}`;
6520
6560
  });
6521
6561
  }
6522
6562
  function trackDetailLines(track) {
6523
- const lines = [`${coordinate2(track)} ${artistTitle2(track)}`];
6563
+ const lines = [`${coordinate3(track)} ${artistTitle2(track)}`];
6524
6564
  const meta = [];
6525
6565
  if (typeof track.durationMs === "number") {
6526
6566
  meta.push(formatDuration(track.durationMs));
@@ -6533,7 +6573,7 @@ function trackDetailLines(track) {
6533
6573
  }
6534
6574
  return lines;
6535
6575
  }
6536
- var COORD_FALLBACK2 = "—";
6576
+ var COORD_FALLBACK3 = "—";
6537
6577
  var init_format2 = __esm(() => {
6538
6578
  init_util();
6539
6579
  });
@@ -8722,6 +8762,10 @@ function addListenCommands(program2) {
8722
8762
  const { recentCommand: recentCommand3 } = await Promise.resolve().then(() => (init_recent(), exports_recent));
8723
8763
  await runRecent(options, recentCommand3);
8724
8764
  });
8765
+ program2.command("fresh").description("What just came out, newest release first").option("--limit <limit>", "Number of releases to fetch").option("--json", "Print JSON", false).action(async (options) => {
8766
+ const { freshCommand: freshCommand2 } = await Promise.resolve().then(() => (init_fresh(), exports_fresh));
8767
+ await freshCommand2({ json: options.json, limit: parseListLimit(options.limit) });
8768
+ });
8725
8769
  program2.command("artists").description("Browse artists in Fluncle's archive").argument("[slug]", "Artist slug (omit for the full list)").option("--json", "Print JSON", false).action(async (slug, options) => {
8726
8770
  const { artistsListCommand: artistsListCommand2, artistsGetCommand: artistsGetCommand2 } = await Promise.resolve().then(() => (init_artists(), exports_artists));
8727
8771
  await runArtists(slug, options, { artistsGetCommand: artistsGetCommand2, artistsListCommand: artistsListCommand2 });
@@ -10717,8 +10761,8 @@ async function runMixtapeList(options, mixtapeListCommand2) {
10717
10761
  }
10718
10762
  for (const mixtape of mixtapes) {
10719
10763
  const status = mixtape.status ?? "distributing";
10720
- const coordinate3 = mixtape.logId ?? "unminted";
10721
- console.log(`${coordinate3} ${status} ${mixtape.memberCount} bangers ${mixtape.title}`);
10764
+ const coordinate4 = mixtape.logId ?? "unminted";
10765
+ console.log(`${coordinate4} ${status} ${mixtape.memberCount} bangers ${mixtape.title}`);
10722
10766
  }
10723
10767
  }
10724
10768
  async function runClipsList(options, clipsListCommand2, clipPostsListCommand2) {
@@ -10872,10 +10916,10 @@ async function runMixtapeGet(idOrLogId, options, mixtapeGetCommand2) {
10872
10916
  printJson(mixtape);
10873
10917
  return;
10874
10918
  }
10875
- const coordinate3 = mixtape.logId ?? "unminted";
10919
+ const coordinate4 = mixtape.logId ?? "unminted";
10876
10920
  const status = mixtape.status ?? "distributing";
10877
10921
  console.log(`${mixtape.title}`);
10878
- console.log(` ${coordinate3} \xB7 ${status} \xB7 ${mixtape.memberCount} bangers`);
10922
+ console.log(` ${coordinate4} \xB7 ${status} \xB7 ${mixtape.memberCount} bangers`);
10879
10923
  if (mixtape.note) {
10880
10924
  console.log(` ${mixtape.note}`);
10881
10925
  }
@@ -10960,9 +11004,9 @@ async function runNewsletterList(options, newsletterListCommand2) {
10960
11004
  }
10961
11005
  async function runLogbookGaps(options, logbookGapsCommand2) {
10962
11006
  const limit = options.limit === undefined ? undefined : Number.parseInt(options.limit, 10);
10963
- const gaps = await logbookGapsCommand2(limit !== undefined && Number.isFinite(limit) ? limit : undefined);
11007
+ const { gaps, spent } = await logbookGapsCommand2(limit !== undefined && Number.isFinite(limit) ? limit : undefined);
10964
11008
  if (options.json) {
10965
- printJson({ gaps, ok: true });
11009
+ printJson({ gaps, ok: true, spent });
10966
11010
  return;
10967
11011
  }
10968
11012
  if (gaps.length === 0) {
@@ -11182,8 +11226,8 @@ async function runGalaxies(slug, options, commands) {
11182
11226
  console.log(`${galaxy.name} (${galaxy.slug})`);
11183
11227
  console.log(`${galaxy.memberCount} finding${galaxy.memberCount === 1 ? "" : "s"}`);
11184
11228
  for (const finding of findings) {
11185
- const coordinate3 = finding.logId ? `${finding.logId} ` : "";
11186
- console.log(` ${coordinate3}${finding.artists.join(", ")} \u2014 ${finding.title}`);
11229
+ const coordinate4 = finding.logId ? `${finding.logId} ` : "";
11230
+ console.log(` ${coordinate4}${finding.artists.join(", ")} \u2014 ${finding.title}`);
11187
11231
  }
11188
11232
  return;
11189
11233
  }
@@ -11625,14 +11669,14 @@ async function runAdminRequeueAnalysis(options, requeueAnalysisCommand2) {
11625
11669
  printSweepJson({ ...result }, result.failed.length);
11626
11670
  return;
11627
11671
  }
11628
- const { coordinate: coordinate3 } = await Promise.resolve().then(() => (init_format2(), exports_format));
11672
+ const { coordinate: coordinate4 } = await Promise.resolve().then(() => (init_format2(), exports_format));
11629
11673
  const staleCount = result.withSourceAudio.length + result.withoutSourceAudio.length;
11630
11674
  if (staleCount === 0) {
11631
11675
  console.log("Nothing to re-queue. Every finding's BPM/key was analyzed from full audio.");
11632
11676
  return;
11633
11677
  }
11634
11678
  const describe = (row) => {
11635
- const coord = coordinate3({ logId: row.logId });
11679
+ const coord = coordinate4({ logId: row.logId });
11636
11680
  const bpm = row.bpm ? `${row.bpm} bpm` : "no bpm";
11637
11681
  const key = row.key ?? "no key";
11638
11682
  const from = row.analyzedFrom ?? "legacy/null";
package/package.json CHANGED
@@ -31,5 +31,5 @@
31
31
  "url": "git+https://github.com/mauricekleine/fluncle.git"
32
32
  },
33
33
  "type": "module",
34
- "version": "0.163.0"
34
+ "version": "0.165.0"
35
35
  }