Skip to content

show ¤

Command to show downloads.

Functions:

  • show

    Show subcommand.

show ¤

show(api: API) -> int

Show subcommand.

Parameters:

  • api (API) –

    The API instance to use.

Returns:

  • int ( int ) –

    Always 0.

Source code in src/aria2p/cli/commands/show.py
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
def show(api: API) -> int:
    """Show subcommand.

    Parameters:
        api: The API instance to use.

    Returns:
        int: Always 0.
    """
    downloads = api.get_downloads()

    def print_line(*args: Any) -> None:
        print("{:<17} {:<9} {:>8} {:>12} {:>12} {:>8}  {}".format(*args))

    print_line("GID", "STATUS", "PROGRESS", "DOWN_SPEED", "UP_SPEED", "ETA", "NAME")

    for download in downloads:
        print_line(
            download.gid,
            download.status,
            download.progress_string(),
            download.download_speed_string(),
            download.upload_speed_string(),
            download.eta_string(),
            download.name,
        )

    return 0