mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-07-02 00:19:29 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
744a9e4418 | |||
c3e9fff491 | |||
a84e2c5714 | |||
c814c35c50 | |||
e2f71437e2 | |||
2fa45ae4df | |||
17bc33c6cb | |||
09bb8460f6 | |||
eb5b93d654 | |||
cb6cf6df1a |
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ dist/
|
||||
output/
|
||||
venv/
|
||||
.vscode/
|
||||
test-output
|
@ -1,3 +1,3 @@
|
||||
__version__ = '0.5.9'
|
||||
__version__ = '0.5.10'
|
||||
__author__ = 'RicterZ'
|
||||
__email__ = 'ricterzheng@gmail.com'
|
||||
|
@ -94,6 +94,7 @@ def main():
|
||||
doujinshi.download()
|
||||
else:
|
||||
logger.info(f'Skip download doujinshi because a PDF/CBZ file exists of doujinshi {doujinshi.name}')
|
||||
continue
|
||||
|
||||
if options.generate_metadata:
|
||||
generate_metadata_file(options.output_dir, doujinshi)
|
||||
@ -106,10 +107,10 @@ def main():
|
||||
generate_html(options.output_dir, doujinshi, template=constant.CONFIG['template'])
|
||||
|
||||
if options.is_cbz:
|
||||
generate_doc('cbz', options.output_dir, doujinshi, options.rm_origin_dir)
|
||||
generate_doc('cbz', options.output_dir, doujinshi, options.regenerate)
|
||||
|
||||
if options.is_pdf:
|
||||
generate_doc('pdf', options.output_dir, doujinshi, options.rm_origin_dir)
|
||||
generate_doc('pdf', options.output_dir, doujinshi, options.regenerate)
|
||||
|
||||
if options.move_to_folder:
|
||||
if options.is_cbz:
|
||||
|
@ -38,9 +38,9 @@ FAV_URL = f'{BASE_URL}/favorites/'
|
||||
|
||||
IMAGE_URL = f'{urlparse(BASE_URL).scheme}://i.{urlparse(BASE_URL).hostname}/galleries'
|
||||
IMAGE_URL_MIRRORS = [
|
||||
f'{urlparse(BASE_URL).scheme}://i3.{urlparse(BASE_URL).hostname}'
|
||||
f'{urlparse(BASE_URL).scheme}://i5.{urlparse(BASE_URL).hostname}'
|
||||
f'{urlparse(BASE_URL).scheme}://i7.{urlparse(BASE_URL).hostname}'
|
||||
f'{urlparse(BASE_URL).scheme}://i3.{urlparse(BASE_URL).hostname}',
|
||||
f'{urlparse(BASE_URL).scheme}://i5.{urlparse(BASE_URL).hostname}',
|
||||
f'{urlparse(BASE_URL).scheme}://i7.{urlparse(BASE_URL).hostname}',
|
||||
]
|
||||
|
||||
NHENTAI_HOME = get_nhentai_home()
|
||||
|
@ -75,26 +75,28 @@ class Doujinshi(object):
|
||||
def check_if_need_download(self, options):
|
||||
base_path = os.path.join(self.downloader.path, self.filename)
|
||||
|
||||
# doujinshi directory is not exist, we need to download definitely
|
||||
if not (os.path.exists(base_path) and os.path.isdir(base_path)):
|
||||
return True
|
||||
|
||||
# regenerate, we need to re-download from nhentai
|
||||
# regenerate, re-download
|
||||
if options.regenerate:
|
||||
return True
|
||||
|
||||
# pdf or cbz file exists, skip re-download
|
||||
# doujinshi directory may not exist b/c of --rm-origin-dir option set.
|
||||
# user should pass --regenerate option to get back origin dir.
|
||||
ret_pdf = ret_cbz = None
|
||||
if options.is_pdf:
|
||||
file_ext = 'pdf'
|
||||
elif options.is_cbz:
|
||||
file_ext = 'cbz'
|
||||
else:
|
||||
# re-download
|
||||
return True
|
||||
ret_pdf = os.path.exists(f'{base_path}.pdf') or os.path.exists(f'{base_path}/{self.filename}.pdf')
|
||||
|
||||
# pdf or cbz file exists, we needn't to re-download it
|
||||
if os.path.exists(f'{base_path}.{file_ext}') or os.path.exists(f'{base_path}/{self.filename}.{file_ext}'):
|
||||
if options.is_cbz:
|
||||
ret_cbz = os.path.exists(f'{base_path}.cbz') or os.path.exists(f'{base_path}/{self.filename}.cbz')
|
||||
|
||||
ret = list(filter(lambda s: s is not None, [ret_cbz, ret_pdf]))
|
||||
if ret and all(ret):
|
||||
return False
|
||||
|
||||
# doujinshi directory doesn't exist, re-download
|
||||
if not (os.path.exists(base_path) and os.path.isdir(base_path)):
|
||||
return True
|
||||
|
||||
# fallback
|
||||
return True
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "nhentai"
|
||||
version = "0.5.9"
|
||||
version = "0.5.10"
|
||||
description = "nhentai doujinshi downloader"
|
||||
authors = ["Ricter Z <ricterzheng@gmail.com>"]
|
||||
license = "MIT"
|
||||
|
Reference in New Issue
Block a user