All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good
- Updated version number in pyproject.toml and messages.po files. - Added new translations and updated existing ones in messages.po for better localization. - Implemented core functionality in Core.py, including image processing, tagging, and upload logic. - Enhanced the autotagging feature to support multiple image formats (PNG, JPEG, WebP, AVIF, GIF). - Improved error handling and logging for file operations and network requests. - Added functionality to check for uploaded files and manage tag updates for existing posts. - Introduced threading for background processing to improve application responsiveness.
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
"""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()
|