mulmocast 1.2.67 → 1.2.69

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.
@@ -1,10 +1,47 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
+ import { GraphAILogger } from "graphai";
3
4
  import { listLocalizedAudioPaths } from "./audio.js";
4
5
  import { mkdir } from "../utils/file.js";
5
6
  import { ZipBuilder } from "../utils/zip.js";
6
7
  import { bundleTargetLang } from "../utils/const.js";
7
8
  import { createSilentAudio } from "../utils/ffmpeg_utils.js";
9
+ const downloadFile = async (url, destPath) => {
10
+ const response = await fetch(url);
11
+ if (!response.ok) {
12
+ throw new Error(`Failed to download file from ${url}: ${response.statusText}`);
13
+ }
14
+ const buffer = await response.arrayBuffer();
15
+ fs.writeFileSync(destPath, Buffer.from(buffer));
16
+ };
17
+ const processBgm = async (bgm, dir, zipper) => {
18
+ if (!bgm) {
19
+ return undefined;
20
+ }
21
+ if (bgm.kind === "path") {
22
+ // Local file path
23
+ const sourcePath = path.resolve(bgm.path);
24
+ if (!fs.existsSync(sourcePath)) {
25
+ GraphAILogger.log(`BGM file not found: ${sourcePath}`);
26
+ return undefined;
27
+ }
28
+ const fileName = path.basename(bgm.path);
29
+ const destPath = path.resolve(dir, fileName);
30
+ fs.copyFileSync(sourcePath, destPath);
31
+ zipper.addFile(sourcePath, fileName);
32
+ return fileName;
33
+ }
34
+ else if (bgm.kind === "url") {
35
+ // URL download
36
+ const fileName = path.basename(new URL(bgm.url).pathname) || "bgm.mp3";
37
+ const destPath = path.resolve(dir, fileName);
38
+ await downloadFile(bgm.url, destPath);
39
+ zipper.addFile(destPath);
40
+ return fileName;
41
+ }
42
+ // base64 or other formats are not supported
43
+ return undefined;
44
+ };
8
45
  const viewJsonFileName = "mulmo_view.json";
9
46
  const zipFileName = "mulmo.zip";
10
47
  const imageSourceMappings = [
@@ -78,7 +115,10 @@ export const mulmoViewerBundle = async (context) => {
78
115
  }
79
116
  });
80
117
  });
81
- fs.writeFileSync(path.resolve(dir, viewJsonFileName), JSON.stringify({ beats: resultJson, bgmSource: context.studio?.script.audioParams?.bgm }, null, 2));
118
+ // BGM
119
+ const bgmFileName = await processBgm(context.studio?.script.audioParams?.bgm, dir, zipper);
120
+ const bundleData = { beats: resultJson, bgmSource: bgmFileName };
121
+ fs.writeFileSync(path.resolve(dir, viewJsonFileName), JSON.stringify(bundleData, null, 2));
82
122
  zipper.addFile(path.resolve(dir, viewJsonFileName));
83
123
  if (isZip) {
84
124
  await zipper.finalize();
@@ -151,7 +151,7 @@ export const beat_graph_data = {
151
151
  defaultValue: {},
152
152
  },
153
153
  movieGenerator: {
154
- if: ":preprocessor.movieFile",
154
+ if: ":beat.moviePrompt",
155
155
  agent: ":preprocessor.movieAgentInfo.agent",
156
156
  inputs: {
157
157
  media: "movie",
@@ -134,3 +134,18 @@ export type PublicAPIArgs = {
134
134
  callbacks?: CallbackFunction[];
135
135
  };
136
136
  export type ImageType = "image" | "movie";
137
+ export type MulmoViewerBeat = {
138
+ text?: string;
139
+ duration?: number;
140
+ multiLinguals?: Record<string, string>;
141
+ audioSources?: Record<string, string>;
142
+ imageSource?: string;
143
+ videoSource?: string;
144
+ videoWithAudioSource?: string;
145
+ htmlImageSource?: string;
146
+ soundEffectSource?: string;
147
+ };
148
+ export type MulmoViewerData = {
149
+ beats: MulmoViewerBeat[];
150
+ bgmSource?: string;
151
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.67",
3
+ "version": "1.2.69",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -71,8 +71,8 @@
71
71
  },
72
72
  "homepage": "https://github.com/receptron/mulmocast-cli#readme",
73
73
  "dependencies": {
74
- "@google-cloud/text-to-speech": "^6.3.1",
75
- "@google/genai": "^1.25.0",
74
+ "@google-cloud/text-to-speech": "^6.4.0",
75
+ "@google/genai": "^1.27.0",
76
76
  "@graphai/anthropic_agent": "^2.0.11",
77
77
  "@graphai/browserless_agent": "^2.0.1",
78
78
  "@graphai/gemini_agent": "^2.0.1",
@@ -84,7 +84,7 @@
84
84
  "@graphai/vanilla_node_agents": "^2.0.4",
85
85
  "@inquirer/input": "^4.2.5",
86
86
  "@inquirer/select": "^4.4.0",
87
- "@modelcontextprotocol/sdk": "^1.20.1",
87
+ "@modelcontextprotocol/sdk": "^1.20.2",
88
88
  "@mozilla/readability": "^0.6.0",
89
89
  "@tavily/core": "^0.5.11",
90
90
  "archiver": "^7.0.1",
@@ -96,8 +96,8 @@
96
96
  "marked": "^16.4.1",
97
97
  "mulmocast-vision": "^1.0.4",
98
98
  "ora": "^9.0.0",
99
- "puppeteer": "^24.25.0",
100
- "replicate": "^1.3.0",
99
+ "puppeteer": "^24.26.1",
100
+ "replicate": "^1.3.1",
101
101
  "yaml": "^2.8.1",
102
102
  "yargs": "^18.0.0",
103
103
  "zod": "^3.25.76",
@@ -105,10 +105,10 @@
105
105
  },
106
106
  "devDependencies": {
107
107
  "@receptron/test_utils": "^2.0.3",
108
- "@types/archiver": "^6.0.3",
109
- "@types/fluent-ffmpeg": "^2.1.26",
108
+ "@types/archiver": "^7.0.0",
109
+ "@types/fluent-ffmpeg": "^2.1.28",
110
110
  "@types/jsdom": "^27.0.0",
111
- "@types/yargs": "^17.0.33",
111
+ "@types/yargs": "^17.0.34",
112
112
  "eslint": "^9.38.0",
113
113
  "eslint-config-prettier": "^10.1.8",
114
114
  "eslint-plugin-prettier": "^5.5.4",