support older versions of python not having the Union import

This commit is contained in:
ChuckBuilds
2025-08-15 09:38:23 -05:00
parent f13e9306c9
commit e3b65588a2
3 changed files with 6 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ import json
import os
from io import BytesIO
import requests
from typing import Union
from PIL import Image, ImageEnhance
import queue # Added import
@@ -305,7 +306,7 @@ class MusicManager:
except Exception as e:
logger.error(f"Error executing DisplayController update callback from YTM direct update: {e}")
def _fetch_and_resize_image(self, url: str, target_size: tuple[int, int]) -> Image.Image | None:
def _fetch_and_resize_image(self, url: str, target_size: tuple) -> Union[Image.Image, None]:
"""Fetches an image from a URL, resizes it, and returns a PIL Image object."""
if not url:
return None