Skip to content

anbeime/skill / skills/agentkit-multimedia-shopping/agentkit-multimedia-shopping

agentkit-multimedia-shopping

Verified

电商运营与内容创作者在需要制作带货短视频时,用此技能一键生成9:16竖屏数字人成片。自动编排AI绘画、语音合成与视频生成,快速产出“小省导购员”专属形象与专业配音,让多模态视频制作省时省力。

scripts/generate_music.py

View on GitHub
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
音乐生成脚本
基于ByteDance agentkit-samples多媒体用例
"""

import sys
import os

def generate_music(style, emotion, duration=5, format="16khz_mono_wav"):
    """
    生成背景音乐

    Args:
        style (str): 音乐风格(orchestral/piano/string),默认"orchestral"
        emotion (str): 情绪基调(enthusiastic/professional/friendly),默认"neutral"
        duration (int): 时长(秒),默认5
        format (str): 音频格式(16khz_mono_wav),默认"16khz_mono_wav"

    Returns:
        object: 音乐文件对象(根据实际工具返回)

    Raises:
        ValueError: 参数验证失败
        Exception: 生成失败
    """
    # 参数验证
    if style not in ["orchestral", "piano", "string"]:
        raise ValueError("音乐风格必须是orchestral/piano/string之一")

    if emotion not in ["enthusiastic", "professional", "friendly", "neutral"]:
        raise ValueError("情绪基调必须是enthusiastic/professional/friendly/neutral之一")

    if duration <= 0:
        raise ValueError("时长必须大于0")

    if format != "16khz_mono_wav":
        raise ValueError("音频格式必须是16khz_mono_wav")

    # TODO: 调用实际的音乐生成工具
    # 这里需要根据ByteDance agentkit-samples的实际实现来调用
    # 示例代码(伪代码):
    #
    # from agentkit import MusicGenerator
    #
    # generator = MusicGenerator()
    # audio = generator.generate(
    #     style=style,
    #     emotion=emotion,
    #     duration=duration,
    #     format=format
    # )
    #
    # return audio

    # 占位符返回
    print(f"[generate_music] 生成背景音乐")
    print(f"  音乐风格: {style}")
    print(f"  情绪基调: {emotion}")
    print(f"  时长: {duration}秒")
    print(f"  音频格式: {format}")

    return None


def main():
    """
    主函数:从命令行读取参数并生成音乐
    """
    import argparse

    parser = argparse.ArgumentParser(description="生成背景音乐")
    parser.add_argument("--style", type=str, required=True, help="音乐风格(orchestral/piano/string)")
    parser.add_argument("--emotion", type=str, required=True, help="情绪基调(enthusiastic/professional/friendly)")
    parser.add_argument("--duration", type=int, default=5, help="时长(秒)")
    parser.add_argument("--format", type=str, default="16khz_mono_wav", help="音频格式(16khz_mono_wav)")
    parser.add_argument("--output", type=str, default="./output/music.wav", help="输出文件路径")

    args = parser.parse_args()

    try:
        # 生成音乐
        music_file = generate_music(
            style=args.style,
            emotion=args.emotion,
            duration=args.duration,
            format=args.format
        )

        # 保存音乐文件
        if music_file:
            # 确保输出目录存在
            output_dir = os.path.dirname(args.output)
            if output_dir and not os.path.exists(output_dir):
                os.makedirs(output_dir)

            music_file.save(args.output)
            print(f"音乐文件已保存至: {args.output}")
        else:
            print("警告: 音乐生成返回为空(可能是占位符)")

        return 0

    except ValueError as e:
        print(f"参数错误: {e}", file=sys.stderr)
        return 1
    except Exception as e:
        print(f"生成失败: {e}", file=sys.stderr)
        return 2


if __name__ == "__main__":
    sys.exit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall