mirror of https://github.com/aria2/aria2
2009-05-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Show "[MEMORY]" prefix before filename in download summary if it is downloaded into memory. * src/DownloadResult.h * src/RequestGroup.cc * src/RequestGroupMan.ccpull/1/head
parent
ee75995198
commit
86f27fed57
|
@ -1,3 +1,11 @@
|
||||||
|
2009-05-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Show "[MEMORY]" prefix before filename in download summary if it
|
||||||
|
is downloaded into memory.
|
||||||
|
* src/DownloadResult.h
|
||||||
|
* src/RequestGroup.cc
|
||||||
|
* src/RequestGroupMan.cc
|
||||||
|
|
||||||
2009-05-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-05-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Defined MSG_CANNOT_PARSE_XML_RPC_REQUEST
|
Defined MSG_CANNOT_PARSE_XML_RPC_REQUEST
|
||||||
|
|
|
@ -66,6 +66,8 @@ public:
|
||||||
|
|
||||||
std::deque<SharedHandle<FileEntry> > fileEntries;
|
std::deque<SharedHandle<FileEntry> > fileEntries;
|
||||||
|
|
||||||
|
bool inMemoryDownload;
|
||||||
|
|
||||||
uint64_t totalLength;
|
uint64_t totalLength;
|
||||||
|
|
||||||
std::string uri;
|
std::string uri;
|
||||||
|
@ -81,6 +83,7 @@ public:
|
||||||
|
|
||||||
DownloadResult(int32_t gid,
|
DownloadResult(int32_t gid,
|
||||||
const std::deque<SharedHandle<FileEntry> >& fileEntries,
|
const std::deque<SharedHandle<FileEntry> >& fileEntries,
|
||||||
|
bool inMemoryDownload,
|
||||||
uint64_t totalLength,
|
uint64_t totalLength,
|
||||||
const std::string& uri,
|
const std::string& uri,
|
||||||
size_t numUri,
|
size_t numUri,
|
||||||
|
@ -89,6 +92,7 @@ public:
|
||||||
RESULT result):
|
RESULT result):
|
||||||
gid(gid),
|
gid(gid),
|
||||||
fileEntries(fileEntries),
|
fileEntries(fileEntries),
|
||||||
|
inMemoryDownload(inMemoryDownload),
|
||||||
totalLength(totalLength),
|
totalLength(totalLength),
|
||||||
uri(uri),
|
uri(uri),
|
||||||
numUri(numUri),
|
numUri(numUri),
|
||||||
|
|
|
@ -1026,6 +1026,7 @@ DownloadResultHandle RequestGroup::createDownloadResult() const
|
||||||
SharedHandle<DownloadResult>
|
SharedHandle<DownloadResult>
|
||||||
(new DownloadResult(_gid,
|
(new DownloadResult(_gid,
|
||||||
_downloadContext->getFileEntries(),
|
_downloadContext->getFileEntries(),
|
||||||
|
_inMemoryDownload,
|
||||||
getTotalLength(),
|
getTotalLength(),
|
||||||
uris.empty() ? A2STR::NIL:uris.front(),
|
uris.empty() ? A2STR::NIL:uris.front(),
|
||||||
uris.size(),
|
uris.size(),
|
||||||
|
|
|
@ -564,7 +564,7 @@ static size_t countRequestedFileEntry(InputIterator first, InputIterator last)
|
||||||
|
|
||||||
template<typename InputIterator>
|
template<typename InputIterator>
|
||||||
static void writeFilePath
|
static void writeFilePath
|
||||||
(InputIterator first, InputIterator last, std::ostream& o)
|
(InputIterator first, InputIterator last, std::ostream& o, bool memory)
|
||||||
{
|
{
|
||||||
SharedHandle<FileEntry> e = getFirstRequestedFileEntry(first, last);
|
SharedHandle<FileEntry> e = getFirstRequestedFileEntry(first, last);
|
||||||
if(e.isNull()) {
|
if(e.isNull()) {
|
||||||
|
@ -573,7 +573,11 @@ static void writeFilePath
|
||||||
if(e->getPath().empty()) {
|
if(e->getPath().empty()) {
|
||||||
o << "n/a";
|
o << "n/a";
|
||||||
} else {
|
} else {
|
||||||
o << e->getPath();
|
if(memory) {
|
||||||
|
o << "[MEMORY]" << File(e->getPath()).getBasename();
|
||||||
|
} else {
|
||||||
|
o << e->getPath();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
size_t count = countRequestedFileEntry(first, last);
|
size_t count = countRequestedFileEntry(first, last);
|
||||||
if(count > 1) {
|
if(count > 1) {
|
||||||
|
@ -598,16 +602,14 @@ std::string RequestGroupMan::formatDownloadResult(const std::string& status, con
|
||||||
o << "|";
|
o << "|";
|
||||||
const std::deque<SharedHandle<FileEntry> >& fileEntries =
|
const std::deque<SharedHandle<FileEntry> >& fileEntries =
|
||||||
downloadResult->fileEntries;
|
downloadResult->fileEntries;
|
||||||
if(downloadResult->result == DownloadResult::FINISHED) {
|
if(downloadResult->result == DownloadResult::FINISHED ||
|
||||||
writeFilePath(fileEntries.begin(), fileEntries.end(), o);
|
downloadResult->numUri == 0) {
|
||||||
|
writeFilePath(fileEntries.begin(), fileEntries.end(), o,
|
||||||
|
downloadResult->inMemoryDownload);
|
||||||
} else {
|
} else {
|
||||||
if(downloadResult->numUri == 0) {
|
o << downloadResult->uri;
|
||||||
writeFilePath(fileEntries.begin(), fileEntries.end(), o);
|
if(downloadResult->numUri > 1) {
|
||||||
} else {
|
o << " (" << downloadResult->numUri-1 << "more)";
|
||||||
o << downloadResult->uri;
|
|
||||||
if(downloadResult->numUri > 1) {
|
|
||||||
o << " (" << downloadResult->numUri-1 << "more)";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return o.str();
|
return o.str();
|
||||||
|
|
Loading…
Reference in New Issue