From 0efeaaec6fd048fdc373aaa6d0c705e6cbbb2016 Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Sat, 22 Aug 2026 14:37:52 +0300 Subject: [PATCH] feat: percentDone torrentRPC --- libi2pd_client/TorrentsRPC.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index b4d822a7..af877772 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -271,6 +271,12 @@ namespace torrents { "pieceCount", [](std::shared_ptr torrent) { return boost::json::value(torrent->GetNumPieces ()); } }, { "pieceSize", [](std::shared_ptr torrent) { return boost::json::value(torrent->GetPieceLength ()); } }, { "totalSize", [](std::shared_ptr torrent) { return boost::json::value(torrent->GetLength ()); } }, + { "percentDone", [](std::shared_ptr torrent) + { + if(!torrent->GetLength()) return boost::json::value ( 100 ); + return boost::json::value( (torrent->GetLength () - torrent->GetLeft ())*100/torrent->GetLength () ); + } + }, { "hashString", [](std::shared_ptr torrent) { std::string hexHash;