fluncle 0.55.0 → 0.56.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 +60 -3
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -423,7 +423,7 @@ function parseVersion(version) {
423
423
  var currentVersion;
424
424
  var init_version = __esm(() => {
425
425
  init_output();
426
- currentVersion = "0.55.0".trim() ? "0.55.0".trim() : "0.1.0";
426
+ currentVersion = "0.56.0".trim() ? "0.56.0".trim() : "0.1.0";
427
427
  });
428
428
 
429
429
  // src/update-notifier.ts
@@ -1912,7 +1912,7 @@ function parseVersion2(version) {
1912
1912
  var currentVersion2, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
1913
1913
  var init_version2 = __esm(() => {
1914
1914
  init_output();
1915
- currentVersion2 = "0.55.0".trim() ? "0.55.0".trim() : "0.1.0";
1915
+ currentVersion2 = "0.56.0".trim() ? "0.56.0".trim() : "0.1.0";
1916
1916
  });
1917
1917
 
1918
1918
  // src/commands/track.ts
@@ -2097,7 +2097,8 @@ __export(exports_admin_tracks, {
2097
2097
  enrichQueueCommand: () => enrichQueueCommand,
2098
2098
  contextQueueCommand: () => contextQueueCommand,
2099
2099
  backfillLastfmCommand: () => backfillLastfmCommand,
2100
- backfillDiscogsCommand: () => backfillDiscogsCommand
2100
+ backfillDiscogsCommand: () => backfillDiscogsCommand,
2101
+ backfillAlignmentCommand: () => backfillAlignmentCommand
2101
2102
  });
2102
2103
  async function fetchAdminTracks(options) {
2103
2104
  const { hasContext, hasObservation, hasVideo, max, order, status } = options;
@@ -2172,6 +2173,13 @@ async function backfillDiscogsCommand(limit, dryRun, cursor) {
2172
2173
  }
2173
2174
  return adminApiPost(`/api/admin/backfill/discogs?${params.toString()}`);
2174
2175
  }
2176
+ async function backfillAlignmentCommand(limit, dryRun, cursor) {
2177
+ const params = new URLSearchParams({ dryRun: String(dryRun), limit: String(limit) });
2178
+ if (cursor) {
2179
+ params.set("cursor", cursor);
2180
+ }
2181
+ return adminApiPost(`/api/admin/backfill/alignment?${params.toString()}`);
2182
+ }
2175
2183
  async function vehiclesCommand(limit) {
2176
2184
  const tracks = await fetchAdminTracks({ hasVideo: true, max: limit, order: "desc" });
2177
2185
  return tracks.map((track) => ({
@@ -5611,6 +5619,10 @@ function addAdminCommands(program2) {
5611
5619
  const { backfillDiscogsCommand: backfillDiscogsCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
5612
5620
  await runBackfillDiscogs(options, backfillDiscogsCommand2);
5613
5621
  });
5622
+ backfill.command("alignment").description("Back-fill word-level caption timings for observations rendered before timestamps (no re-render)").option("--dry-run", "Report the eligible set but align nothing", false).option("--limit <limit>", "Max observations to align", "50").option("--json", "Print JSON", false).action(async (options) => {
5623
+ const { backfillAlignmentCommand: backfillAlignmentCommand2 } = await Promise.resolve().then(() => (init_admin_tracks(), exports_admin_tracks));
5624
+ await runBackfillAlignment(options, backfillAlignmentCommand2);
5625
+ });
5614
5626
  }
5615
5627
  async function runTrackPreviewArchive(idOrLogId, options, previewArchiveUploadCommand2) {
5616
5628
  if (!idOrLogId || !options.file || !options.source || !options.mime) {
@@ -5791,6 +5803,51 @@ async function runBackfillDiscogs(options, backfillDiscogsCommand2) {
5791
5803
  console.log(` ${item.logId}: release ${item.releaseId}${master}`);
5792
5804
  }
5793
5805
  }
5806
+ async function runBackfillAlignment(options, backfillAlignmentCommand2) {
5807
+ const limit = parseListLimit(options.limit);
5808
+ const aligned = [];
5809
+ const empty = [];
5810
+ const failed = [];
5811
+ let cursor;
5812
+ let dryRun = options.dryRun;
5813
+ while (aligned.length + empty.length + failed.length < limit) {
5814
+ const remaining = limit - (aligned.length + empty.length + failed.length);
5815
+ const result = await backfillAlignmentCommand2(remaining, options.dryRun, cursor);
5816
+ dryRun = result.dryRun;
5817
+ aligned.push(...result.aligned);
5818
+ empty.push(...result.empty);
5819
+ failed.push(...result.failed);
5820
+ if (!options.json) {
5821
+ const verb2 = result.dryRun ? "would align" : "aligned";
5822
+ console.log(` \u2026${verb2} ${result.alignedCount}; ${result.emptyCount} empty; ${result.failedCount} failed`);
5823
+ }
5824
+ if (result.nextCursor === null) {
5825
+ break;
5826
+ }
5827
+ cursor = result.nextCursor;
5828
+ }
5829
+ if (options.json) {
5830
+ printJson({
5831
+ aligned,
5832
+ alignedCount: aligned.length,
5833
+ dryRun,
5834
+ empty,
5835
+ emptyCount: empty.length,
5836
+ failed,
5837
+ failedCount: failed.length,
5838
+ ok: true
5839
+ });
5840
+ return;
5841
+ }
5842
+ const verb = dryRun ? "Would align" : "Aligned";
5843
+ console.log(`${verb} ${aligned.length} observation(s); ${empty.length} empty; ${failed.length} failed.`);
5844
+ for (const logId of aligned) {
5845
+ console.log(` ${logId}`);
5846
+ }
5847
+ for (const item of failed) {
5848
+ console.log(` ${item.logId}: ${item.error}`);
5849
+ }
5850
+ }
5794
5851
  async function runTrackVideo(idOrLogId, options, trackVideoCommand2) {
5795
5852
  if (!idOrLogId) {
5796
5853
  throw new Error("Missing id. Usage: fluncle admin tracks video <track_id|log_id> (--dir <dir> | --footage <file> [--footage-social <file>] [--footage-silent <file>] [--poster <file>] [--cover <file>] [--note <file>] [--composition <file>] [--props <file>] [--render <file>])");
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.55.0"
34
+ "version": "0.56.0"
35
35
  }