run_tribler

Attributes

logger

__restart

Classes

Arguments

The possible command-line arguments to the core process.

Functions

show_error(…)

Create a native pop-up without any third party dependency.

parse_args(→ Arguments)

Parse the command-line arguments.

get_root_state_directory(→ pathlib.Path)

Get the default application state directory.

start_download(→ None)

Start a download by calling the REST API.

init_config(→ tribler.tribler_config.TriblerConfigManager)

Add environment variables to the configuration.

load_torrent_uri(→ str | None)

Loads the torrent URI.

mac_event_loop(→ None)

Consume Mac events on the asyncio main thread.

open_webbrowser_tab(→ None)

Open a webbrowser tab with the given URL.

recolor_tray_icon(→ PIL.Image)

Use the given RGB code to recolor the image.

spawn_tray_icon(→ pystray.Icon)

Create the tray icon.

main(→ bool)

The main script entry point.

Module Contents

run_tribler.show_error(exc: Exception, shutdown: Literal[True] = True) NoReturn
run_tribler.show_error(exc: Exception, shutdown: Literal[False] = True) None

Create a native pop-up without any third party dependency.

Parameters:
  • exc – the error to show to the user

  • shutdown – whether to shut down after showing the error

run_tribler.logger
class run_tribler.Arguments

Bases: TypedDict

The possible command-line arguments to the core process.

torrent: str
log_level: str
server: bool
run_tribler.parse_args() Arguments

Parse the command-line arguments.

run_tribler.get_root_state_directory(requested_path: os.PathLike | None) pathlib.Path

Get the default application state directory.

async run_tribler.start_download(config: tribler.tribler_config.TriblerConfigManager, server_url: str, torrent_uri: str) None

Start a download by calling the REST API.

run_tribler.init_config(parsed_args: Arguments) tribler.tribler_config.TriblerConfigManager

Add environment variables to the configuration.

run_tribler.load_torrent_uri(parsed_args: Arguments) str | None

Loads the torrent URI.

async run_tribler.mac_event_loop() None

Consume Mac events on the asyncio main thread.

WARNING: sendEvent_ can block on some events. In particular, while the tray menu is open.

run_tribler.open_webbrowser_tab(url: str) None

Open a webbrowser tab with the given URL.

run_tribler.recolor_tray_icon(pil_icon: PIL.Image, rgb_code: str) PIL.Image

Use the given RGB code to recolor the image.

run_tribler.spawn_tray_icon(session: tribler.core.session.Session, config: tribler.tribler_config.TriblerConfigManager) pystray.Icon

Create the tray icon.

async run_tribler.main() bool

The main script entry point.

Returns:

Whether we wish to restart the process.

run_tribler.__restart = True