Merge branch 'master' into prefer-webm
[youtube-dl] / youtube-dl
index 9e9be67784bedcb67f77881957761922e9616e3a..af6522bacf176c3428036082223444c86864c45d 100755 (executable)
@@ -864,7 +864,7 @@ class YoutubeIE(InfoExtractor):
        _AGE_URL = 'http://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
        _NETRC_MACHINE = 'youtube'
        # Listed in order of quality
-       _available_formats = ['38', '37', '22', '45', '35', '34', '43', '18', '6', '5', '17', '13']
+       _available_formats = ['38', '37', '45', '22', '43', '35', '34', '18', '6', '5', '17', '13']
        _video_extensions = {
                '13': '3gp',
                '17': 'mp4',
@@ -2619,10 +2619,13 @@ class FFmpegExtractAudioPP(PostProcessor):
 
        @staticmethod
        def get_audio_codec(path):
-               handle = subprocess.Popen(['ffprobe', '-show_streams', path],
-                               stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)
-               output = handle.communicate()[0]
-               if handle.wait() != 0:
+               try:
+                       handle = subprocess.Popen(['ffprobe', '-show_streams', path],
+                                       stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)
+                       output = handle.communicate()[0]
+                       if handle.wait() != 0:
+                               return None
+               except (IOError, OSError):
                        return None
                audio_codec = None
                for line in output.split('\n'):
@@ -2646,7 +2649,7 @@ class FFmpegExtractAudioPP(PostProcessor):
 
                filecodec = self.get_audio_codec(path)
                if filecodec is None:
-                       self._downloader.to_stderr(u'WARNING: no audio codec found in file')
+                       self._downloader.to_stderr(u'WARNING: unable to obtain file audio codec with ffprobe')
                        return None
 
                more_opts = []
@@ -2720,7 +2723,7 @@ if __name__ == '__main__':
                # Parse command line
                parser = optparse.OptionParser(
                        usage='Usage: %prog [options] url...',
-                       version='2011.02.25',
+                       version='2011.02.25b',
                        conflict_handler='resolve',
                )