#!/usr/bin/env python3
"""
视频拆分服务模块

这个模块提供了基于PySceneDetect的视频场景检测和拆分功能。

主要组件:
- types: 类型定义和数据结构
- detectors: 场景检测器实现
- validators: 视频验证器实现
- service: 核心服务实现
- cli: 命令行接口

使用示例:
    from python_core.services.video_splitter import VideoSplitterService, DetectionConfig
    
    service = VideoSplitterService()
    config = DetectionConfig(threshold=30.0)
    result = service.analyze_video("video.mp4", config)
"""

from .types import (
    SceneInfo,
    AnalysisResult,
    DetectionConfig,
    DetectorType,
    ServiceError,
    DependencyError,
    ValidationError,
    SceneDetector,
    VideoValidator
)

from .detectors import PySceneDetectDetector
from .validators import BasicVideoValidator
from .service import VideoSplitterService
from .cli import VideoSplitterCommander

__version__ = "1.0.0"
__author__ = "Video Splitter Team"

__all__ = [
    # 类型和异常
    "SceneInfo",
    "AnalysisResult", 
    "DetectionConfig",
    "DetectorType",
    "ServiceError",
    "DependencyError",
    "ValidationError",
    "SceneDetector",
    "VideoValidator",
    
    # 实现类
    "PySceneDetectDetector",
    "BasicVideoValidator",
    "VideoSplitterService",
    "VideoSplitterCommander",
]

# 便捷函数
def create_service(output_base_dir: str = None) -> VideoSplitterService:
    """
    创建视频拆分服务实例
    
    Args:
        output_base_dir: 输出基础目录
        
    Returns:
        VideoSplitterService实例
    """
    return VideoSplitterService(output_base_dir=output_base_dir)

def analyze_video(video_path: str, threshold: float = 30.0, detector_type: str = "content") -> AnalysisResult:
    """
    快速分析视频的便捷函数
    
    Args:
        video_path: 视频路径
        threshold: 检测阈值
        detector_type: 检测器类型
        
    Returns:
        分析结果
    """
    service = create_service()
    config = DetectionConfig(
        threshold=threshold,
        detector_type=DetectorType(detector_type)
    )
    return service.analyze_video(video_path, config)
