Show streamlink/ffmpeg stderr for debugging, handle startup errors
- stderr from both processes now displayed in console - streamlink checked for early exit before starting ffmpeg - RuntimeError shown to user if stream unavailable Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
30
main.py
30
main.py
@@ -28,20 +28,26 @@ async def run(config) -> None:
|
||||
|
||||
frame_number = 0
|
||||
|
||||
async for frame_data in capture_frames(
|
||||
config.channel, config.quality, config.interval
|
||||
):
|
||||
frame_number += 1
|
||||
console.print(f"[dim]Captured frame #{frame_number}, analyzing...[/dim]")
|
||||
try:
|
||||
async for frame_data in capture_frames(
|
||||
config.channel, config.quality, config.interval
|
||||
):
|
||||
frame_number += 1
|
||||
console.print(f"[dim]Captured frame #{frame_number}, analyzing...[/dim]")
|
||||
|
||||
try:
|
||||
description = await analyzer.analyze_frame(frame_data)
|
||||
except Exception as e:
|
||||
console.print(f"[bold red]Analysis error:[/bold red] {e}")
|
||||
continue
|
||||
try:
|
||||
description = await analyzer.analyze_frame(frame_data)
|
||||
except Exception as e:
|
||||
console.print(f"[bold red]Analysis error:[/bold red] {e}")
|
||||
continue
|
||||
|
||||
print_description(description, frame_number)
|
||||
await log_description(config.log_file, description, frame_number)
|
||||
print_description(description, frame_number)
|
||||
await log_description(config.log_file, description, frame_number)
|
||||
except RuntimeError as e:
|
||||
console.print(f"[bold red]Error:[/bold red] {e}")
|
||||
finally:
|
||||
if frame_number == 0:
|
||||
console.print("[bold yellow]No frames were captured.[/bold yellow]")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
||||
Reference in New Issue
Block a user