From 4f549920a06029a2fd0c2c6dccfa29d78339a141 Mon Sep 17 00:00:00 2001 From: WorldTeacher Date: Thu, 3 Jul 2025 18:59:16 +0200 Subject: [PATCH] feat: add scan all argument and implementation, --- cli.py | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/cli.py b/cli.py index eb84739..3994211 100644 --- a/cli.py +++ b/cli.py @@ -1,4 +1,4 @@ -from src.logic.cli import avail_check, search_all +from src.logic.search import avail_check, search_all, search_requested import os import argparse from src.logic.utils import move, tag_folder, rename, detect_chapters @@ -15,9 +15,10 @@ def grabber(args): os.system(f"rm -rf {cfg.komgrabber.download_location}") os.mkdir(cfg.komgrabber.download_location) if nyaa is True and komga is True: - search_all() - if args.scan: - scan_komga() + if args.request: + search_requested() + search_all(args.library, args.all) + if cfg.komgrabber.aria2.kill_after_completion: # kill aria2c os.system("killall aria2c") @@ -52,14 +53,30 @@ def main(): subparsers = parser.add_subparsers(dest="command", required=True) # tag subcommand - tag_parser = subparsers.add_parser("search", help="Run search operation") + tag_parser = subparsers.add_parser("search", help="Run search operation. After the search is completed, the library will be scanned to detect new or updated series.") + tag_parser.add_argument( + "library", + type=str, + help="Library to search in (e.g. 'manga', 'anime', leave empty for all)", + ) + tag_parser.add_argument( "-v", "--verbose", action="store_true", help="Enable verbose output" ) + tag_parser.add_argument( - "--scan", + "-a", + "--all", action="store_true", - help="Scan the library after downloading", + default=False, + help="Search for all series in the database", + ) + tag_parser.add_argument( + "-r", + "--request", + action="store_true", + default=False, + help="Search for the requested series in the database", ) tag_parser.set_defaults(func=grabber)