mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
- Create video_platforms/whereby/ directory with __init__.py, client.py, tasks.py - Implement WherebyClient inheriting from VideoPlatformClient interface - Move all functions from whereby.py into WherebyClient methods - Use VideoPlatform.WHEREBY enum for PLATFORM_NAME - Register WherebyClient in platform registry - Update factory.py to include S3 bucket config for whereby - Update worker process to use platform abstraction for get_room_sessions - Preserve exact API behavior for meeting activity detection - Maintain AWS S3 configuration handling in WherebyClient - Fix linting and formatting issues Addresses PR feedback point 7: implement video_platforms/whereby structure Note: whereby.py kept for legacy fallback until task 7 cleanup
43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
"""Factory for creating video platform clients based on configuration."""
|
|
|
|
from typing import Optional
|
|
|
|
from reflector.db.rooms import VideoPlatform
|
|
from reflector.settings import settings
|
|
|
|
from .base import VideoPlatformClient, VideoPlatformConfig
|
|
from .registry import get_platform_client
|
|
|
|
|
|
def get_platform_config(platform: str) -> VideoPlatformConfig:
|
|
"""Get configuration for a specific platform."""
|
|
if platform == VideoPlatform.WHEREBY:
|
|
return VideoPlatformConfig(
|
|
api_key=settings.WHEREBY_API_KEY or "",
|
|
webhook_secret=settings.WHEREBY_WEBHOOK_SECRET or "",
|
|
api_url=settings.WHEREBY_API_URL,
|
|
s3_bucket=settings.RECORDING_STORAGE_AWS_BUCKET_NAME,
|
|
aws_access_key_id=settings.AWS_WHEREBY_ACCESS_KEY_ID,
|
|
aws_access_key_secret=settings.AWS_WHEREBY_ACCESS_KEY_SECRET,
|
|
)
|
|
elif platform == VideoPlatform.JITSI:
|
|
return VideoPlatformConfig(
|
|
api_key="", # Jitsi uses JWT, no API key
|
|
webhook_secret=settings.JITSI_WEBHOOK_SECRET or "",
|
|
api_url=f"https://{settings.JITSI_DOMAIN}",
|
|
)
|
|
else:
|
|
raise ValueError(f"Unknown platform: {platform}")
|
|
|
|
|
|
def create_platform_client(platform: str) -> VideoPlatformClient:
|
|
"""Create a video platform client instance."""
|
|
config = get_platform_config(platform)
|
|
return get_platform_client(platform, config)
|
|
|
|
|
|
def get_platform_for_room(room_id: Optional[str] = None) -> str:
|
|
"""Determine which platform to use for a room based on feature flags."""
|
|
# For now, default to whereby since we don't have feature flags yet
|
|
return VideoPlatform.WHEREBY
|