Merge remote-tracking branch 'jaimeMF/split-downloaders'
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 23 Dec 2013 04:03:32 +0000 (05:03 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 23 Dec 2013 04:03:32 +0000 (05:03 +0100)
1  2 
youtube_dl/YoutubeDL.py

index e705c410b6451c983cfc43928af584025581dfa3,414aa5a80cb575642ee4ff20e393c7c96afb4e14..04771c6372dbeb4463af5d87cf3775a39324334a
@@@ -248,16 -228,19 +246,20 @@@ class YoutubeDL(object)
          self._pps.append(pp)
          pp.set_downloader(self)
  
+     def add_downloader_progress_hook(self, ph):
+         """Add the progress hook to the file downloader"""
+         self._fd_progress_hooks.append(ph)
      def _bidi_workaround(self, message):
 -        if not hasattr(self, '_fribidi_channel'):
 +        if not hasattr(self, '_output_channel'):
              return message
  
 +        assert hasattr(self, '_output_process')
          assert type(message) == type(u'')
          line_count = message.count(u'\n') + 1
 -        self._fribidi.stdin.write((message + u'\n').encode('utf-8'))
 -        self._fribidi.stdin.flush()
 -        res = u''.join(self._fribidi_channel.readline().decode('utf-8')
 +        self._output_process.stdin.write((message + u'\n').encode('utf-8'))
 +        self._output_process.stdin.flush()
 +        res = u''.join(self._output_channel.readline().decode('utf-8')
                         for _ in range(line_count))
          return res[:-len(u'\n')]