# core/media_import.py
import os

def import_sfx(resolve, file_path, display_name, target_bin_name="SFX"):
    project_manager = resolve.GetProjectManager()
    project = project_manager.GetCurrentProject()
    media_pool = project.GetMediaPool()
    root_bin = media_pool.GetRootBin()

    # 3. 执行导入
    items = media_pool.ImportMedia([file_path])

    if items and len(items) > 0:
        clip = items[0]
        clip.SetClipProperty("Clip Name", display_name)
        return f"Successfully imported {display_name} to {target_bin_name}"
    else:
        raise Exception("Resolve failed to import media. File might be locked or format unsupported.")