diff --git a/doujinshi_dl/__init__.py b/doujinshi_dl/__init__.py index b202448..26891ec 100644 --- a/doujinshi_dl/__init__.py +++ b/doujinshi_dl/__init__.py @@ -1,3 +1,3 @@ -__version__ = '2.0.7' +__version__ = '2.0.8' __author__ = 'RicterZ' __email__ = 'ricterzheng@gmail.com' diff --git a/doujinshi_dl/command.py b/doujinshi_dl/command.py index 189f1ce..1d4855d 100644 --- a/doujinshi_dl/command.py +++ b/doujinshi_dl/command.py @@ -129,7 +129,8 @@ def main(): doujinshi = doujinshi_model.doujinshi doujinshi.downloader = downloader - if doujinshi.check_if_need_download(options): + need_download = doujinshi.check_if_need_download(options) + if need_download: doujinshi.download() else: logger.info( @@ -138,14 +139,20 @@ def main(): doujinshi_dir = os.path.join(options.output_dir, doujinshi.filename) - if options.generate_metadata: - serializer.write_all(meta, doujinshi_dir) - logger.log(16, f'Metadata files have been written to "{doujinshi_dir}"') - + # If skipped (CBZ/PDF already exists), treat as already downloaded: + # - skip all post-processing that requires doujinshi_dir to exist + # - but still write to history DB in case the record was lost if options.is_save_download_history: with DB() as db: db.add_one(doujinshi.id) + if not need_download: + continue + + if options.generate_metadata: + serializer.write_all(meta, doujinshi_dir) + logger.log(16, f'Metadata files have been written to "{doujinshi_dir}"') + if not options.is_nohtml: generate_html(options.output_dir, doujinshi, template=template) diff --git a/pyproject.toml b/pyproject.toml index e738aa0..2deacdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "doujinshi-dl" -version = "2.0.7" +version = "2.0.8" description = "doujinshi downloader" authors = ["Ricter Z "] license = "MIT"