|
1 | 1 | import base64 |
2 | 2 | import datetime |
3 | 3 | import io |
4 | | -import pathlib |
5 | 4 | from abc import ABC, abstractmethod |
6 | 5 | from collections.abc import Iterable |
7 | 6 | from dataclasses import asdict, dataclass, fields |
|
19 | 18 | RECOMMENDED_MAX_TITLE_LENGTH, |
20 | 19 | ) |
21 | 20 | from zimscraperlib.i18n import is_valid_iso_639_3 |
22 | | -from zimscraperlib.image.illustration import get_zim_illustration |
23 | 21 | from zimscraperlib.image.probing import is_valid_image |
24 | 22 | from zimscraperlib.inputs import unique_values |
25 | 23 | from zimscraperlib.typing import SupportsRead, SupportsSeekableRead |
@@ -356,20 +354,12 @@ class IllustrationBasedMetadata(Metadata): |
356 | 354 | meta_mimetype = "image/png" |
357 | 355 |
|
358 | 356 | def __init__( |
359 | | - self, |
360 | | - value: bytes | io.IOBase | io.BytesIO | str | pathlib.Path, |
361 | | - name: str | None = None, |
| 357 | + self, value: bytes | io.IOBase | io.BytesIO, name: str | None = None |
362 | 358 | ) -> None: |
363 | 359 | super().__init__(value=value, name=name) |
364 | 360 |
|
365 | 361 | # native type is PNG image buffer |
366 | | - def get_cleaned_value( |
367 | | - self, value: bytes | io.IOBase | io.BytesIO | str | pathlib.Path |
368 | | - ) -> bytes: |
369 | | - if isinstance(value, str | pathlib.Path): |
370 | | - value = get_zim_illustration( |
371 | | - value, self.illustration_size, self.illustration_size |
372 | | - ) |
| 362 | + def get_cleaned_value(self, value: bytes | io.IOBase | io.BytesIO) -> bytes: |
373 | 363 | value = self.get_binary_from(value) |
374 | 364 | if not is_valid_image( |
375 | 365 | image=value, |
@@ -425,10 +415,7 @@ class IllustrationMetadata(IllustrationBasedMetadata): |
425 | 415 | illustration_scale: int = 1 |
426 | 416 |
|
427 | 417 | def __init__( |
428 | | - self, |
429 | | - value: bytes | io.IOBase | io.BytesIO | str | pathlib.Path, |
430 | | - size: int, |
431 | | - scale: int = 1, |
| 418 | + self, value: bytes | io.IOBase | io.BytesIO, size: int, scale: int = 1 |
432 | 419 | ) -> None: |
433 | 420 | self.illustration_scale = scale |
434 | 421 | self.illustration_size = size |
|
0 commit comments