diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-14 23:00:21 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-14 23:00:21 +0900 |
| commit | 5dcc2b7842120222f6e15db37e7c9d7f8d73c797 (patch) | |
| tree | 6f1fd32f206b0cd44b4f63e398b9368554bda0e3 /src/aria2api.cc | |
| parent | b0b5e0df3803d0a92b0412717b53ae8924905a07 (diff) | |
Add DownloadHandle::getBtMetaInfo() API
Diffstat (limited to 'src/aria2api.cc')
| -rw-r--r-- | src/aria2api.cc | 24 |
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 |
