mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-10 00:58:17 +02:00
Merge pull request #1181 from h3xx/master
Add some verbosity when reporting finished downloads Remove the mixed use of tabs and spaces for indentation.
This commit is contained in:
commit
6d38616e67
@ -234,12 +234,14 @@ def report_unable_to_resume(self):
|
|||||||
"""Report it was impossible to resume download."""
|
"""Report it was impossible to resume download."""
|
||||||
self.to_screen(u'[download] Unable to resume')
|
self.to_screen(u'[download] Unable to resume')
|
||||||
|
|
||||||
def report_finish(self):
|
def report_finish(self, data_len_str, tot_time):
|
||||||
"""Report download finished."""
|
"""Report download finished."""
|
||||||
if self.params.get('noprogress', False):
|
if self.params.get('noprogress', False):
|
||||||
self.to_screen(u'[download] Download completed')
|
self.to_screen(u'[download] Download completed')
|
||||||
else:
|
else:
|
||||||
self.to_screen(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)))
|
||||||
|
|
||||||
def _download_with_rtmpdump(self, filename, url, player_url, page_url, play_path, tc_url):
|
def _download_with_rtmpdump(self, filename, url, player_url, page_url, play_path, tc_url):
|
||||||
self.report_destination(filename)
|
self.report_destination(filename)
|
||||||
@ -542,7 +544,7 @@ def _do_download(self, filename, info_dict):
|
|||||||
self.report_error(u'Did not get any data blocks')
|
self.report_error(u'Did not get any data blocks')
|
||||||
return False
|
return False
|
||||||
stream.close()
|
stream.close()
|
||||||
self.report_finish()
|
self.report_finish(data_len_str, (time.time() - start))
|
||||||
if data_len is not None and byte_counter != data_len:
|
if data_len is not None and byte_counter != data_len:
|
||||||
raise ContentTooShortError(byte_counter, int(data_len))
|
raise ContentTooShortError(byte_counter, int(data_len))
|
||||||
self.try_rename(tmpfilename, filename)
|
self.try_rename(tmpfilename, filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user