summaryrefslogtreecommitdiff
path: root/src/aria2api.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-05-14 23:00:21 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-05-14 23:00:21 +0900
commit5dcc2b7842120222f6e15db37e7c9d7f8d73c797 (patch)
tree6f1fd32f206b0cd44b4f63e398b9368554bda0e3 /src/aria2api.cc
parentb0b5e0df3803d0a92b0412717b53ae8924905a07 (diff)
Add DownloadHandle::getBtMetaInfo() API
Diffstat (limited to 'src/aria2api.cc')
-rw-r--r--src/aria2api.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/aria2api.cc b/src/aria2api.cc
index 356b7515..93028ca9 100644
--- a/src/aria2api.cc
+++ b/src/aria2api.cc
@@ -590,6 +590,26 @@ struct RequestGroupDH : public DownloadHandle {
}
return createFileData(dctx->getFileEntries()[index-1], index, &bf);
}
+ virtual BtMetaInfoData getBtMetaInfo()
+ {
+ BtMetaInfoData res;
+#ifdef ENABLE_BITTORRENT
+ if(group->getDownloadContext()->hasAttribute(CTX_ATTR_BT)) {
+ SharedHandle<TorrentAttribute> torrentAttrs =
+ bittorrent::getTorrentAttrs(group->getDownloadContext());
+ res.announceList = torrentAttrs->announceList;
+ res.comment = torrentAttrs->comment;
+ res.creationDate = torrentAttrs->creationDate;
+ // TODO Use BtFileMode for torrentAttrs->mode
+ res.mode = torrentAttrs->mode == "single" ?
+ BT_FILE_MODE_SINGLE : BT_FILE_MODE_MULTI;
+ if(!torrentAttrs->metadata.empty()) {
+ res.name = torrentAttrs->name;
+ }
+ }
+#endif // ENABLE_BITTORRENT
+ return res;
+ }
SharedHandle<RequestGroup> group;
TransferStat ts;
};
@@ -687,6 +707,10 @@ struct DownloadResultDH : public DownloadHandle {
dr->bitfield.size());
return createFileData(dr->fileEntries[index-1], index, &bf);
}
+ virtual BtMetaInfoData getBtMetaInfo()
+ {
+ return BtMetaInfoData();
+ }
SharedHandle<DownloadResult> dr;
};
} // namespace