MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / addMetadataAndCover

Method addMetadataAndCover

convert/convert.ts:206–223  ·  view source on GitHub ↗
(inputMp3: string, outputPath: string, metadata: SongInfo, coverPath?: string)

Source from the content-addressed store, hash-verified

204 if (coverPath) {
205 args.push("-i", coverPath, "-map", "0:a", "-map", "1:v", "-disposition:v:0", "attached_pic");
206 }
207 args.push("-metadata", `title=${metadata.title}`);
208 args.push("-metadata", `artist=${metadata.artist}`);
209 args.push("-metadata", `album=${metadata.album}`);
210 args.push("-y", outputPath);
211
212 await execFileAsync("ffmpeg", args, { timeout: 120000 });
213 return fs.existsSync(outputPath);
214 } catch (error) {
215 console.error("Failed to add metadata:", error);
216 return false;
217 }
218 }
219
220 async getVideoDuration(filePath: string): Promise<number> {
221 try {
222 const { stdout } = await execFileAsync("ffprobe", ["-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", filePath]);
223 return parseFloat(stdout.trim()) || 0;
224 } catch (error) {
225 console.error("Failed to get video duration:", error);
226 return 0;

Callers 1

handleVideoConversionMethod · 0.80

Calls 2

execFileAsyncFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected