Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
legnaleurc committed Dec 17, 2023
1 parent 8f07839 commit 1a47596
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions drive/app/faststart/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

async def main(args: list[str] | None = None):
kwargs = parse_args(args)
config_path = Path(kwargs.config_path).expanduser().resolve()
drive_path = Path(kwargs.drive_path).expanduser().resolve()
data_path = Path(kwargs.data_path).expanduser().resolve()
root_path_list = [PurePath(_) for _ in kwargs.root_path]
remux_only: bool = kwargs.remux_only
Expand All @@ -47,7 +47,7 @@ async def main(args: list[str] | None = None):
pool = stack.enter_context(create_executor())
work_folder = Path(stack.enter_context(TemporaryDirectory(dir=tmp_path)))
queue = stack.enter_context(AioQueue[None].fifo())
drive = await stack.enter_async_context(create_drive_from_config(config_path))
drive = await stack.enter_async_context(create_drive_from_config(drive_path))

async for change in drive.sync():
getLogger(__name__).debug(change)
Expand Down Expand Up @@ -77,7 +77,7 @@ def parse_args(args: list[str] | None) -> Namespace:

parser = ArgumentParser("app")

parser.add_argument("--config-path", "-c", required=True, type=str)
parser.add_argument("--drive-path", required=True, type=str)
parser.add_argument("--data-path", required=True, type=str)
parser.add_argument("--tmp-path", type=str)
parser.add_argument("--jobs", "-j", default=1)
Expand Down
6 changes: 3 additions & 3 deletions drive/app/hah/_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@

@dataclass(frozen=True, kw_only=True)
class KeywordArgument:
config_path: Path
drive_path: Path
path_list: list[PurePath]


def parse_args(args: list[str]) -> KeywordArgument:
parser = ArgumentParser("hah")

parser.add_argument("--config", "-c", required=True, type=str)
parser.add_argument("--drive-path", required=True, type=str)
parser.add_argument("path", nargs="+", type=str)

kwargs = parser.parse_args(args)

return KeywordArgument(
config_path=Path(kwargs.config).expanduser().resolve(),
drive_path=Path(kwargs.drive_path).expanduser().resolve(),
path_list=[Path(_) for _ in kwargs.path],
)
2 changes: 1 addition & 1 deletion drive/app/hah/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def main(args: list[str]) -> int:

dictConfig(ConfigBuilder().add("wcpan", level="D").to_dict())

async with create_drive_from_config(kwargs.config_path) as drive:
async with create_drive_from_config(kwargs.drive_path) as drive:
async for _ in drive.sync():
pass

Expand Down
6 changes: 3 additions & 3 deletions drive/app/jav/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
async def main(args: list[str] | None = None) -> int:
parser = ArgumentParser("jav")

parser.add_argument("--config", "-c", required=True, type=str)
parser.add_argument("--drive-path", required=True, type=str)

command = parser.add_subparsers()

Expand All @@ -33,12 +33,12 @@ async def main(args: list[str] | None = None) -> int:

kwargs = parser.parse_args(args)

config_path = Path(kwargs.config).expanduser().resolve()
drive_path = Path(kwargs.drive_path).expanduser().resolve()
action: Callable[[Drive, Namespace], Awaitable[int]] | None = kwargs.action
if not action:
return 1

async with create_drive_from_config(config_path) as drive:
async with create_drive_from_config(drive_path) as drive:
return await action(drive, kwargs)


Expand Down
2 changes: 1 addition & 1 deletion drive/faststart.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /bin/sh

poetry run -- python3 -m app.faststart -c "~/.config/wcpan.drive/cli.yaml" --data-path="~/.local/share/wcpan.drive/_faststart" "$@"
poetry run -- python3 -m app.faststart --drive-path="~/.config/wcpan.drive/cli.yaml" --data-path="~/.local/share/wcpan.drive/_faststart" "$@"
2 changes: 1 addition & 1 deletion drive/hah.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /bin/sh

poetry run -- python3 -m app.hah -c "~/.config/wcpan.drive/cli.yaml" "$@"
poetry run -- python3 -m app.hah --drive-path="~/.config/wcpan.drive/cli.yaml" "$@"
2 changes: 1 addition & 1 deletion drive/jav.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /bin/sh

OPENSSL_CONF=./assets/openssl.cnf poetry run -- python3 -m app.jav -c "~/.config/wcpan.drive/cli.yaml" "$@"
OPENSSL_CONF=./assets/openssl.cnf poetry run -- python3 -m app.jav --drive-path="~/.config/wcpan.drive/cli.yaml" "$@"

0 comments on commit 1a47596

Please sign in to comment.