mirror of https://github.com/aria2/aria2
2009-12-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use info hash as a filename when saving BitTorrent metadata. * src/UTMetadataPostDownloadHandler.cc * test/UTMetadataPostDownloadHandlerTest.ccpull/1/head
parent
1b3436b5cd
commit
606360779f
|
@ -1,3 +1,9 @@
|
||||||
|
2009-12-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Use info hash as a filename when saving BitTorrent metadata.
|
||||||
|
* src/UTMetadataPostDownloadHandler.cc
|
||||||
|
* test/UTMetadataPostDownloadHandlerTest.cc
|
||||||
|
|
||||||
2009-12-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-12-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Documented system.multicall XML-RPC method in man page.
|
Documented system.multicall XML-RPC method in man page.
|
||||||
|
|
|
@ -88,14 +88,10 @@ void UTMetadataPostDownloadHandler::getNextRequestGroups
|
||||||
requestGroup->followedBy(newRgs.begin(), newRgs.end());
|
requestGroup->followedBy(newRgs.begin(), newRgs.end());
|
||||||
groups.insert(groups.end(), newRgs.begin(), newRgs.end());
|
groups.insert(groups.end(), newRgs.begin(), newRgs.end());
|
||||||
|
|
||||||
if(!newRgs.empty() &&
|
if(requestGroup->getOption()->getAsBool(PREF_BT_SAVE_METADATA)) {
|
||||||
requestGroup->getOption()->getAsBool(PREF_BT_SAVE_METADATA)) {
|
|
||||||
SharedHandle<DownloadContext> dctx = newRgs.front()->getDownloadContext();
|
|
||||||
assert(dctx->hasAttribute(bittorrent::BITTORRENT));
|
|
||||||
std::string filename = requestGroup->getOption()->get(PREF_DIR);
|
std::string filename = requestGroup->getOption()->get(PREF_DIR);
|
||||||
filename += A2STR::SLASH_C;
|
filename += A2STR::SLASH_C;
|
||||||
filename +=
|
filename += util::toHex(attrs[bittorrent::INFO_HASH].s());
|
||||||
dctx->getAttribute(bittorrent::BITTORRENT)[bittorrent::NAME].s();
|
|
||||||
filename += ".torrent";
|
filename += ".torrent";
|
||||||
if(util::saveAs(filename, torrent)) {
|
if(util::saveAs(filename, torrent)) {
|
||||||
_logger->notice(MSG_METADATA_SAVED, filename.c_str());
|
_logger->notice(MSG_METADATA_SAVED, filename.c_str());
|
||||||
|
|
|
@ -64,7 +64,7 @@ void UTMetadataPostDownloadHandlerTest::testCanHandle()
|
||||||
|
|
||||||
void UTMetadataPostDownloadHandlerTest::testGetNextRequestGroups()
|
void UTMetadataPostDownloadHandlerTest::testGetNextRequestGroups()
|
||||||
{
|
{
|
||||||
File trfile("aria2-0.8.2.tar.bz2.torrent");
|
File trfile("cd41c7fdddfd034a15a04d7ff881216e01c4ceaf.torrent");
|
||||||
if(trfile.exists()) {
|
if(trfile.exists()) {
|
||||||
trfile.remove();
|
trfile.remove();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue