DailymotionIE: There is not necessarily an underscore in a Dailymotion URL.
[youtube-dl] / youtube_dl / PostProcessor.py
index b4262f9e4f18f84466f51c8fe8108a60fa6b34b4..375da1aa3f08cf0fb9d9886ee1b6d4308d18c763 100644 (file)
@@ -142,14 +142,20 @@ class FFmpegExtractAudioPP(PostProcessor):
                                extension = 'mp3'
                                more_opts = []
                                if self._preferredquality is not None:
-                                       more_opts += [self._exes['avconv'] and '-b:a' or '-ab', self._preferredquality]
+                                       if int(self._preferredquality) < 10:
+                                               more_opts += [self._exes['avconv'] and '-q:a' or '-aq', self._preferredquality]
+                                       else:
+                                               more_opts += [self._exes['avconv'] and '-b:a' or '-ab', self._preferredquality]
                else:
                        # We convert the audio (lossy)
                        acodec = {'mp3': 'libmp3lame', 'aac': 'aac', 'm4a': 'aac', 'vorbis': 'libvorbis', 'wav': None}[self._preferredcodec]
                        extension = self._preferredcodec
                        more_opts = []
                        if self._preferredquality is not None:
-                               more_opts += [self._exes['avconv'] and '-b:a' or '-ab', self._preferredquality]
+                               if int(self._preferredquality) < 10:
+                                       more_opts += [self._exes['avconv'] and '-q:a' or '-aq', self._preferredquality]
+                               else:
+                                       more_opts += [self._exes['avconv'] and '-b:a' or '-ab', self._preferredquality]
                        if self._preferredcodec == 'aac':
                                more_opts += ['-f', 'adts']
                        if self._preferredcodec == 'm4a':
@@ -162,7 +168,7 @@ class FFmpegExtractAudioPP(PostProcessor):
 
                prefix, sep, ext = path.rpartition(u'.') # not os.path.splitext, since the latter does not work on unicode in all setups
                new_path = prefix + sep + extension
-               self._downloader.to_screen(u'[' + self._exes['avconv'] and 'avconv' or 'ffmpeg' + '] Destination: ' + new_path)
+               self._downloader.to_screen(u'[' + (self._exes['avconv'] and 'avconv' or 'ffmpeg') + '] Destination: ' + new_path)
                try:
                        self.run_ffmpeg(path, new_path, acodec, more_opts)
                except:
@@ -170,7 +176,7 @@ class FFmpegExtractAudioPP(PostProcessor):
                        if isinstance(e, AudioConversionError):
                                self._downloader.to_stderr(u'ERROR: audio conversion failed: ' + e.message)
                        else:
-                               self._downloader.to_stderr(u'ERROR: error running ' + self._exes['avconv'] and 'avconv' or 'ffmpeg')
+                               self._downloader.to_stderr(u'ERROR: error running ' + (self._exes['avconv'] and 'avconv' or 'ffmpeg'))
                        return None
 
                # Try to update the date time for extracted audio file.