"""kapitanbooru_uploader.__main__: executed when kapitanbooru_uploader directory is called as script.""" from .Core import Core from .settings import Settings from .ImageBrowser import ImageBrowser import argparse def main(): parser = argparse.ArgumentParser( prog="kapitanbooru-uploader", description="KapitanBooru Uploader" ) group = parser.add_mutually_exclusive_group() # Add arguments to the group group.add_argument( "--autotag-files", nargs="+", metavar="PATH", help="Specify one or more files to process", ) group.add_argument( "--autotag-dir", metavar="PATH", help="Specify a directory to process" ) args = parser.parse_args() # Determine which function to call if args.autotag_files: core = Core(Settings(), gui_mode=False) core.autotag_files(args.autotag_files) core.wait_for_completion() # Wait for threads to finish elif args.autotag_dir: core = Core(Settings(), gui_mode=False) core.autotag_dir(args.autotag_dir) core.wait_for_completion() # Wait for threads to finish else: app = ImageBrowser() app.mainloop() if __name__ == "__main__": main()