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>
|
2009-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Made the upper value of --max-concurrent-downloads options unlimited.
|
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");
|
const std::string BtContext::C_NODES("nodes");
|
||||||
|
|
||||||
|
void BtContext::setFileFilter(const IntSequence& seq)
|
||||||
|
{
|
||||||
|
_fileFilter = seq;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntSequence BtContext::getFileFilter() const
|
||||||
|
{
|
||||||
|
return _fileFilter;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
|
#include "IntSequence.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
class AnnounceTier;
|
class AnnounceTier;
|
||||||
|
@ -47,6 +49,8 @@ class RequestGroup;
|
||||||
class BtContext:public DownloadContext {
|
class BtContext:public DownloadContext {
|
||||||
protected:
|
protected:
|
||||||
bool _private;
|
bool _private;
|
||||||
|
|
||||||
|
IntSequence _fileFilter;
|
||||||
public:
|
public:
|
||||||
BtContext():_private(false) {}
|
BtContext():_private(false) {}
|
||||||
|
|
||||||
|
@ -81,6 +85,10 @@ public:
|
||||||
|
|
||||||
virtual std::deque<std::pair<std::string, uint16_t> >& getNodes() = 0;
|
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_NAME;
|
||||||
|
|
||||||
static const std::string C_FILES;
|
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.");
|
_logger->debug("Clearing http/ftp URIs because the current implementation does not allow integrating multi-file torrent and http/ftp.");
|
||||||
_uris.clear();
|
_uris.clear();
|
||||||
|
|
||||||
_pieceStorage->setFileFilter(Util::parseIntRange(_option->get(PREF_SELECT_FILE)));
|
_pieceStorage->setFileFilter(btContext->getFileFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedHandle<DefaultBtProgressInfoFile>
|
SharedHandle<DefaultBtProgressInfoFile>
|
||||||
|
|
|
@ -69,6 +69,8 @@ public:
|
||||||
Sequence(const Values& values):
|
Sequence(const Values& values):
|
||||||
_values(values) {}
|
_values(values) {}
|
||||||
|
|
||||||
|
Sequence() {}
|
||||||
|
|
||||||
T next()
|
T next()
|
||||||
{
|
{
|
||||||
if(_values.empty()) {
|
if(_values.empty()) {
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
#include "FileEntry.h"
|
#include "FileEntry.h"
|
||||||
#include "LogFactory.h"
|
#include "LogFactory.h"
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
|
#include "Util.h"
|
||||||
|
#include "array_fun.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -120,6 +122,8 @@ createBtRequestGroup(const std::string& torrentFilePath,
|
||||||
btContext->setPeerIdPrefix(op->get(PREF_PEER_ID_PREFIX));
|
btContext->setPeerIdPrefix(op->get(PREF_PEER_ID_PREFIX));
|
||||||
}
|
}
|
||||||
btContext->setDir(requestOption.get(PREF_DIR));
|
btContext->setDir(requestOption.get(PREF_DIR));
|
||||||
|
btContext->setFileFilter
|
||||||
|
(Util::parseIntRange(requestOption.get(PREF_SELECT_FILE)));
|
||||||
rg->setDownloadContext(btContext);
|
rg->setDownloadContext(btContext);
|
||||||
btContext->setOwnerRequestGroup(rg.get());
|
btContext->setOwnerRequestGroup(rg.get());
|
||||||
return rg;
|
return rg;
|
||||||
|
@ -271,6 +275,15 @@ void createRequestGroupForUri
|
||||||
createRequestGroupForUri(result, op, uris, *op);
|
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
|
static void createRequestGroupForUriList
|
||||||
(std::deque<SharedHandle<RequestGroup> >& result, Option* op, std::istream& in)
|
(std::deque<SharedHandle<RequestGroup> >& result, Option* op, std::istream& in)
|
||||||
{
|
{
|
||||||
|
@ -282,8 +295,15 @@ static void createRequestGroupForUriList
|
||||||
if(uris.empty()) {
|
if(uris.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
copyIfndef(requestOption, *op, PREF_DIR);
|
// These options can be specified in input list(-i list).
|
||||||
copyIfndef(requestOption, *op, PREF_OUT);
|
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);
|
createRequestGroupForUri(result, op, uris, requestOption);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue