Skip to content

Commit

Permalink
Add support for torrent-get calls with the key percentComplete (#2615)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Hadam <michael@hadam.us>
  • Loading branch information
ckerr and mhadam committed Feb 13, 2022
1 parent 96178b1 commit 83db648
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions extras/rpc-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ The 'source' column here corresponds to the data structure there.
| `peersFrom` | object (see below)| n/a
| `peersGettingFromUs` | number| tr_stat
| `peersSendingToUs` | number| tr_stat
| `percentDone` | double| tr_stat
| `percentComplete` | double | tr_stat
| `percentDone` | double | tr_stat
| `pieces` | string (see below)| tr_torrent
| `pieceCount`| number| tr_torrent_view
| `pieceSize`| number| tr_torrent_view
Expand Down Expand Up @@ -938,9 +939,10 @@ Transmission 4.0.0 (`rpc-version-semver` 5.3.0, `rpc-version`: 17)
| `session-get` | new arg `script-torrent-added-filename`
| `torrent-add` | new arg `labels`
| `torrent-get` | new arg `file-count`
| `torrent-get` | new arg `percentComplete`
| `torrent-get` | new arg `primary-mime-type`
| `torrent-get` | new arg `tracker.sitename`
| `torrent-get` | new arg `trackerStats.sitename`
| `torrent-get` | new arg `primary-mime-type`


### 5.1. Upcoming Breakage
Expand Down
3 changes: 2 additions & 1 deletion libtransmission/quark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using namespace std::literals;
namespace
{

auto constexpr my_static = std::array<std::string_view, 384>{ ""sv,
auto constexpr my_static = std::array<std::string_view, 385>{ ""sv,
"activeTorrentCount"sv,
"activity-date"sv,
"activityDate"sv,
Expand Down Expand Up @@ -230,6 +230,7 @@ auto constexpr my_static = std::array<std::string_view, 384>{ ""sv,
"peersFrom"sv,
"peersGettingFromUs"sv,
"peersSendingToUs"sv,
"percentComplete"sv,
"percentDone"sv,
"pex-enabled"sv,
"piece"sv,
Expand Down
1 change: 1 addition & 0 deletions libtransmission/quark.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ enum
TR_KEY_peersFrom,
TR_KEY_peersGettingFromUs,
TR_KEY_peersSendingToUs,
TR_KEY_percentComplete,
TR_KEY_percentDone,
TR_KEY_pex_enabled,
TR_KEY_piece,
Expand Down
4 changes: 4 additions & 0 deletions libtransmission/rpcimpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ static void initField(tr_torrent const* const tor, tr_stat const* const st, tr_v
tr_variantInitStrView(initme, tr_torrentName(tor));
break;

case TR_KEY_percentComplete:
tr_variantInitReal(initme, st->percentComplete);
break;

case TR_KEY_percentDone:
tr_variantInitReal(initme, st->percentDone);
break;
Expand Down

0 comments on commit 83db648

Please sign in to comment.