uskudnik / amazon-glacier-cmd-interface

Command line interface for Amazon Glacier
MIT License
375 stars 103 forks source link

[PATCH] Add date to upload/download ETA #124

Closed ppinter1 closed 11 years ago

ppinter1 commented 11 years ago

A trivial patch to add the date to the ETA an upload or download is anticipated to complete. Useful when large archives take days to finish, as with relatively slow DSL connections.

diff --git a/glacier/GlacierWrapper.py b/glacier/GlacierWrapper.py
index ec142f3..212076f 100755
--- a/glacier/GlacierWrapper.py
+++ b/glacier/GlacierWrapper.py
@@ -1164,12 +1164,12 @@ using %s MB parts to upload." % part_size)
                 # Estimate finish time, based on overall transfer rate.
                 if overall_rate > 0:
                     time_left = (total_size - writer.uploaded_size)/overall_rate
-                    eta = time.strftime("%H:%M:%S", time.localtime(current_time + time_left))
+                    eta = time.strftime("%a %b %d %H:%M:%S", time.localtime(current_time + time_left))
                 else:
                     time_left = "Unknown"
                     eta = "Unknown"

-                msg = 'Wrote %s of %s (%s%%). Rate %s/s, average %s/s, eta %s.' \
+                msg = 'Wrote %s of %s (%s%%). Rate %s/s, average %s/s, ETA %s.' \
                       % (self._size_fmt(writer.uploaded_size),
                          self._size_fmt(total_size),
                          self._bold(str(int(100 * writer.uploaded_size/total_size))),
@@ -1391,8 +1391,8 @@ your archive ID is correct, and start a retrieval job using \

             # Estimate finish time, based on overall transfer rate.
             time_left = (total_size - downloaded_size)/overall_rate
-            eta = time.strftime("%H:%M:%S", time.localtime(current_time + time_left))
-            msg = 'Read %s of %s (%s%%). Rate %s/s, average %s/s, eta %s.' \
+            eta = time.strftime("%a %b %d %H:%M:%S", time.localtime(current_time + time_left))
+            msg = 'Read %s of %s (%s%%). Rate %s/s, average %s/s, ETA %s.' \
                   % (self._size_fmt(downloaded_size),
                      self._size_fmt(total_size),
                      self._bold(str(int(100 * downloaded_size/total_size))),
uskudnik commented 11 years ago

Thank you, also added that we only show day ETA if day ETA is in next day: https://github.com/uskudnik/amazon-glacier-cmd-interface/commit/833d567bb15683e2306d9076147ddeffcb2a3392