mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Filter torrent info endpoint by tag (#15152)
This commit is contained in:
parent
5d03917877
commit
9bfc74a1bc
1 changed files with 3 additions and 1 deletions
|
@ -246,6 +246,7 @@ namespace
|
||||||
// GET params:
|
// GET params:
|
||||||
// - filter (string): all, downloading, seeding, completed, paused, resumed, active, inactive, stalled, stalled_uploading, stalled_downloading
|
// - filter (string): all, downloading, seeding, completed, paused, resumed, active, inactive, stalled, stalled_uploading, stalled_downloading
|
||||||
// - category (string): torrent category for filtering by it (empty string means "uncategorized"; no "category" param presented means "any category")
|
// - category (string): torrent category for filtering by it (empty string means "uncategorized"; no "category" param presented means "any category")
|
||||||
|
// - tag (string): torrent tag for filtering by it (empty string means "untagged"; no "tag" param presented means "any tag")
|
||||||
// - hashes (string): filter by hashes, can contain multiple hashes separated by |
|
// - hashes (string): filter by hashes, can contain multiple hashes separated by |
|
||||||
// - sort (string): name of column for sorting by its value
|
// - sort (string): name of column for sorting by its value
|
||||||
// - reverse (bool): enable reverse sorting
|
// - reverse (bool): enable reverse sorting
|
||||||
|
@ -255,6 +256,7 @@ void TorrentsController::infoAction()
|
||||||
{
|
{
|
||||||
const QString filter {params()["filter"]};
|
const QString filter {params()["filter"]};
|
||||||
const QString category {params()["category"]};
|
const QString category {params()["category"]};
|
||||||
|
const QString tag {params()["tag"]};
|
||||||
const QString sortedColumn {params()["sort"]};
|
const QString sortedColumn {params()["sort"]};
|
||||||
const bool reverse {parseBool(params()["reverse"]).value_or(false)};
|
const bool reverse {parseBool(params()["reverse"]).value_or(false)};
|
||||||
int limit {params()["limit"].toInt()};
|
int limit {params()["limit"].toInt()};
|
||||||
|
@ -265,7 +267,7 @@ void TorrentsController::infoAction()
|
||||||
for (const QString &hash : hashes)
|
for (const QString &hash : hashes)
|
||||||
idSet.insert(BitTorrent::TorrentID::fromString(hash));
|
idSet.insert(BitTorrent::TorrentID::fromString(hash));
|
||||||
|
|
||||||
const TorrentFilter torrentFilter(filter, (hashes.isEmpty() ? TorrentFilter::AnyID : idSet), category);
|
const TorrentFilter torrentFilter(filter, (hashes.isEmpty() ? TorrentFilter::AnyID : idSet), category, tag);
|
||||||
QVariantList torrentList;
|
QVariantList torrentList;
|
||||||
for (const BitTorrent::Torrent *torrent : asConst(BitTorrent::Session::instance()->torrents()))
|
for (const BitTorrent::Torrent *torrent : asConst(BitTorrent::Session::instance()->torrents()))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue