mulmocast 0.0.12 → 0.0.13

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.
@@ -199,7 +199,7 @@ export const audio = async (context, callbacks) => {
199
199
  graph.injectValue("outputStudioFilePath", outputStudioFilePath);
200
200
  graph.injectValue("audioSegmentDirPath", audioSegmentDirPath);
201
201
  graph.injectValue("audioDirPath", audioDirPath);
202
- graph.injectValue("musicFile", MulmoMediaSourceMethods.resolve(studio.script.audioParams.bgm, context) ?? process.env.PATH_BGM ?? defaultBGMPath);
202
+ graph.injectValue("musicFile", MulmoMediaSourceMethods.resolve(studio.script.audioParams.bgm, context) ?? process.env.PATH_BGM ?? defaultBGMPath());
203
203
  if (callbacks) {
204
204
  callbacks.forEach((callback) => {
205
205
  graph.registerCallback(callback);
@@ -1,2 +1,3 @@
1
1
  import { MulmoStudioContext } from "../types/index.js";
2
- export declare const captions: (context: MulmoStudioContext) => Promise<void>;
2
+ import type { CallbackFunction } from "graphai";
3
+ export declare const captions: (context: MulmoStudioContext, callbacks?: CallbackFunction[]) => Promise<void>;
@@ -62,11 +62,16 @@ const graph_data = {
62
62
  },
63
63
  },
64
64
  };
65
- export const captions = async (context) => {
65
+ export const captions = async (context, callbacks) => {
66
66
  try {
67
67
  MulmoStudioContextMethods.setSessionState(context, "caption", true);
68
68
  const graph = new GraphAI(graph_data, { ...vanillaAgents });
69
69
  graph.injectValue("context", context);
70
+ if (callbacks) {
71
+ callbacks.forEach((callback) => {
72
+ graph.registerCallback(callback);
73
+ });
74
+ }
70
75
  await graph.run();
71
76
  }
72
77
  finally {
@@ -4,7 +4,7 @@ import { FfmpegContextInit, FfmpegContextGenerateOutput, FfmpegContextInputForma
4
4
  const combineAudioFilesAgent = async ({ namedInputs, }) => {
5
5
  const { context, combinedFileName } = namedInputs;
6
6
  const ffmpegContext = FfmpegContextInit();
7
- const longSilentId = FfmpegContextInputFormattedAudio(ffmpegContext, silent60secPath);
7
+ const longSilentId = FfmpegContextInputFormattedAudio(ffmpegContext, silent60secPath());
8
8
  // We cannot reuse longSilentId. We need to explicitly split it for each beat.
9
9
  const silentIds = context.studio.beats.map((_, index) => `[ls_${index}]`);
10
10
  ffmpegContext.filterComplex.push(`${longSilentId}asplit=${silentIds.length}${silentIds.join("")}`);
@@ -27,10 +27,8 @@ export declare const getOutputVideoFilePath: (outDirPath: string, fileName: stri
27
27
  export declare const getOutputPdfFilePath: (outDirPath: string, fileName: string, pdfMode: PDFMode, lang?: string) => string;
28
28
  export declare const getTemplateFilePath: (templateName: string) => string;
29
29
  export declare const mkdir: (dirPath: string) => void;
30
- export declare const silentPath: string;
31
- export declare const silentLastPath: string;
32
- export declare const silent60secPath: string;
33
- export declare const defaultBGMPath: string;
30
+ export declare const silent60secPath: () => string;
31
+ export declare const defaultBGMPath: () => string;
34
32
  export declare const getHTMLFile: (filename: string) => string;
35
33
  export declare const getBaseDirPath: (basedir?: string) => string;
36
34
  export declare const getFullPath: (baseDirPath: string | undefined, file: string) => string;
package/lib/utils/file.js CHANGED
@@ -95,10 +95,10 @@ export const mkdir = (dirPath) => {
95
95
  fs.mkdirSync(dirPath, { recursive: true });
96
96
  }
97
97
  };
98
- export const silentPath = path.resolve(npmRoot, "./assets/audio/silent300.mp3");
99
- export const silentLastPath = path.resolve(npmRoot, "./assets/audio/silent800.mp3");
100
- export const silent60secPath = path.resolve(npmRoot, "./assets/audio/silent60sec.mp3");
101
- export const defaultBGMPath = path.resolve(npmRoot, "./assets/music/StarsBeyondEx.mp3");
98
+ // export const silentPath = path.resolve(npmRoot, "./assets/audio/silent300.mp3");
99
+ // export const silentLastPath = path.resolve(npmRoot, "./assets/audio/silent800.mp3");
100
+ export const silent60secPath = () => path.resolve(npmRoot, "./assets/audio/silent60sec.mp3");
101
+ export const defaultBGMPath = () => path.resolve(npmRoot, "./assets/music/StarsBeyondEx.mp3");
102
102
  export const getHTMLFile = (filename) => {
103
103
  const htmlPath = path.resolve(npmRoot, `./assets/html/${filename}.html`);
104
104
  return fs.readFileSync(htmlPath, "utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -11,8 +11,6 @@
11
11
  "./lib",
12
12
  "./scripts/templates",
13
13
  "./assets/music/StarsBeyondEx.mp3",
14
- "./assets/audio/silent300.mp3",
15
- "./assets/audio/silent800.mp3",
16
14
  "./assets/audio/silent60sec.mp3",
17
15
  "./assets/html/",
18
16
  "./assets/font/",
Binary file
Binary file