Files
media-downloader/wrappers/imginn_subprocess_wrapper.py
Todd 0d7b2b1aab Initial commit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:42:55 -04:00

38 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""
Subprocess wrapper for ImgInn operations to avoid asyncio event loop conflicts.
This runs ImgInn operations in a completely isolated subprocess.
Refactored to use the common wrapper factory from base_subprocess_wrapper.
"""
import sys
from pathlib import Path
# Add parent directory to path
sys.path.insert(0, str(Path(__file__).parent.parent))
from wrappers.base_subprocess_wrapper import create_download_wrapper, run_wrapper_main
def create_imginn_downloader(config, unified_db):
"""Factory function to create an ImgInn downloader instance."""
from modules.imginn_module import ImgInnDownloader
return ImgInnDownloader(
cookie_file=config.get('cookie_file', '/opt/media-downloader/cookies/imginn_cookies.json'),
headless=config.get('headless', False), # Headed mode with Xvfb
show_progress=True,
use_database=True,
log_callback=None, # Module uses universal logger
unified_db=unified_db
)
# Create the download function using the factory
run_imginn_download = create_download_wrapper("ImgInn", "imginn", create_imginn_downloader)
if __name__ == '__main__':
run_wrapper_main(run_imginn_download)