feat: add downloader_count to trackerStats (#6936)

This commit is contained in:
Yat Ho
2025-11-13 00:23:37 +08:00
committed by GitHub
parent 0f7f460c55
commit 48ec09771c
6 changed files with 8 additions and 1 deletions

View File

@@ -386,6 +386,7 @@ Files are returned in the order they are laid out in the torrent. References to
| `announce` | string | tr_tracker_view
| `announceState` | number | tr_tracker_view
| `downloadCount` | number | tr_tracker_view
| `downloader_count` | number | tr_tracker_view
| `hasAnnounced` | boolean | tr_tracker_view
| `hasScraped` | boolean | tr_tracker_view
| `host` | string | tr_tracker_view
@@ -1049,4 +1050,5 @@ Transmission 4.1.0 (`rpc-version-semver` 5.4.0, `rpc-version`: 18)
| `torrent-get` | new arg `files.begin_piece`
| `torrent-get` | new arg `files.end_piece`
| `port-test` | new arg `ip_protocol`
| `torrent-get` | new arg `trackerStats.downloader_count`
| `torrent-get` | :warning: **DEPRECATED** `manualAnnounceTime`, it never worked

View File

@@ -1649,6 +1649,7 @@ namespace tracker_view_helpers
view.seederCount = tracker.seeder_count().value_or(-1);
view.leecherCount = tracker.leecher_count().value_or(-1);
view.downloadCount = tracker.download_count().value_or(-1);
view.downloader_count = tracker.downloader_count().value_or(-1);
if (view.isBackup)
{

View File

@@ -102,6 +102,7 @@ auto constexpr MyStatic = std::array<std::string_view, TR_N_KEYS>{
"downloaded-bytes"sv,
"downloadedBytes"sv,
"downloadedEver"sv,
"downloader_count"sv,
"downloading-time-seconds"sv,
"dropped"sv,
"dropped6"sv,

View File

@@ -104,6 +104,7 @@ enum // NOLINT(performance-enum-size)
TR_KEY_downloaded_bytes,
TR_KEY_downloadedBytes,
TR_KEY_downloadedEver,
TR_KEY_downloader_count,
TR_KEY_downloading_time_seconds,
TR_KEY_dropped,
TR_KEY_dropped6,

View File

@@ -408,10 +408,11 @@ namespace make_torrent_field_helpers
for (size_t idx = 0U; idx != n_trackers; ++idx)
{
auto const tracker = tr_torrentTracker(&tor, idx);
auto stats_map = tr_variant::Map{ 27U };
auto stats_map = tr_variant::Map{ 28U };
stats_map.try_emplace(TR_KEY_announce, tracker.announce);
stats_map.try_emplace(TR_KEY_announceState, tracker.announceState);
stats_map.try_emplace(TR_KEY_downloadCount, tracker.downloadCount);
stats_map.try_emplace(TR_KEY_downloader_count, tracker.downloader_count);
stats_map.try_emplace(TR_KEY_hasAnnounced, tracker.hasAnnounced);
stats_map.try_emplace(TR_KEY_hasScraped, tracker.hasScraped);
stats_map.try_emplace(TR_KEY_host, tracker.host_and_port);

View File

@@ -1280,6 +1280,7 @@ struct tr_tracker_view
int lastAnnouncePeerCount; // if hasAnnounced, the number of peers the tracker gave us
int leecherCount; // number of leechers the tracker knows of, or -1 if unknown
int seederCount; // number of seeders the tracker knows of, or -1 if unknown
int downloader_count; // number of downloaders (BEP-21) the tracker knows of, or -1 if unknown
size_t tier; // which tier this tracker is in
tr_tracker_id_t id; // unique transmission-generated ID for use in libtransmission API