fluncle 0.40.0 → 0.41.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 +75 -17
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -2539,7 +2539,7 @@ function parseVersion(version) {
2539
2539
  var currentVersion;
2540
2540
  var init_version = __esm(() => {
2541
2541
  init_output();
2542
- currentVersion = "0.40.0".trim() ? "0.40.0".trim() : "0.1.0";
2542
+ currentVersion = "0.41.0".trim() ? "0.41.0".trim() : "0.1.0";
2543
2543
  });
2544
2544
 
2545
2545
  // src/update-notifier.ts
@@ -4001,7 +4001,7 @@ function parseVersion2(version) {
4001
4001
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
4002
4002
  var init_version2 = __esm(() => {
4003
4003
  init_output();
4004
- currentVersion2 = "0.40.0".trim() ? "0.40.0".trim() : "0.1.0";
4004
+ currentVersion2 = "0.41.0".trim() ? "0.41.0".trim() : "0.1.0";
4005
4005
  });
4006
4006
 
4007
4007
  // src/commands/track.ts
@@ -4215,11 +4215,19 @@ async function enrichQueueCommand(limit) {
4215
4215
  async function enrichSweepCommand(limit) {
4216
4216
  return adminApiPost(`/api/admin/enrich-sweep?limit=${limit}`);
4217
4217
  }
4218
- async function backfillLastfmCommand(limit, dryRun) {
4219
- return adminApiPost(`/api/admin/backfill/lastfm?limit=${limit}&dryRun=${dryRun}`);
4218
+ async function backfillLastfmCommand(limit, dryRun, cursor) {
4219
+ const params = new URLSearchParams({ dryRun: String(dryRun), limit: String(limit) });
4220
+ if (cursor) {
4221
+ params.set("cursor", cursor);
4222
+ }
4223
+ return adminApiPost(`/api/admin/backfill/lastfm?${params.toString()}`);
4220
4224
  }
4221
- async function backfillDiscogsCommand(limit, dryRun) {
4222
- return adminApiPost(`/api/admin/backfill/discogs?limit=${limit}&dryRun=${dryRun}`);
4225
+ async function backfillDiscogsCommand(limit, dryRun, cursor) {
4226
+ const params = new URLSearchParams({ dryRun: String(dryRun), limit: String(limit) });
4227
+ if (cursor) {
4228
+ params.set("cursor", cursor);
4229
+ }
4230
+ return adminApiPost(`/api/admin/backfill/discogs?${params.toString()}`);
4223
4231
  }
4224
4232
  async function vehiclesCommand(limit) {
4225
4233
  const tracks = await fetchAdminTracks({ hasVideo: true, max: limit, order: "desc" });
@@ -5590,30 +5598,80 @@ async function runPreviewArchiveBackfill(options, previewArchiveBackfillCommand2
5590
5598
  }
5591
5599
  async function runBackfillLastfm(options, backfillLastfmCommand2) {
5592
5600
  const limit = parseListLimit(options.limit);
5593
- const result = await backfillLastfmCommand2(limit, options.dryRun);
5601
+ const loved = [];
5602
+ const failed = [];
5603
+ let cursor;
5604
+ let dryRun = options.dryRun;
5605
+ while (loved.length + failed.length < limit) {
5606
+ const remaining = limit - (loved.length + failed.length);
5607
+ const result = await backfillLastfmCommand2(remaining, options.dryRun, cursor);
5608
+ dryRun = result.dryRun;
5609
+ loved.push(...result.loved);
5610
+ failed.push(...result.failed);
5611
+ if (!options.json) {
5612
+ const verb2 = result.dryRun ? "Would love" : "Loved";
5613
+ console.log(` \u2026${verb2.toLowerCase()} ${result.lovedCount}; ${result.failedCount} failed`);
5614
+ }
5615
+ if (result.nextCursor === null) {
5616
+ break;
5617
+ }
5618
+ cursor = result.nextCursor;
5619
+ }
5594
5620
  if (options.json) {
5595
- printJson(result);
5621
+ printJson({
5622
+ dryRun,
5623
+ failed,
5624
+ failedCount: failed.length,
5625
+ loved,
5626
+ lovedCount: loved.length,
5627
+ ok: true
5628
+ });
5596
5629
  return;
5597
5630
  }
5598
- const verb = result.dryRun ? "Would love" : "Loved";
5599
- console.log(`${verb} ${result.lovedCount} finding(s) on Last.fm; ${result.failedCount} failed.`);
5600
- for (const logId of result.loved) {
5631
+ const verb = dryRun ? "Would love" : "Loved";
5632
+ console.log(`${verb} ${loved.length} finding(s) on Last.fm; ${failed.length} failed.`);
5633
+ for (const logId of loved) {
5601
5634
  console.log(` ${logId}`);
5602
5635
  }
5603
- for (const item of result.failed) {
5636
+ for (const item of failed) {
5604
5637
  console.log(` ${item.logId}: ${item.error}`);
5605
5638
  }
5606
5639
  }
5607
5640
  async function runBackfillDiscogs(options, backfillDiscogsCommand2) {
5608
5641
  const limit = parseListLimit(options.limit);
5609
- const result = await backfillDiscogsCommand2(limit, options.dryRun);
5642
+ const resolved = [];
5643
+ const unresolved = [];
5644
+ let cursor;
5645
+ let dryRun = options.dryRun;
5646
+ while (resolved.length + unresolved.length < limit) {
5647
+ const remaining = limit - (resolved.length + unresolved.length);
5648
+ const result = await backfillDiscogsCommand2(remaining, options.dryRun, cursor);
5649
+ dryRun = result.dryRun;
5650
+ resolved.push(...result.resolved);
5651
+ unresolved.push(...result.unresolved);
5652
+ if (!options.json) {
5653
+ const verb2 = result.dryRun ? "would resolve" : "resolved";
5654
+ console.log(` \u2026${verb2} ${result.resolvedCount}; ${result.unresolvedCount} unresolved`);
5655
+ }
5656
+ if (result.nextCursor === null) {
5657
+ break;
5658
+ }
5659
+ cursor = result.nextCursor;
5660
+ }
5610
5661
  if (options.json) {
5611
- printJson(result);
5662
+ printJson({
5663
+ dryRun,
5664
+ ok: true,
5665
+ resolved,
5666
+ resolvedCount: resolved.length,
5667
+ unresolved,
5668
+ unresolvedCount: unresolved.length
5669
+ });
5612
5670
  return;
5613
5671
  }
5614
- const verb = result.dryRun ? "Would resolve" : "Resolved";
5615
- console.log(`${verb} ${result.resolvedCount} Discogs release id(s); ${result.unresolvedCount} unresolved.`);
5616
- for (const item of result.resolved) {
5672
+ const verb = dryRun ? "Would resolve" : "Resolved";
5673
+ console.log(`${verb} ${resolved.length} Discogs release id(s); ${unresolved.length} unresolved.`);
5674
+ for (const item of resolved) {
5617
5675
  const master = item.masterId ? ` (master ${item.masterId})` : "";
5618
5676
  console.log(` ${item.logId}: release ${item.releaseId}${master}`);
5619
5677
  }
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.40.0"
34
+ "version": "0.41.0"
35
35
  }