X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2FYoutubeDL.py;h=f5ca33d453a89359405d468dc994337dfec7910b;hb=6db274e057873feb256568f0e27c9a03a2b8d16c;hp=dc0ba986a98744151cafd932acbcd6bbe33fb4a0;hpb=be6d722904f646e1c7f879cd32bfced22abffada;p=youtube-dl.git diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index dc0ba986a..f5ca33d45 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -993,6 +993,8 @@ class YoutubeDL(object): fd = get_suitable_downloader(info)(self, self.params) for ph in self._progress_hooks: fd.add_progress_hook(ph) + if self.params.get('verbose'): + self.to_stdout('[debug] Invoking downloader on %r' % info.get('url')) return fd.download(name, info) if info_dict.get('requested_formats') is not None: downloaded = [] @@ -1195,6 +1197,10 @@ class YoutubeDL(object): if res: res += ', ' res += format_bytes(fdict['filesize']) + elif fdict.get('filesize_approx') is not None: + if res: + res += ', ' + res += '~' + format_bytes(fdict['filesize_approx']) return res def list_formats(self, info_dict): @@ -1228,14 +1234,21 @@ class YoutubeDL(object): if not self.params.get('verbose'): return - write_string( + encoding_str = ( '[debug] Encodings: locale %s, fs %s, out %s, pref %s\n' % ( locale.getpreferredencoding(), sys.getfilesystemencoding(), sys.stdout.encoding, - self.get_encoding()), - encoding=None - ) + self.get_encoding())) + try: + write_string(encoding_str, encoding=None) + except: + errmsg = 'Failed to write encoding string %r' % encoding_str + try: + sys.stdout.write(errmsg) + except: + pass + raise IOError(errmsg) self._write_string('[debug] youtube-dl version ' + __version__ + '\n') try: