#!/usr/bin/env python3 """ Quick backlog test - captures smaller amounts for immediate validation """ import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).parent)) from production_backlog_capture import ProductionBacklogCapture import logging # Set up logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s') logger = logging.getLogger(__name__) def main(): capture = ProductionBacklogCapture(Path("data_quick_test")) # Test each source with limited items test_sources = { "podcast": 5, # 5 episodes "mailchimp": 10, # 10 items (limited by RSS anyway) "wordpress": 10, # 10 posts "youtube": 5, # 5 videos "instagram": 5, # 5 posts "tiktok": 10 # 10 videos with captions } total_items = 0 total_media = 0 print("๐Ÿงช QUICK BACKLOG TEST") print("=" * 50) for source, max_items in test_sources.items(): print(f"\nTesting {source} (max {max_items} items)...") result = capture.capture_source_backlog(source, max_items) if result["success"]: items = result["items"] media = result.get("media_files", 0) duration = result["duration"] total_items += items total_media += media print(f"โœ… {source}: {items} items, {media} media files in {duration:.1f}s") else: print(f"โŒ {source}: {result.get('error', 'Unknown error')}") # Test NAS sync print(f"\nTesting NAS sync...") if total_items > 0: nas_success = capture.sync_to_nas() print(f"NAS sync: {'โœ…' if nas_success else 'โŒ'}") print(f"\n๐Ÿ“Š TEST SUMMARY:") print(f" Total items: {total_items}") print(f" Total media: {total_media}") print(f" Data dir: {capture.data_dir}") return total_items > 0 if __name__ == "__main__": try: success = main() print(f"\n๐ŸŽ‰ Quick test {'PASSED' if success else 'FAILED'}") sys.exit(0 if success else 1) except Exception as e: print(f"\nโŒ Test failed: {e}") sys.exit(2)