+ def trouble(self, message=None):
+ """Determine action to take when a download problem appears.
+
+ Depending on if the downloader has been configured to ignore
+ download errors or not, this method may throw an exception or
+ not when errors are found, after printing the message. If it
+ doesn't raise, it returns an error code suitable to be returned
+ later as a program exit code to indicate error.
+ """
+ if message is not None:
+ self.to_stderr(message)
+ if not self._params.get('ignoreerrors', False):
+ raise DownloadError(message)
+ return 1
+
+ def report_destination(self, filename):
+ """Report destination filename."""
+ self.to_stdout('[download] Destination: %s' % filename)
+
+ def report_progress(self, percent_str, data_len_str, speed_str, eta_str):
+ """Report download progress."""
+ self.to_stdout('\r[download] %s of %s at %s ETA %s' %
+ (percent_str, data_len_str, speed_str, eta_str), skip_eol=True)
+
+ def report_finish(self):
+ """Report download finished."""
+ self.to_stdout('')
+