KanoopTorrentQt 0.1.0
Qt6 wrapper library for libtorrent-rasterbar
Loading...
Searching...
No Matches
TorrentSearchResult Class Reference

Metadata for a single torrent search result. More...

#include <torrentsearchresult.h>

Public Member Functions

QString name () const
 Torrent display name.
 
QString infoHash () const
 Hex-encoded info hash string.
 
qint64 size () const
 Total content size in bytes.
 
int seeders () const
 Number of seeders reported by the tracker.
 
int leechers () const
 Number of leechers reported by the tracker.
 
QDateTime addedDate () const
 Date/time the torrent was added to the index.
 
QString category () const
 Category string (e.g.
 
QString uploaderName () const
 Name of the uploader.
 
MagnetLink toMagnetLink () const
 Convert this result to a MagnetLink.
 

Static Public Member Functions

static TorrentSearchResult fromJson (const QJsonObject &json)
 Parse a search result from a JSON object.
 
static QString formatSize (qint64 bytes)
 Format a byte count as a human-readable string.
 

Detailed Description

Metadata for a single torrent search result.

Populated by TorrentSearcher from API responses. Use toMagnetLink() to convert a result into a MagnetLink suitable for TorrentClient::addTorrent().

Definition at line 16 of file torrentsearchresult.h.

Member Function Documentation

◆ addedDate()

QDateTime TorrentSearchResult::addedDate ( ) const
inline

Date/time the torrent was added to the index.

Definition at line 32 of file torrentsearchresult.h.

◆ category()

QString TorrentSearchResult::category ( ) const
inline

Category string (e.g.

"Audio", "Video").

Definition at line 34 of file torrentsearchresult.h.

◆ formatSize()

static QString TorrentSearchResult::formatSize ( qint64  bytes)
static

Format a byte count as a human-readable string.

Parameters
bytesRaw byte count.
Returns
Formatted string (e.g. "1.23 GB").

◆ fromJson()

static TorrentSearchResult TorrentSearchResult::fromJson ( const QJsonObject &  json)
static

Parse a search result from a JSON object.

Expected fields: name, info_hash, size, seeders, leechers, added, category, username.

Parameters
jsonThe JSON object to parse.
Returns
A populated TorrentSearchResult.

◆ infoHash()

QString TorrentSearchResult::infoHash ( ) const
inline

Hex-encoded info hash string.

Definition at line 24 of file torrentsearchresult.h.

◆ leechers()

int TorrentSearchResult::leechers ( ) const
inline

Number of leechers reported by the tracker.

Definition at line 30 of file torrentsearchresult.h.

◆ name()

QString TorrentSearchResult::name ( ) const
inline

Torrent display name.

Definition at line 22 of file torrentsearchresult.h.

◆ seeders()

int TorrentSearchResult::seeders ( ) const
inline

Number of seeders reported by the tracker.

Definition at line 28 of file torrentsearchresult.h.

◆ size()

qint64 TorrentSearchResult::size ( ) const
inline

Total content size in bytes.

Definition at line 26 of file torrentsearchresult.h.

◆ toMagnetLink()

MagnetLink TorrentSearchResult::toMagnetLink ( ) const

Convert this result to a MagnetLink.

Returns
A MagnetLink with the info hash and display name set.

◆ uploaderName()

QString TorrentSearchResult::uploaderName ( ) const
inline

Name of the uploader.

Definition at line 36 of file torrentsearchresult.h.


The documentation for this class was generated from the following file: