Skip to content

Commit 9e19f72

Browse files
Re-add warning for too large image file
1 parent fa02d9f commit 9e19f72

3 files changed

Lines changed: 33 additions & 25 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.14.14
3+
rev: v0.15.0
44
hooks:
55
- id: ruff-format
66
- id: ruff-check

mediux_posters/cli/common.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def determine_action( # noqa: PLR0911
195195
return Action.SKIP
196196

197197

198-
def process_image(
198+
def process_image( # noqa: PLR0911
199199
obj: Show | Season | Episode | Collection | Movie,
200200
cache_key: CacheKey,
201201
id_value: int,
@@ -261,6 +261,15 @@ def process_image(
261261
set_id=set_data.id,
262262
last_updated=file.last_updated,
263263
)
264+
265+
if image_file.stat().st_size >= MAX_IMAGE_SIZE:
266+
LOGGER.warning(
267+
"[%s] Image file '%s' is larger than %d MB, skipping upload",
268+
type(service).__name__,
269+
image_file,
270+
MAX_IMAGE_SIZE / 1000 / 1000,
271+
)
272+
return should_log
264273
if not service.upload_image(
265274
object_id=obj.id, image_file=image_file, kometa_integration=kometa_integration
266275
):

uv.lock

Lines changed: 22 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)