mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
WebAPI: allow filter torrents by tracker_errored
This commit is contained in:
parent
c2f2a38582
commit
9d59ea536b
2 changed files with 17 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "bittorrent/infohash.h"
|
#include "bittorrent/infohash.h"
|
||||||
#include "bittorrent/torrent.h"
|
#include "bittorrent/torrent.h"
|
||||||
|
#include "bittorrent/trackerentrystatus.h"
|
||||||
|
|
||||||
const std::optional<QString> TorrentFilter::AnyCategory;
|
const std::optional<QString> TorrentFilter::AnyCategory;
|
||||||
const std::optional<TorrentIDSet> TorrentFilter::AnyID;
|
const std::optional<TorrentIDSet> TorrentFilter::AnyID;
|
||||||
|
@ -48,6 +49,7 @@ const TorrentFilter TorrentFilter::StalledDownloadingTorrent(TorrentFilter::Stal
|
||||||
const TorrentFilter TorrentFilter::CheckingTorrent(TorrentFilter::Checking);
|
const TorrentFilter TorrentFilter::CheckingTorrent(TorrentFilter::Checking);
|
||||||
const TorrentFilter TorrentFilter::MovingTorrent(TorrentFilter::Moving);
|
const TorrentFilter TorrentFilter::MovingTorrent(TorrentFilter::Moving);
|
||||||
const TorrentFilter TorrentFilter::ErroredTorrent(TorrentFilter::Errored);
|
const TorrentFilter TorrentFilter::ErroredTorrent(TorrentFilter::Errored);
|
||||||
|
const TorrentFilter TorrentFilter::TrackerErroredTorrent(TorrentFilter::TrackerErrored);
|
||||||
|
|
||||||
using BitTorrent::Torrent;
|
using BitTorrent::Torrent;
|
||||||
|
|
||||||
|
@ -112,6 +114,8 @@ bool TorrentFilter::setTypeByName(const QString &filter)
|
||||||
type = Moving;
|
type = Moving;
|
||||||
else if (filter == u"errored")
|
else if (filter == u"errored")
|
||||||
type = Errored;
|
type = Errored;
|
||||||
|
else if (filter == u"tracker_errored")
|
||||||
|
type = TrackerErrored;
|
||||||
|
|
||||||
return setType(type);
|
return setType(type);
|
||||||
}
|
}
|
||||||
|
@ -204,6 +208,17 @@ bool TorrentFilter::matchState(const BitTorrent::Torrent *const torrent) const
|
||||||
return torrent->isMoving();
|
return torrent->isMoving();
|
||||||
case Errored:
|
case Errored:
|
||||||
return torrent->isErrored();
|
return torrent->isErrored();
|
||||||
|
case TrackerErrored:
|
||||||
|
for (BitTorrent::TrackerEntryStatus &tracker : torrent->trackers())
|
||||||
|
{
|
||||||
|
if ((tracker.state == BitTorrent::TrackerEndpointState::NotWorking)
|
||||||
|
|| (tracker.state == BitTorrent::TrackerEndpointState::TrackerError)
|
||||||
|
|| (tracker.state == BitTorrent::TrackerEndpointState::Unreachable))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -62,6 +62,7 @@ public:
|
||||||
Checking,
|
Checking,
|
||||||
Moving,
|
Moving,
|
||||||
Errored,
|
Errored,
|
||||||
|
TrackerErrored,
|
||||||
|
|
||||||
_Count
|
_Count
|
||||||
};
|
};
|
||||||
|
@ -84,6 +85,7 @@ public:
|
||||||
static const TorrentFilter CheckingTorrent;
|
static const TorrentFilter CheckingTorrent;
|
||||||
static const TorrentFilter MovingTorrent;
|
static const TorrentFilter MovingTorrent;
|
||||||
static const TorrentFilter ErroredTorrent;
|
static const TorrentFilter ErroredTorrent;
|
||||||
|
static const TorrentFilter TrackerErroredTorrent;
|
||||||
|
|
||||||
TorrentFilter() = default;
|
TorrentFilter() = default;
|
||||||
// category & tags: pass empty string for uncategorized / untagged torrents.
|
// category & tags: pass empty string for uncategorized / untagged torrents.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue