1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-05-11 16:17:31 +00:00

Merge 005e092ffbb1e171d2c3386746b52b881e891405 into 33d507f1fe828b186dec9b61ff4fc6b5fdcf42b2

This commit is contained in:
GitHub Merge Button 2011-09-10 01:46:04 -07:00
commit de577d5943

View File

@ -30,6 +30,7 @@ import time
import urllib
import urllib2
import zlib
from mutagen.mp3 import EasyMP3 as MP3
# parse_qs was moved from the cgi module to the urlparse module recently.
try:
@ -1121,6 +1122,12 @@ class YoutubeIE(InfoExtractor):
# Find the video URL in fmt_url_map or conn paramters
try:
# Process video information
global videotitle
videotitle=video_title
global simpletitle
simpletitle=simple_title
self._downloader.process_info({
'id': video_id.decode('utf-8'),
'url': video_real_url.decode('utf-8'),
@ -2642,6 +2649,10 @@ class FFmpegExtractAudioPP(PostProcessor):
try:
cmd = ['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + ['--', out_path]
ret = subprocess.call(cmd, stdout=file(os.path.devnull, 'w'), stderr=subprocess.STDOUT)
audio = MP3(out_path)
audio["title"] = videotitle
audio.save()
return (ret == 0)
except (IOError, OSError):
return False
@ -2657,6 +2668,7 @@ class FFmpegExtractAudioPP(PostProcessor):
more_opts = []
if self._preferredcodec == 'best' or self._preferredcodec == filecodec:
if filecodec == 'aac' or filecodec == 'mp3':
print "Entrando a run21"
# Lossless if possible
acodec = 'copy'
extension = filecodec
@ -2676,10 +2688,11 @@ class FFmpegExtractAudioPP(PostProcessor):
more_opts += ['-f', 'adts']
(prefix, ext) = os.path.splitext(path)
new_path = prefix + '.' + extension
new_path = simpletitle + '.' + extension
self._downloader.to_screen(u'[ffmpeg] Destination: %s' % new_path)
status = self.run_ffmpeg(path, new_path, acodec, more_opts)
if not status:
self._downloader.to_stderr(u'WARNING: error running ffmpeg')
return None