Skip to content

Commit

Permalink
Merge pull request #79 from mansuf/bugs/#78
Browse files Browse the repository at this point in the history
Fix formats `pdf-volume` and `cb7-volume` are not working
  • Loading branch information
mansuf authored Jun 27, 2023
2 parents 206f5cf + e4b4e45 commit 8d1c4ec
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## UNRELEASED

### Fix bugs

- Fixed `pdf-volume` and `cb7-volume` formats are not working after upgrading to v2.10.0
[#78](https://github.com/mansuf/mangadex-downloader/issues/78)

## v2.10.1

### Fix bugs
Expand Down
6 changes: 3 additions & 3 deletions mangadex_downloader/format/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ def on_received_images(self, file_path, chapter, images):
"""This function is called when format has successfully received images"""
pass

def on_finish(self, file_path, volume, images):
""""This function is called after download is finished"""
def on_convert(self, file_path, volume, images):
""""This function is called when convert process is starting"""
pass

def download_volumes(self, volumes):
Expand Down Expand Up @@ -622,7 +622,7 @@ def download_volumes(self, volumes):
pbm.get_pages_pb().reset()

chapters_pb.reset()
self.on_finish(file_path, volume, images)
self.on_convert(file_path, volume, images)

# Remove original chapter folder
shutil.rmtree(volume_path, ignore_errors=True)
Expand Down
2 changes: 1 addition & 1 deletion mangadex_downloader/format/comic_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def on_prepare(self, file_path, volume, count):
def on_iter_chapter(self, file_path, chapter, count):
self.insert_ch_info_img(self.volume_zip, self.worker, chapter, count, self.volume_path)

def on_finish(self, file_path, volume, images):
def on_convert(self, file_path, volume, images):
volume_name = self.get_volume_name(volume)
pbm.logger.info(f"{volume_name} has finished download, converting to cbz...")

Expand Down
2 changes: 1 addition & 1 deletion mangadex_downloader/format/epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class EpubVolume(ConvertedVolumesFormat, EPUBFile):
def on_prepare(self, file_path, volume, count):
self.epub_chapters = []

def on_finish(self, file_path, volume, images):
def on_convert(self, file_path, volume, images):
volume_name = self.get_volume_name(volume)

pbm.logger.info(f"{volume_name} has finished download, converting to epub...")
Expand Down
5 changes: 4 additions & 1 deletion mangadex_downloader/format/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ def __init__(self, *args, **kwargs):
self.images = []

def on_prepare(self, file_path, volume, count):
# We should clear self.images, to prevent older volumes to be re-converted
self.images.clear()

volume_name = self.get_volume_name(volume)
self.volume_path = create_directory(volume_name, self.path)

Expand All @@ -448,7 +451,7 @@ def on_prepare(self, file_path, volume, count):
def on_iter_chapter(self, file_path, chapter, count):
self.insert_ch_info_img(self.images, chapter, self.volume_path, count)

def on_finish(self, file_path, volume, images):
def on_convert(self, file_path, volume, images):
volume_name = self.get_volume_name(volume)
pbm.logger.info(f"{volume_name} has finished download, converting to pdf...")
self.worker.submit(lambda: self.convert(self.images, file_path))
Expand Down
4 changes: 3 additions & 1 deletion mangadex_downloader/format/sevenzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def __init__(self, *args, **kwargs):
self.images = []

def on_prepare(self, file_path, volume, count):
self.images.clear()

volume_name = self.get_volume_name(volume)
self.volume_path = create_directory(volume_name, self.path)

Expand All @@ -123,7 +125,7 @@ def on_iter_chapter(self, file_path, chapter, count):
def on_received_images(self, file_path, chapter, images):
self.images.extend(images)

def on_finish(self, file_path, volume, images):
def on_convert(self, file_path, volume, images):
volume_name = self.get_volume_name(volume)

pbm.logger.info(f"{volume_name} has finished download, converting to cb7...")
Expand Down

0 comments on commit 8d1c4ec

Please sign in to comment.