Skip to content

Commit

Permalink
skip already downloader chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
darodi authored and hurlenko committed Jul 13, 2022
1 parent 3724446 commit ab792d8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mloader/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,22 @@ def __init__(self, compression=zipfile.ZIP_DEFLATED, *args, **kwargs):
self.path = Path(self.destination, self.title_name)
self.path.mkdir(parents=True, exist_ok=True)
self.path = self.path.joinpath(self.chapter_name).with_suffix(".cbz")
self.skip_all_image = self.path.exists()
if not self.skip_all_image:
self.skip_all_images = self.path.exists()
if not self.skip_all_images:
self.archive = zipfile.ZipFile(
self.path, mode="w", compression=compression
)

def add_image(self, image_data: bytes, index: Union[int, range]):
if self.skip_all_image:
if self.skip_all_images:
return
path = Path(self.chapter_name, self.format_page_name(index))
self.archive.writestr(path.as_posix(), image_data)

def skip_image(self, index: Union[int, range]) -> bool:
return self.skip_all_image
return self.skip_all_images

def close(self):
if self.skip_all_image:
if self.skip_all_images:
return
self.archive.close()

0 comments on commit ab792d8

Please sign in to comment.