From: Philipp Hagemeister Date: Sun, 5 Jan 2014 01:06:48 +0000 (+0100) Subject: Merge remote-tracking branch 'jaimeMF/merge-formats' X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=a015dce0e243b48ca2124f82bfe40b579412484d;p=youtube-dl Merge remote-tracking branch 'jaimeMF/merge-formats' --- a015dce0e243b48ca2124f82bfe40b579412484d diff --cc youtube_dl/YoutubeDL.py index f70c356c0,8731279c1..3786799da --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@@ -880,12 -892,29 +892,29 @@@ class YoutubeDL(object) success = True else: try: - fd = get_suitable_downloader(info_dict)(self, self.params) - for ph in self._progress_hooks: - fd.add_progress_hook(ph) - success = fd.download(filename, info_dict) + def dl(name, info): + fd = get_suitable_downloader(info)(self, self.params) + for ph in self._progress_hooks: + fd.add_progress_hook(ph) + return fd.download(name, info) + if info_dict.get('requested_formats') is not None: + downloaded = [] + success = True + for f in info_dict['requested_formats']: + new_info = dict(info_dict) + new_info.update(f) + fname = self.prepare_filename(new_info) + fname = prepend_extension(fname, 'f%s' % f['format_id']) + downloaded.append(fname) + partial_success = dl(fname, new_info) + success = success and partial_success + info_dict['__postprocessors'] = [FFmpegMergerPP(self)] + info_dict['__files_to_merge'] = downloaded + else: + # Just a single file + success = dl(filename, info_dict) except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: - self.report_error(u'unable to download video data: %s' % str(err)) + self.report_error('unable to download video data: %s' % str(err)) return except (OSError, IOError) as err: raise UnavailableVideoError(err)