summaryrefslogtreecommitdiff
path: root/src/FileEntry.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-08-22 23:05:06 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-08-22 23:05:06 +0900
commitf7aeb86ccc321889c0695556448c23715fe3686b (patch)
tree9b80a89bf13e10af41430aa1f85bd6c79d8f0a0f /src/FileEntry.cc
parent205afd20fdcf19784546cd49b718a69cb3d03ba2 (diff)
Added --download-result option.
Added --download-result=OPT option. This option changes the way "Download Results" is formatted. If OPT is 'default', print GID, status, average download speed and path/URI. If multiple files are involved, path/URI of first requested file is printed and remaining ones are omitted. If OPT is 'full', print GID, status, average download speed, percentage of progress and path/URI. The percentage of progress and path/URI are printed for each requested file in each row.
Diffstat (limited to 'src/FileEntry.cc')
-rw-r--r--src/FileEntry.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/FileEntry.cc b/src/FileEntry.cc
index 379be62a..7d04e2dd 100644
--- a/src/FileEntry.cc
+++ b/src/FileEntry.cc
@@ -570,4 +570,26 @@ bool FileEntry::emptyRequestUri() const
return uris_.empty() && inFlightRequests_.empty() && requestPool_.empty();
}
+void writeFilePath
+(std::ostream& o,
+ const SharedHandle<FileEntry>& entry,
+ bool memory)
+{
+ if(entry->getPath().empty()) {
+ std::vector<std::string> uris;
+ entry->getUris(uris);
+ if(uris.empty()) {
+ o << "n/a";
+ } else {
+ o << uris.front();
+ }
+ } else {
+ if(memory) {
+ o << "[MEMORY]" << File(entry->getPath()).getBasename();
+ } else {
+ o << entry->getPath();
+ }
+ }
+}
+
} // namespace aria2