From 53aa04af1e57b38a75e6e635286b7b48d279d119 Mon Sep 17 00:00:00 2001 From: myc1ou1d <92770704+myc1ou1d@users.noreply.github.com> Date: Sat, 24 Feb 2024 23:27:52 +0800 Subject: [PATCH 1/2] fix file not found error when cbz file exists. --- nhentai/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nhentai/utils.py b/nhentai/utils.py index 0151b40..af22c81 100644 --- a/nhentai/utils.py +++ b/nhentai/utils.py @@ -166,6 +166,9 @@ def generate_main_html(output_dir='./'): def generate_cbz(output_dir='.', doujinshi_obj=None, rm_origin_dir=False, write_comic_info=True): if doujinshi_obj is not None: doujinshi_dir = os.path.join(output_dir, doujinshi_obj.filename) + if os.path.exists(doujinshi_dir+".cbz"): + logger.warning(f'Comic Book CBZ file exists, skip "{doujinshi_dir}"') + return if write_comic_info: serialize_comic_xml(doujinshi_obj, doujinshi_dir) cbz_filename = os.path.join(os.path.join(doujinshi_dir, '..'), f'{doujinshi_obj.filename}.cbz') From 457f12d40d6f0e73d70efa27957c441858a02322 Mon Sep 17 00:00:00 2001 From: Spyridion Date: Thu, 28 Mar 2024 02:40:14 -0700 Subject: [PATCH 2/2] Changed parser option checks to allow artist search --- nhentai/cmdline.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nhentai/cmdline.py b/nhentai/cmdline.py index ad61f3e..6a171b1 100644 --- a/nhentai/cmdline.py +++ b/nhentai/cmdline.py @@ -73,6 +73,8 @@ def cmd_parser(): help='search doujinshi by keyword') parser.add_option('--favorites', '-F', action='store_true', dest='favorites', help='list or download your favorites') + parser.add_option('--artist', '-a', action='store', dest='artist', + help='list doujinshi by artist name') # page options parser.add_option('--page-all', dest='page_all', action='store_true', default=False, @@ -112,6 +114,8 @@ def cmd_parser(): help='generate PDF file') parser.add_option('--rm-origin-dir', dest='rm_origin_dir', action='store_true', default=False, help='remove downloaded doujinshi dir when generated CBZ or PDF file') + parser.add_option('--move-to-folder', dest='move_to_folder', action='store_true', default=False, + help='remove files in doujinshi dir then move new file to folder when generated CBZ or PDF file') parser.add_option('--meta', dest='generate_metadata', action='store_true', help='generate a metadata file in doujinshi format') parser.add_option('--regenerate-cbz', dest='regenerate_cbz', action='store_true', default=False, @@ -209,12 +213,12 @@ def cmd_parser(): _ = [i.strip() for i in f.readlines()] args.id = set(int(i) for i in _ if i.isdigit()) - if (args.is_download or args.is_show) and not args.id and not args.keyword and not args.favorites: + if (args.is_download or args.is_show) and not args.id and not args.keyword and not args.favorites and not args.artist: logger.critical('Doujinshi id(s) are required for downloading') parser.print_help() sys.exit(1) - if not args.keyword and not args.id and not args.favorites: + if not args.keyword and not args.id and not args.favorites and not args.artist: parser.print_help() sys.exit(1)