X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2FFileDownloader.py;fp=youtube_dl%2FFileDownloader.py;h=4f6a238351523448b70b6927077809b636672e84;hb=6d38616e67ff9859bce2a7bea2ec4a844530eb71;hp=ab06533c0c023907c05554613ecd5f934334f329;hpb=968b5e0112a83f2a4637226d4d743b394ebed038;p=youtube-dl diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index ab06533c0..4f6a23835 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -79,9 +79,13 @@ class FileDownloader(object): rate = float(current) / dif eta = int((float(total) - float(current)) / rate) (eta_mins, eta_secs) = divmod(eta, 60) - if eta_mins > 99: - return '--:--' - return '%02d:%02d' % (eta_mins, eta_secs) + (eta_hours, eta_mins) = divmod(eta_mins, 60) + if eta_hours > 99: + return '--:--:--' + if eta_hours == 0: + return '%02d:%02d' % (eta_mins, eta_secs) + else: + return '%02d:%02d:%02d' % (eta_hours, eta_mins, eta_secs) @staticmethod def calc_speed(start, now, bytes): @@ -235,7 +239,7 @@ class FileDownloader(object): if self.params.get('noprogress', False): self.to_screen(u'[download] Download completed') else: - clear_line = (u'\x1b[K' if sys.stderr.isatty() and os.name != 'nt' else u'') + clear_line = (u'\x1b[K' if sys.stderr.isatty() and os.name != 'nt' else u'') self.to_screen(u'\r%s[download] 100%% of %s in %ss' % (clear_line, data_len_str, int(tot_time)))