diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index 6ad5d8f7..de2b3503 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -255,6 +255,14 @@ 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.0 ); + double left = torrent->GetLength () - torrent->GetLeft(); + double percent = (left*100)/torrent->GetLength(); + return boost::json::value( percent ); + } + }, { "hashString", [](std::shared_ptr torrent) { std::string hexHash;