Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve #342 #343

Merged
merged 4 commits into from
Sep 22, 2024
Merged

improve #342 #343

merged 4 commits into from
Sep 22, 2024

Conversation

RicterZ
Copy link
Owner

@RicterZ RicterZ commented Sep 22, 2024

  1. change option from --regenerate-cbz to --regenerate, to indicate program regenerate pdf or cbz file
  2. by default, if a pdf or a cbz file exists, skip following download and generation process
  3. furthermore, if a pdf file exists, but someone still want to generate a cbz file, he can use --cbz --regenerate (under now program logic)


base_path = os.path.join(self.downloader.path, self.filename)
if (os.path.exists(base_path + '.pdf') or os.path.exists(base_path + '.cbz')) and skip_exists:
logger.info(f'Skip download doujinshi because a PDF/CBZ file exists of doujinshi {self.name}')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, this code will never be reached, will be removed in the future

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to reach this code with the following commands:

nhentai --id 530833 --download --format '%t [%i]' --threads=4 --pdf --meta --output="test-out"
nhentai --id 530833 --download --format '%t [%i]' --threads=4 --cbz --meta --output="test-out"

@RicterZ
Copy link
Owner Author

RicterZ commented Sep 22, 2024

@normalizedwater546 Does the current program logic meet your needs?

@normalizedwater546
Copy link
Contributor

normalizedwater546 commented Sep 22, 2024

furthermore, if a pdf file exists, but someone still want to generate a cbz file, he can use --cbz --regenerate (under now program logic)

I think that this is unintuitive. --regenerate should be used when you want to regenerate the same file extension.

This is how I think expected actions to be.

command expected action
nhentai --pdf ok (first time)
nhentai --cbz ok (first time)
nhentai --pdf duplicate
nhentai --cbz duplicate
nhentai --pdf --cbz duplicate
nhentai --pdf --regenerate ok
nhentai --cbz --regenerate ok
nhentai --pdf --cbz --regenerate ok

@normalizedwater546
Copy link
Contributor

Does the current program logic meet your needs?

I actually don't need to create both pdf and cbz, my main goal was to fix the metadata crash when attempting to download duplicated doujins in cbz format. I just encountered other issues while debugging. So yes, the current logic is fine for me.

@RicterZ RicterZ merged commit a8a48c6 into master Sep 22, 2024
@normalizedwater546
Copy link
Contributor

normalizedwater546 commented Sep 22, 2024

Thanks for the improvements!

Is the change to auto-generate HTML file intentional? Should I be adding --no-html to all my commands if I don't want them?

@RicterZ
Copy link
Owner Author

RicterZ commented Sep 22, 2024

Yes, the html file is auto-generate, you can add --no-html to avoid it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants