-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (32 loc) · 1.39 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import click
from lib.download import CivitaiDownloader
from lib.util import config_logging
DEFAULT_PROXY = 'http://127.0.0.1:2080'
@click.group()
def cli():
pass
@cli.command()
@click.option('--dir', required=True)
@click.option('--proxy', default=DEFAULT_PROXY, show_default=True)
@click.option('--id', type=int, required=True)
@click.option('--latest', type=bool, default=True, required=False)
@click.option('--data-only', type=bool, default=False, required=False)
def download(dir: str, proxy: str, id: int, latest: bool, data_only: bool):
dl = CivitaiDownloader(storage_dir=dir, proxy=proxy)
dl.download(id, latest, data_only)
@cli.command()
@click.option('--dir', required=True)
@click.option('--proxy', default=DEFAULT_PROXY, show_default=True)
@click.option('--type', default='LORA', show_default=True)
@click.option('--min-page', default=1, show_default=True)
@click.option('--max-page', default=10, show_default=True)
@click.option('--latest', type=bool, default=True, required=False)
@click.option('--data-only', type=bool, default=False, required=False)
def download_batch(dir: str, proxy: str, type: str,
min_page: int, max_page: int,
latest: bool, data_only: bool):
dl = CivitaiDownloader(storage_dir=dir, proxy=proxy)
dl.download_batch(type, min_page, max_page, latest, data_only)
if __name__ == '__main__':
config_logging()
cli()