mirror of https://github.com/aria2/aria2
Merge branch 'kkartaltepe-RpcTellStatus-Hashing'
commit
79298daf5f
|
@ -2614,6 +2614,15 @@ For information on the *secret* parameter, see :ref:`rpc_auth`.
|
||||||
``name``
|
``name``
|
||||||
name in info dictionary. ``name.utf-8`` is used if available.
|
name in info dictionary. ``name.utf-8`` is used if available.
|
||||||
|
|
||||||
|
``verifiedLength``
|
||||||
|
The number of verified number of bytes while the files are being
|
||||||
|
hash checked. This key exists only when this download is being
|
||||||
|
hash checked.
|
||||||
|
|
||||||
|
``verifyIntegrityPending``
|
||||||
|
``true`` if this download is waiting for the hash check in a
|
||||||
|
queue. This key exists only when this download is in the queue.
|
||||||
|
|
||||||
**JSON-RPC Example**
|
**JSON-RPC Example**
|
||||||
|
|
||||||
The following example gets information about a download with GID#2089b05ecca3d829::
|
The following example gets information about a download with GID#2089b05ecca3d829::
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
#include "BtRuntime.h"
|
#include "BtRuntime.h"
|
||||||
#include "BtAnnounce.h"
|
#include "BtAnnounce.h"
|
||||||
#endif // ENABLE_BITTORRENT
|
#endif // ENABLE_BITTORRENT
|
||||||
|
#include "CheckIntegrityEntry.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -144,6 +145,8 @@ const char KEY_NUM_WAITING[] = "numWaiting";
|
||||||
const char KEY_NUM_STOPPED[] = "numStopped";
|
const char KEY_NUM_STOPPED[] = "numStopped";
|
||||||
const char KEY_NUM_ACTIVE[] = "numActive";
|
const char KEY_NUM_ACTIVE[] = "numActive";
|
||||||
const char KEY_NUM_STOPPED_TOTAL[] = "numStoppedTotal";
|
const char KEY_NUM_STOPPED_TOTAL[] = "numStoppedTotal";
|
||||||
|
const char KEY_VERIFIED_LENGTH[] = "verifiedLength";
|
||||||
|
const char KEY_VERIFY_PENDING[] = "verifyIntegrityPending";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -793,6 +796,23 @@ void gatherProgress(Dict* entryDict, const std::shared_ptr<RequestGroup>& group,
|
||||||
e->getBtRegistry()->get(group->getGID()), keys);
|
e->getBtRegistry()->get(group->getGID()), keys);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_BITTORRENT
|
#endif // ENABLE_BITTORRENT
|
||||||
|
if (e->getCheckIntegrityMan()) {
|
||||||
|
if (e->getCheckIntegrityMan()->isPicked(
|
||||||
|
[&group](const CheckIntegrityEntry& ent) {
|
||||||
|
return ent.getRequestGroup() == group.get();
|
||||||
|
})) {
|
||||||
|
entryDict->put(
|
||||||
|
KEY_VERIFIED_LENGTH,
|
||||||
|
util::itos(
|
||||||
|
e->getCheckIntegrityMan()->getPickedEntry()->getCurrentLength()));
|
||||||
|
}
|
||||||
|
if (e->getCheckIntegrityMan()->isQueued(
|
||||||
|
[&group](const CheckIntegrityEntry& ent) {
|
||||||
|
return ent.getRequestGroup() == group.get();
|
||||||
|
})) {
|
||||||
|
entryDict->put(KEY_VERIFY_PENDING, VLB_TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace aria2 {
|
||||||
|
|
||||||
struct DownloadResult;
|
struct DownloadResult;
|
||||||
class RequestGroup;
|
class RequestGroup;
|
||||||
|
class CheckIntegrityEntry;
|
||||||
|
|
||||||
namespace rpc {
|
namespace rpc {
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,21 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t countEntryInQueue() const { return entries_.size(); }
|
size_t countEntryInQueue() const { return entries_.size(); }
|
||||||
|
|
||||||
|
bool isPicked(const std::function<bool(const T&)>& pred) const
|
||||||
|
{
|
||||||
|
return pickedEntry_ && pred(*pickedEntry_);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isQueued(const std::function<bool(const T&)>& pred) const
|
||||||
|
{
|
||||||
|
for (auto& e : entries_) {
|
||||||
|
if (pred(*e)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
Loading…
Reference in New Issue