Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
try except for image sorting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Dec 5, 2023
1 parent b10e028 commit 4b3a902
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.0.42"
__version__ = "5.0.43"
17 changes: 8 additions & 9 deletions cyberdrop_dl/utils/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from typing import TYPE_CHECKING

import PIL
from PIL import Image
from videoprops import get_audio_properties, get_video_properties

Expand Down Expand Up @@ -105,15 +106,13 @@ async def sort_image(self, file: Path, base_name: str) -> None:
"""Sorts an image file into the sorted image folder"""
self.image_count += 1

if ".gif" in file.suffix.lower():
await self.sort_other(file, base_name)
self.other_count -= 1
return

image = Image.open(file)
width, height = image.size
resolution = f"{width}x{height}"
image.close()
try:
image = Image.open(file)
width, height = image.size
resolution = f"{width}x{height}"
image.close()
except PIL.UnidentifiedImageError:
resolution = "Unknown"

parent_name = file.parent.name
filename, ext = file.stem, file.suffix
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cyberdrop-dl"
version = "5.0.42"
version = "5.0.43"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 4b3a902

Please sign in to comment.