tribler.core.libtorrent.torrents
Attributes
Classes
Torrent creation flag to define the torrent protocol version. |
|
A dictionary to describe a newly-created torrent. |
Functions
|
Return the libtorrent handle if it's available, else return the default value. |
|
Invoke the function once the handle is available. Returns a future that will fire once the function has completed. |
|
Get the path prefixes component-wise. |
|
|
|
Get dst into src in the most efficient way possible: |
|
Create a torrent file from the given paths and parameters. |
|
Call handle.torrent_file() and handle RuntimeErrors. |
Module Contents
- tribler.core.libtorrent.torrents.logger
- class tribler.core.libtorrent.torrents.TorrentVersion(*args, **kwds)
Bases:
enum.EnumTorrent creation flag to define the torrent protocol version.
- Warning:
Setting only v1 is ok.
Setting only v2 is ok.
Setting neither flag is ok (creates a hybrid torrent).
Setting both will cause a crash!
- v1
- v2
- hybrid = 0
- tribler.core.libtorrent.torrents.check_handle[**WrappedParams, WrappedReturn](default: WrappedReturn) collections.abc.Callable[[collections.abc.Callable[Concatenate[tribler.core.libtorrent.download_manager.download.Download, libtorrent.torrent_handle, WrappedParams], WrappedReturn]], collections.abc.Callable[Concatenate[tribler.core.libtorrent.download_manager.download.Download, WrappedParams], WrappedReturn]]
Return the libtorrent handle if it’s available, else return the default value.
Author(s): Egbert Bouman
- tribler.core.libtorrent.torrents.require_handle[**WrappedParams, WrappedReturn](func: collections.abc.Callable[Concatenate[tribler.core.libtorrent.download_manager.download.Download, libtorrent.torrent_handle, WrappedParams], WrappedReturn]) collections.abc.Callable[Concatenate[tribler.core.libtorrent.download_manager.download.Download, WrappedParams], asyncio.Future[WrappedReturn | None]]
Invoke the function once the handle is available. Returns a future that will fire once the function has completed.
Author(s): Egbert Bouman
- tribler.core.libtorrent.torrents.common_prefix(paths_list: list[pathlib.Path]) pathlib.Path
Get the path prefixes component-wise.
- tribler.core.libtorrent.torrents._existing_files(path_list: list[pathlib.Path], names: list[str] | None) collections.abc.Iterable[tuple[str, pathlib.Path]]
- class tribler.core.libtorrent.torrents.TorrentFileResult
Bases:
TypedDictA dictionary to describe a newly-created torrent.
- base_dir: pathlib.Path
- atp: libtorrent.add_torrent_params
- tribler.core.libtorrent.torrents.most_efficient_file_dupe(src: pathlib.Path, dst: pathlib.Path) None
- Get dst into src in the most efficient way possible:
Symlink.
Hardlink.
Copy.
If all three fail, we crash.
- tribler.core.libtorrent.torrents.create_torrent_file(export_dir: str, file_path_list: list[pathlib.Path], files_names: list[str] | None = None, name: str | None = None, announce: str | None = None, announce_list: list[str] | None = None, comment: str | None = None, created_by: str | None = None, nodes: list[tuple[str, int]] | None = None, piece_size: int = 0, url_list: list[str] | None = None, torrent_version: TorrentVersion = TorrentVersion.v1) TorrentFileResult
Create a torrent file from the given paths and parameters.
If an output file path is omitted, no file will be written to disk.