mirror of https://github.com/aria2/aria2
2009-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Now select-file can be specified in the uri list(-i list). * src/BtContext.cc * src/BtContext.h * src/RequestGroup.cc * src/Sequence.h * src/download_helper.ccpull/1/head
parent
cffb6be91a
commit
dbc8d549c7
|
@ -1,3 +1,12 @@
|
|||
2009-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Now select-file can be specified in the uri list(-i list).
|
||||
* src/BtContext.cc
|
||||
* src/BtContext.h
|
||||
* src/RequestGroup.cc
|
||||
* src/Sequence.h
|
||||
* src/download_helper.cc
|
||||
|
||||
2009-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Made the upper value of --max-concurrent-downloads options unlimited.
|
||||
|
|
|
@ -62,4 +62,14 @@ const std::string BtContext::C_ANNOUNCE_LIST("announce-list");
|
|||
|
||||
const std::string BtContext::C_NODES("nodes");
|
||||
|
||||
void BtContext::setFileFilter(const IntSequence& seq)
|
||||
{
|
||||
_fileFilter = seq;
|
||||
}
|
||||
|
||||
IntSequence BtContext::getFileFilter() const
|
||||
{
|
||||
return _fileFilter;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include <utility>
|
||||
#include <deque>
|
||||
|
||||
#include "IntSequence.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class AnnounceTier;
|
||||
|
@ -47,6 +49,8 @@ class RequestGroup;
|
|||
class BtContext:public DownloadContext {
|
||||
protected:
|
||||
bool _private;
|
||||
|
||||
IntSequence _fileFilter;
|
||||
public:
|
||||
BtContext():_private(false) {}
|
||||
|
||||
|
@ -81,6 +85,10 @@ public:
|
|||
|
||||
virtual std::deque<std::pair<std::string, uint16_t> >& getNodes() = 0;
|
||||
|
||||
void setFileFilter(const IntSequence& seq);
|
||||
|
||||
IntSequence getFileFilter() const;
|
||||
|
||||
static const std::string C_NAME;
|
||||
|
||||
static const std::string C_FILES;
|
||||
|
|
|
@ -215,7 +215,7 @@ void RequestGroup::createInitialCommand(std::deque<Command*>& commands,
|
|||
_logger->debug("Clearing http/ftp URIs because the current implementation does not allow integrating multi-file torrent and http/ftp.");
|
||||
_uris.clear();
|
||||
|
||||
_pieceStorage->setFileFilter(Util::parseIntRange(_option->get(PREF_SELECT_FILE)));
|
||||
_pieceStorage->setFileFilter(btContext->getFileFilter());
|
||||
}
|
||||
|
||||
SharedHandle<DefaultBtProgressInfoFile>
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
Sequence(const Values& values):
|
||||
_values(values) {}
|
||||
|
||||
Sequence() {}
|
||||
|
||||
T next()
|
||||
{
|
||||
if(_values.empty()) {
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
#include "FileEntry.h"
|
||||
#include "LogFactory.h"
|
||||
#include "File.h"
|
||||
#include "Util.h"
|
||||
#include "array_fun.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -120,6 +122,8 @@ createBtRequestGroup(const std::string& torrentFilePath,
|
|||
btContext->setPeerIdPrefix(op->get(PREF_PEER_ID_PREFIX));
|
||||
}
|
||||
btContext->setDir(requestOption.get(PREF_DIR));
|
||||
btContext->setFileFilter
|
||||
(Util::parseIntRange(requestOption.get(PREF_SELECT_FILE)));
|
||||
rg->setDownloadContext(btContext);
|
||||
btContext->setOwnerRequestGroup(rg.get());
|
||||
return rg;
|
||||
|
@ -271,6 +275,15 @@ void createRequestGroupForUri
|
|||
createRequestGroupForUri(result, op, uris, *op);
|
||||
}
|
||||
|
||||
template<typename InputIterator>
|
||||
static void foreachCopyIfndef(InputIterator first, InputIterator last,
|
||||
Option& dest, const Option& src)
|
||||
{
|
||||
for(; first != last; ++first) {
|
||||
copyIfndef(dest, src, *first);
|
||||
}
|
||||
}
|
||||
|
||||
static void createRequestGroupForUriList
|
||||
(std::deque<SharedHandle<RequestGroup> >& result, Option* op, std::istream& in)
|
||||
{
|
||||
|
@ -282,8 +295,15 @@ static void createRequestGroupForUriList
|
|||
if(uris.empty()) {
|
||||
continue;
|
||||
}
|
||||
copyIfndef(requestOption, *op, PREF_DIR);
|
||||
copyIfndef(requestOption, *op, PREF_OUT);
|
||||
// These options can be specified in input list(-i list).
|
||||
static const std::string REQUEST_OPTIONS[] = {
|
||||
PREF_DIR,
|
||||
PREF_OUT,
|
||||
PREF_SELECT_FILE
|
||||
};
|
||||
foreachCopyIfndef(&REQUEST_OPTIONS[0],
|
||||
&REQUEST_OPTIONS[arrayLength(REQUEST_OPTIONS)],
|
||||
requestOption, *op);
|
||||
|
||||
createRequestGroupForUri(result, op, uris, requestOption);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue