magnet2torrent
is a C++ program that converts a magnet link to a .torrent
file using the libtorrent library. This tool is designed to help users create torrent files from magnet URIs, which can be useful for sharing and managing torrents.
- Converts a magnet link to a
.torrent
file. - Uses the libtorrent library for torrent management.
- Allows you to specify the output filename for the generated
.torrent
file.
To use the program, you need to provide the magnet link and the desired output filename as command-line arguments:
Example:
./magnet2torrent "magnet:?xt=urn:btih:..." "output.torrent"
To compile and build the magnet2torrent
program on Arch Linux, follow these steps:
-
Install Dependencies:
sudo pacman -S libtorrent-rasterbar libtorrent-rasterbar boost boost-libs gcc
-
Compile the Program:
g++ -o magnet2torrent main.cpp -lcurl -ltorrent-rasterbar -lstdc++fs
The main functionality is implemented in the main.cpp
file, which includes:
-
createTorrentFile
Function: Converts a magnet link to a.torrent
file. It initializes a libtorrent session, parses the magnet link, retrieves the torrent metadata, and writes the torrent file to disk. -
main
Function: Handles command-line arguments and calls thecreateTorrentFile
function.