mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-22 23:10:24 +00:00
feat: percentDone torrentRPC
This commit is contained in:
@@ -271,6 +271,12 @@ namespace torrents
|
||||
{ "pieceCount", [](std::shared_ptr<Torrent> torrent) { return boost::json::value(torrent->GetNumPieces ()); } },
|
||||
{ "pieceSize", [](std::shared_ptr<Torrent> torrent) { return boost::json::value(torrent->GetPieceLength ()); } },
|
||||
{ "totalSize", [](std::shared_ptr<Torrent> torrent) { return boost::json::value(torrent->GetLength ()); } },
|
||||
{ "percentDone", [](std::shared_ptr<Torrent> 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> torrent)
|
||||
{
|
||||
std::string hexHash;
|
||||
|
||||
Reference in New Issue
Block a user