diff --git a/requirements.txt b/requirements.txt index c2ca51325..9eb290390 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,9 +8,9 @@ pillow-heif==0.16.0 pillow-jxl-plugin==1.3.0 Pillow==10.3.0 pydub==0.25.1 -PySide6_Addons==6.7.1 -PySide6_Essentials==6.7.1 -PySide6==6.7.1 +PySide6_Addons==6.8.0.1 +PySide6_Essentials==6.8.0.1 +PySide6==6.8.0.1 rawpy==0.22.0 SQLAlchemy==2.0.34 structlog==24.4.0 diff --git a/tagstudio/src/qt/helpers/vendored/ffmpeg.py b/tagstudio/src/qt/helpers/vendored/ffmpeg.py index 097e78a22..05e1d2586 100644 --- a/tagstudio/src/qt/helpers/vendored/ffmpeg.py +++ b/tagstudio/src/qt/helpers/vendored/ffmpeg.py @@ -3,13 +3,34 @@ # Vendored from ffmpeg-python and ffmpeg-python PR#790 by amamic1803 import json +import platform +import shutil import subprocess import ffmpeg +import structlog from src.qt.helpers.silent_popen import promptless_Popen +logger = structlog.get_logger(__name__) -def _probe(filename, cmd="ffprobe", timeout=None, **kwargs): +FFMPEG_MACOS_LOCATIONS: list[str] = ["", "/opt/homebrew/bin/", "/usr/local/bin/"] + + +def _get_ffprobe_location() -> str: + cmd: str = "ffprobe" + if platform.system() == "Darwin": + for loc in FFMPEG_MACOS_LOCATIONS: + if shutil.which(loc + cmd): + cmd = loc + cmd + break + logger.info(f"[FFPROBE] Using FFmpeg location: {cmd}") + return cmd + + +FFPROBE_CMD = _get_ffprobe_location() + + +def _probe(filename, cmd=FFPROBE_CMD, timeout=None, **kwargs): """Run ffprobe on the specified file and return a JSON representation of the output. Raises: diff --git a/tagstudio/src/qt/widgets/thumb_renderer.py b/tagstudio/src/qt/widgets/thumb_renderer.py index f78724ae9..ac0abb962 100644 --- a/tagstudio/src/qt/widgets/thumb_renderer.py +++ b/tagstudio/src/qt/widgets/thumb_renderer.py @@ -812,8 +812,8 @@ def _image_vector_thumb(cls, filepath: Path, size: int) -> Image.Image: """ im: Image.Image = None # Create an image to draw the svg to and a painter to do the drawing - image: QImage = QImage(size, size, QImage.Format.Format_ARGB32) - image.fill("#1e1e1e") + q_image: QImage = QImage(size, size, QImage.Format.Format_ARGB32) + q_image.fill("#1e1e1e") # Create an svg renderer, then render to the painter svg: QSvgRenderer = QSvgRenderer(str(filepath)) @@ -821,7 +821,7 @@ def _image_vector_thumb(cls, filepath: Path, size: int) -> Image.Image: if not svg.isValid(): raise UnidentifiedImageError - painter: QPainter = QPainter(image) + painter: QPainter = QPainter(q_image) svg.setAspectRatioMode(Qt.AspectRatioMode.KeepAspectRatio) svg.render(painter) painter.end() @@ -829,7 +829,7 @@ def _image_vector_thumb(cls, filepath: Path, size: int) -> Image.Image: # Write the image to a buffer as png buffer: QBuffer = QBuffer() buffer.open(QBuffer.OpenModeFlag.ReadWrite) - image.save(buffer, "PNG") + q_image.save(buffer, "PNG") # type: ignore[call-overload] # Load the image from the buffer im = Image.new("RGB", (size, size), color="#1e1e1e") @@ -907,11 +907,11 @@ def _pdf_thumb(cls, filepath: Path, size: int) -> Image.Image: | QPdfDocumentRenderOptions.RenderFlag.PathAliased ) # Convert QImage to PIL Image - qimage: QImage = document.render(0, page_size.toSize(), render_options) + q_image: QImage = document.render(0, page_size.toSize(), render_options) buffer: QBuffer = QBuffer() buffer.open(QBuffer.OpenModeFlag.ReadWrite) try: - qimage.save(buffer, "PNG") + q_image.save(buffer, "PNG") # type: ignore[call-overload] im = Image.open(BytesIO(buffer.buffer().data())) finally: buffer.close()