mirror of https://github.com/aria2/aria2
2009-11-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Now addUri XML-RPC method accepts BitTorrent Magnet URI. * src/download_helper.cc * src/download_helper.h * src/XmlRpcMethodImpl.ccpull/1/head
parent
82d75a94d8
commit
d33c7c7db1
|
@ -1,3 +1,10 @@
|
||||||
|
2009-11-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Now addUri XML-RPC method accepts BitTorrent Magnet URI.
|
||||||
|
* src/download_helper.cc
|
||||||
|
* src/download_helper.h
|
||||||
|
* src/XmlRpcMethodImpl.cc
|
||||||
|
|
||||||
2009-11-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-11-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Updated man page for changeOption XML-RPC method.
|
Updated man page for changeOption XML-RPC method.
|
||||||
|
|
|
@ -143,7 +143,7 @@ BDE AddUriXmlRpcMethod::process(const XmlRpcRequest& req, DownloadEngine* e)
|
||||||
std::deque<SharedHandle<RequestGroup> > result;
|
std::deque<SharedHandle<RequestGroup> > result;
|
||||||
createRequestGroupForUri(result, requestOption, uris,
|
createRequestGroupForUri(result, requestOption, uris,
|
||||||
/* ignoreForceSeq = */ true,
|
/* ignoreForceSeq = */ true,
|
||||||
/* ignoreNonURI = */ true);
|
/* ignoreLocalPath = */ true);
|
||||||
|
|
||||||
if(!result.empty()) {
|
if(!result.empty()) {
|
||||||
return addRequestGroup(result.front(), e, posGiven, pos);
|
return addRequestGroup(result.front(), e, posGiven, pos);
|
||||||
|
|
|
@ -307,10 +307,13 @@ private:
|
||||||
std::deque<SharedHandle<RequestGroup> >& _requestGroups;
|
std::deque<SharedHandle<RequestGroup> >& _requestGroups;
|
||||||
ProtocolDetector _detector;
|
ProtocolDetector _detector;
|
||||||
SharedHandle<Option> _option;
|
SharedHandle<Option> _option;
|
||||||
|
bool _ignoreLocalPath;
|
||||||
public:
|
public:
|
||||||
AccRequestGroup(std::deque<SharedHandle<RequestGroup> >& requestGroups,
|
AccRequestGroup(std::deque<SharedHandle<RequestGroup> >& requestGroups,
|
||||||
const SharedHandle<Option>& option):
|
const SharedHandle<Option>& option,
|
||||||
_requestGroups(requestGroups), _option(option) {}
|
bool ignoreLocalPath = false):
|
||||||
|
_requestGroups(requestGroups), _option(option),
|
||||||
|
_ignoreLocalPath(ignoreLocalPath) {}
|
||||||
|
|
||||||
void
|
void
|
||||||
operator()(const std::string& uri)
|
operator()(const std::string& uri)
|
||||||
|
@ -337,7 +340,7 @@ public:
|
||||||
// We simply ignore it.
|
// We simply ignore it.
|
||||||
LogFactory::getInstance()->error(EX_EXCEPTION_CAUGHT, e);
|
LogFactory::getInstance()->error(EX_EXCEPTION_CAUGHT, e);
|
||||||
}
|
}
|
||||||
} else if(_detector.guessTorrentFile(uri)) {
|
} else if(!_ignoreLocalPath && _detector.guessTorrentFile(uri)) {
|
||||||
try {
|
try {
|
||||||
_requestGroups.push_back(createBtRequestGroup(uri, _option,
|
_requestGroups.push_back(createBtRequestGroup(uri, _option,
|
||||||
std::deque<std::string>()));
|
std::deque<std::string>()));
|
||||||
|
@ -349,7 +352,7 @@ public:
|
||||||
}
|
}
|
||||||
#endif // ENABLE_BITTORRENT
|
#endif // ENABLE_BITTORRENT
|
||||||
#ifdef ENABLE_METALINK
|
#ifdef ENABLE_METALINK
|
||||||
else if(_detector.guessMetalinkFile(uri)) {
|
else if(!_ignoreLocalPath && _detector.guessMetalinkFile(uri)) {
|
||||||
try {
|
try {
|
||||||
Metalink2RequestGroup().generate(_requestGroups, uri, _option);
|
Metalink2RequestGroup().generate(_requestGroups, uri, _option);
|
||||||
} catch(RecoverableException& e) {
|
} catch(RecoverableException& e) {
|
||||||
|
@ -379,7 +382,7 @@ void createRequestGroupForUri
|
||||||
const SharedHandle<Option>& option,
|
const SharedHandle<Option>& option,
|
||||||
const std::deque<std::string>& uris,
|
const std::deque<std::string>& uris,
|
||||||
bool ignoreForceSequential,
|
bool ignoreForceSequential,
|
||||||
bool ignoreNonURI)
|
bool ignoreLocalPath)
|
||||||
{
|
{
|
||||||
std::deque<std::string> nargs;
|
std::deque<std::string> nargs;
|
||||||
if(option->get(PREF_PARAMETERIZED_URI) == V_TRUE) {
|
if(option->get(PREF_PARAMETERIZED_URI) == V_TRUE) {
|
||||||
|
@ -389,7 +392,7 @@ void createRequestGroupForUri
|
||||||
}
|
}
|
||||||
if(!ignoreForceSequential && option->get(PREF_FORCE_SEQUENTIAL) == V_TRUE) {
|
if(!ignoreForceSequential && option->get(PREF_FORCE_SEQUENTIAL) == V_TRUE) {
|
||||||
std::for_each(nargs.begin(), nargs.end(),
|
std::for_each(nargs.begin(), nargs.end(),
|
||||||
AccRequestGroup(result, option));
|
AccRequestGroup(result, option, ignoreLocalPath));
|
||||||
} else {
|
} else {
|
||||||
std::deque<std::string>::iterator strmProtoEnd =
|
std::deque<std::string>::iterator strmProtoEnd =
|
||||||
std::stable_partition(nargs.begin(), nargs.end(), StreamProtocolFilter());
|
std::stable_partition(nargs.begin(), nargs.end(), StreamProtocolFilter());
|
||||||
|
@ -404,11 +407,9 @@ void createRequestGroupForUri
|
||||||
rg->setNumConcurrentCommand(numSplit);
|
rg->setNumConcurrentCommand(numSplit);
|
||||||
result.push_back(rg);
|
result.push_back(rg);
|
||||||
}
|
}
|
||||||
if(!ignoreNonURI) {
|
|
||||||
// process remaining URIs(local metalink, BitTorrent files)
|
// process remaining URIs(local metalink, BitTorrent files)
|
||||||
std::for_each(strmProtoEnd, nargs.end(),
|
std::for_each(strmProtoEnd, nargs.end(),
|
||||||
AccRequestGroup(result, option));
|
AccRequestGroup(result, option, ignoreLocalPath));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,13 +81,14 @@ void createRequestGroupForUriList
|
||||||
(std::deque<SharedHandle<RequestGroup> >& result,
|
(std::deque<SharedHandle<RequestGroup> >& result,
|
||||||
const SharedHandle<Option>& option);
|
const SharedHandle<Option>& option);
|
||||||
|
|
||||||
// Create RequestGroup object using provided uris.
|
// Create RequestGroup object using provided uris. If ignoreLocalPath
|
||||||
|
// is true, a path to torrent file abd metalink file are ignored.
|
||||||
void createRequestGroupForUri
|
void createRequestGroupForUri
|
||||||
(std::deque<SharedHandle<RequestGroup> >& result,
|
(std::deque<SharedHandle<RequestGroup> >& result,
|
||||||
const SharedHandle<Option>& option,
|
const SharedHandle<Option>& option,
|
||||||
const std::deque<std::string>& uris,
|
const std::deque<std::string>& uris,
|
||||||
bool ignoreForceSequential = false,
|
bool ignoreForceSequential = false,
|
||||||
bool ignoreNonURI = false);
|
bool ignoreLocalPath = false);
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue