feat: add scan all argument and implementation,

This commit is contained in:
2025-07-03 18:59:16 +02:00
parent 21a653d9f0
commit 4f549920a0

31
cli.py
View File

@@ -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)