mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-28 14:04:49 -04:00
Catch UnidentifiedImageError #168
This commit is contained in:
parent
372a755215
commit
3eeb9d3b7e
2 changed files with 12 additions and 5 deletions
|
@ -119,8 +119,9 @@ embed = true
|
|||
size = "large"
|
||||
# Both of these options limit the size of the embedded artwork. If their values
|
||||
# are larger than the actual dimensions of the image, they will be ignored.
|
||||
max_width = 999999
|
||||
max_height = 999999
|
||||
# If either value is -1, the image is left untouched.
|
||||
max_width = -1
|
||||
max_height = -1
|
||||
# Save the cover image at the highest quality as a seperate jpg file
|
||||
keep_hires_cover = true
|
||||
|
||||
|
@ -163,4 +164,4 @@ progress_bar = "dainty"
|
|||
|
||||
[misc]
|
||||
# Metadata to identify this config file. Do not change.
|
||||
version = "1.5"
|
||||
version = "1.6"
|
||||
|
|
|
@ -518,9 +518,15 @@ def downsize_image(filepath: str, width: int, height: int):
|
|||
:type height: int
|
||||
:raises: ValueError
|
||||
"""
|
||||
from PIL import Image
|
||||
if width == -1 or height == -1:
|
||||
return
|
||||
|
||||
from PIL import Image, UnidentifiedImageError
|
||||
|
||||
try:
|
||||
image = Image.open(filepath)
|
||||
except UnidentifiedImageError:
|
||||
secho("Cover art not found, skipping downsize.", fg="red")
|
||||
|
||||
width = min(width, image.width)
|
||||
height = min(height, image.height)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue