Skip to content

fix(ThumbRenderer): Use audio icon when no ffmpeg #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tagstudio/src/qt/helpers/vendored/pydub/audio_segment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# type: ignore
# Copyright (C) 2022 James Robert (jiaaro).
# Licensed under the MIT License.
# Vendored from ffmpeg-python and ffmpeg-python PR#790 by amamic1803
# Vendored from pydub

from __future__ import division

Expand Down Expand Up @@ -729,7 +729,10 @@ def is_format(f):
info = None
else:
# PATCHED
info = _mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
try:
info = _mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
except FileNotFoundError:
raise ChildProcessError
if info:
audio_streams = [x for x in info['streams']
if x['codec_type'] == 'audio']
Expand Down Expand Up @@ -1400,4 +1403,4 @@ def _repr_html_(self):
"""
fh = self.export()
data = base64.b64encode(fh.read()).decode('ascii')
return src.format(base64=data)
return src.format(base64=data)
8 changes: 7 additions & 1 deletion tagstudio/src/qt/widgets/thumb_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ def _audio_waveform_thumb(
logging.error(
f"[ThumbRenderer][WAVEFORM][ERROR]: Couldn't render waveform for {filepath.name} ({type(e).__name__})"
)

return im

def _blender(self, filepath: Path) -> Image.Image:
Expand Down Expand Up @@ -1057,7 +1058,12 @@ def render(
size=(adj_size, adj_size),
pixel_ratio=pixel_ratio,
)
except (UnidentifiedImageError, DecompressionBombError, ValueError) as e:
except (
UnidentifiedImageError,
DecompressionBombError,
ValueError,
ChildProcessError,
) as e:
logging.info(
f"[ThumbRenderer][ERROR]: Couldn't render thumbnail for {_filepath.name} ({type(e).__name__})"
)
Expand Down