mulmocast 0.0.17 → 0.0.18

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.
@@ -2,7 +2,7 @@ import { GraphAI, GraphAILogger } from "graphai";
2
2
  import * as agents from "@graphai/vanilla";
3
3
  import { getHTMLFile } from "../utils/file.js";
4
4
  import { renderHTMLToImage, interpolate } from "../utils/markdown.js";
5
- import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
5
+ import { MulmoStudioContextMethods, MulmoPresentationStyleMethods } from "../methods/index.js";
6
6
  const vanillaAgents = agents.default ?? agents;
7
7
  const graph_data = {
8
8
  version: 0.5,
@@ -23,10 +23,9 @@ const graph_data = {
23
23
  const { beat, context, index } = namedInputs;
24
24
  try {
25
25
  MulmoStudioContextMethods.setBeatSessionState(context, "caption", index, true);
26
- const { fileDirs } = namedInputs.context;
27
- const { caption } = context;
28
- const { imageDirPath } = fileDirs;
29
- const { canvasSize } = context.presentationStyle;
26
+ const imageDirPath = MulmoStudioContextMethods.getImageDirPath(context);
27
+ const caption = MulmoStudioContextMethods.getCaption(context);
28
+ const canvasSize = MulmoPresentationStyleMethods.getCanvasSize(context.presentationStyle);
30
29
  const imagePath = `${imageDirPath}/${context.studio.filename}/${index}_caption.png`;
31
30
  const template = getHTMLFile("caption");
32
31
  const text = (() => {
@@ -171,15 +171,18 @@ const createVideo = async (audioArtifactFilePath, outputVideoPath, context, capt
171
171
  return true;
172
172
  };
173
173
  export const movieFilePath = (context) => {
174
- const { studio, fileDirs, caption } = context;
175
- return getOutputVideoFilePath(fileDirs.outDirPath, studio.filename, context.lang, caption);
174
+ const outDirPath = MulmoStudioContextMethods.getOutDirPath(context);
175
+ const fileName = MulmoStudioContextMethods.getFileName(context);
176
+ const caption = MulmoStudioContextMethods.getCaption(context);
177
+ return getOutputVideoFilePath(outDirPath, fileName, context.lang, caption);
176
178
  };
177
179
  export const movie = async (context) => {
178
180
  MulmoStudioContextMethods.setSessionState(context, "video", true);
179
181
  try {
180
- const { studio, fileDirs, caption } = context;
181
- const { outDirPath } = fileDirs;
182
- const audioArtifactFilePath = getAudioArtifactFilePath(outDirPath, studio.filename);
182
+ const caption = MulmoStudioContextMethods.getCaption(context);
183
+ const fileName = MulmoStudioContextMethods.getFileName(context);
184
+ const outDirPath = MulmoStudioContextMethods.getOutDirPath(context);
185
+ const audioArtifactFilePath = getAudioArtifactFilePath(outDirPath, fileName);
183
186
  const outputVideoPath = movieFilePath(context);
184
187
  if (await createVideo(audioArtifactFilePath, outputVideoPath, context, caption)) {
185
188
  writingMessage(outputVideoPath);
@@ -115,12 +115,12 @@ export const initializeContext = async (argv) => {
115
115
  return null;
116
116
  }
117
117
  const presentationStyle = getPresentationStyle(presentationStylePath);
118
- const multiLingual = getMultiLingual(outputMultilingualFilePath, mulmoScript.beats.length);
119
118
  // Create or update MulmoStudio file with MulmoScript
120
119
  const currentStudio = readMulmoScriptFile(outputStudioFilePath);
121
120
  try {
122
121
  // validate mulmoStudioSchema. skip if __test_invalid__ is true
123
122
  const studio = createOrUpdateStudioData(mulmoScript, currentStudio?.mulmoData, fileName);
123
+ const multiLingual = getMultiLingual(outputMultilingualFilePath, studio.beats.length);
124
124
  return {
125
125
  studio,
126
126
  fileDirs: files,
@@ -20,6 +20,8 @@ export declare const MulmoStudioContextMethods: {
20
20
  getImageDirPath(context: MulmoStudioContext): string;
21
21
  getImageProjectDirPath(context: MulmoStudioContext): string;
22
22
  getOutDirPath(context: MulmoStudioContext): string;
23
+ getFileName(context: MulmoStudioContext): string;
24
+ getCaption(context: MulmoStudioContext): string | undefined;
23
25
  setSessionState(context: MulmoStudioContext, sessionType: SessionType, value: boolean): void;
24
26
  setBeatSessionState(context: MulmoStudioContext, sessionType: BeatSessionType, index: number, value: boolean): void;
25
27
  };
@@ -40,6 +40,12 @@ export const MulmoStudioContextMethods = {
40
40
  getOutDirPath(context) {
41
41
  return context.fileDirs.outDirPath;
42
42
  },
43
+ getFileName(context) {
44
+ return context.studio.filename;
45
+ },
46
+ getCaption(context) {
47
+ return context.caption;
48
+ },
43
49
  setSessionState(context, sessionType, value) {
44
50
  context.sessionState.inSession[sessionType] = value;
45
51
  notifyStateChange(context, sessionType);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -64,7 +64,7 @@
64
64
  "dotenv": "^16.4.7",
65
65
  "fluent-ffmpeg": "^2.1.3",
66
66
  "google-auth-library": "^9.15.1",
67
- "graphai": "^2.0.6",
67
+ "graphai": "^2.0.8",
68
68
  "inquirer": "^12.6.1",
69
69
  "marked": "^15.0.12",
70
70
  "ora": "^8.2.0",