fluncle 0.32.0 → 0.34.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 +23 -12
  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) {
@@ -3147,12 +3166,6 @@ function buildBody(options) {
3147
3166
  if (options.recordedAt !== undefined) {
3148
3167
  body.recordedAt = options.recordedAt;
3149
3168
  }
3150
- if (options.mixcloudUrl !== undefined) {
3151
- body.mixcloudUrl = options.mixcloudUrl;
3152
- }
3153
- if (options.youtubeUrl !== undefined) {
3154
- body.youtubeUrl = options.youtubeUrl;
3155
- }
3156
3169
  if (options.soundcloudUrl !== undefined) {
3157
3170
  body.soundcloudUrl = options.soundcloudUrl;
3158
3171
  }
@@ -3776,7 +3789,7 @@ function parseVersion(version) {
3776
3789
  var currentVersion, latestReleaseUrl = "https://api.github.com/repos/mauricekleine/fluncle/releases/latest";
3777
3790
  var init_version = __esm(() => {
3778
3791
  init_output();
3779
- currentVersion = "0.32.0".trim() ? "0.32.0".trim() : "0.1.0";
3792
+ currentVersion = "0.34.0".trim() ? "0.34.0".trim() : "0.1.0";
3780
3793
  });
3781
3794
 
3782
3795
  // src/commands/track.ts
@@ -5114,11 +5127,11 @@ function addAdminCommands(program2) {
5114
5127
  adminMixtapes.action(() => {
5115
5128
  adminMixtapes.outputHelp();
5116
5129
  });
5117
- adminMixtapes.command("create").description("Log a new mixtape draft").option("--duration-ms <duration>", "Duration (mm:ss, h:mm:ss, or ms)").option("--json", "Print JSON", false).option("--mixcloud-url <url>", "Mixcloud URL").option("--note <text>", "Operator note").option("--recorded-at <date>", "Recorded date (ISO)").option("--soundcloud-url <url>", "SoundCloud URL").option("--youtube-url <url>", "YouTube URL").allowExcessArguments().action(async (options) => {
5130
+ adminMixtapes.command("create").description("Log a new mixtape draft").option("--duration-ms <duration>", "Duration (mm:ss, h:mm:ss, or ms)").option("--json", "Print JSON", false).option("--note <text>", "Operator note").option("--recorded-at <date>", "Recorded date (ISO)").option("--soundcloud-url <url>", "SoundCloud URL (manual; YouTube + Mixcloud come from distribute)").allowExcessArguments().action(async (options) => {
5118
5131
  const { mixtapeCreateCommand: mixtapeCreateCommand2 } = await Promise.resolve().then(() => (init_mixtapes2(), exports_mixtapes));
5119
5132
  await runMixtapeCreate(options, mixtapeCreateCommand2);
5120
5133
  });
5121
- adminMixtapes.command("update").description("Update a mixtape's fields").argument("[id]").option("--duration-ms <duration>", "Duration (mm:ss, h:mm:ss, or ms)").option("--json", "Print JSON", false).option("--mixcloud-url <url>", "Mixcloud URL").option("--note <text>", "Operator note").option("--recorded-at <date>", "Recorded date (ISO)").option("--soundcloud-url <url>", "SoundCloud URL").option("--youtube-url <url>", "YouTube URL").allowExcessArguments().action(async (id, options) => {
5134
+ adminMixtapes.command("update").description("Update a mixtape's fields").argument("[id]").option("--duration-ms <duration>", "Duration (mm:ss, h:mm:ss, or ms)").option("--json", "Print JSON", false).option("--note <text>", "Operator note").option("--recorded-at <date>", "Recorded date (ISO)").option("--soundcloud-url <url>", "SoundCloud URL (manual; YouTube + Mixcloud come from distribute)").allowExcessArguments().action(async (id, options) => {
5122
5135
  const { mixtapeUpdateCommand: mixtapeUpdateCommand2 } = await Promise.resolve().then(() => (init_mixtapes2(), exports_mixtapes));
5123
5136
  await runMixtapeUpdate(id, options, mixtapeUpdateCommand2);
5124
5137
  });
@@ -5805,7 +5818,6 @@ var stringOptions = new Set([
5805
5818
  "--key",
5806
5819
  "--limit",
5807
5820
  "--mime",
5808
- "--mixcloud-url",
5809
5821
  "--note",
5810
5822
  "--platform",
5811
5823
  "--poster",
@@ -5817,8 +5829,7 @@ var stringOptions = new Set([
5817
5829
  "--source",
5818
5830
  "--status",
5819
5831
  "--url",
5820
- "--video-url",
5821
- "--youtube-url"
5832
+ "--video-url"
5822
5833
  ]);
5823
5834
  var rootHelpSections = `
5824
5835
 
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.34.0"
35
35
  }