fluncle 0.32.0 → 0.33.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 +20 -1
  2. package/package.json +1 -1
package/bin/fluncle.mjs CHANGED
@@ -3109,6 +3109,14 @@ async function mixtapeDistributeCommand(idOrLogId, options, onProgress = () => {
3109
3109
  }
3110
3110
  const mixtapeId = mixtape.id;
3111
3111
  let logId = mixtape.logId;
3112
+ if (!mixtape.durationMs) {
3113
+ const source = options.audio ?? options.video;
3114
+ const durationMs = source ? await probeDurationMs(source) : undefined;
3115
+ if (durationMs) {
3116
+ await mixtapeUpdateCommand(mixtapeId, { durationMs: String(durationMs), json: false });
3117
+ onProgress(`Duration: ${Math.round(durationMs / 60000)} min (from the upload).`);
3118
+ }
3119
+ }
3112
3120
  if (mixtape.status === "draft") {
3113
3121
  onProgress("Minting the coordinate…");
3114
3122
  const published = await mixtapePublishCommand(mixtapeId);
@@ -3139,6 +3147,17 @@ async function mixtapeDistributeCommand(idOrLogId, options, onProgress = () => {
3139
3147
  }
3140
3148
  return { logId, mixtapeId, results };
3141
3149
  }
3150
+ async function probeDurationMs(filePath) {
3151
+ try {
3152
+ const proc = Bun.spawn(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", filePath], { stderr: "ignore", stdout: "pipe" });
3153
+ const out = await new Response(proc.stdout).text();
3154
+ await proc.exited;
3155
+ const seconds = Number.parseFloat(out.trim());
3156
+ return Number.isFinite(seconds) && seconds > 0 ? Math.round(seconds * 1000) : undefined;
3157
+ } catch {
3158
+ return;
3159
+ }
3160
+ }
3142
3161
  function buildBody(options) {
3143
3162
  const body = {};
3144
3163
  if (options.note !== undefined) {
@@ -3776,7 +3795,7 @@ function parseVersion(version) {
3776
3795
  var currentVersion, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
3777
3796
  var init_version = __esm(() => {
3778
3797
  init_output();
3779
- currentVersion = "0.32.0".trim() ? "0.32.0".trim() : "0.1.0";
3798
+ currentVersion = "0.33.0".trim() ? "0.33.0".trim() : "0.1.0";
3780
3799
  });
3781
3800
 
3782
3801
  // src/commands/track.ts
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.32.0"
34
+ "version": "0.33.0"
35
35
  }