tag 632922 patch thanks On Wed, Jul 06, 2011 at 11:28:50PM -0300, Rogério Brito wrote: > Hi, Matt. > > 2011/7/6 Matt Kraai <kr...@ftbfs.org>: > > On Wed, Jul 06, 2011 at 11:20:57PM -0300, Rogério Brito wrote: > >> Yes, the fix is probably simple, depending on how ffprobe/ffmpeg > >> parses the command line (with -- or prefixing the filename with ./). > > > > I'm currently testing the attached fix.
And it doesn't work. The path to the file generated by ffmpeg also needs to be escaped. I verified that the attached patch does work. > Oh, great. I think that the ./ is indeed the most robust option anyway... :-) > > I will push that patch upstream, if you license it under the public domain. I'm happy to license the patch under the public domain. Is this email sufficient? -- Matt Kraai https://ftbfs.org/kraai
Index: youtube-dl-2011.02.25b/youtube-dl =================================================================== --- youtube-dl-2011.02.25b.orig/youtube-dl 2011-07-06 19:44:29.000000000 -0700 +++ youtube-dl-2011.02.25b/youtube-dl 2011-07-06 20:09:01.000000000 -0700 @@ -2618,9 +2618,15 @@ self._preferredcodec = preferredcodec @staticmethod + def safe_path(path): + if path.startswith('-'): + return os.path.join('.', path) + return path + + @staticmethod def get_audio_codec(path): try: - handle = subprocess.Popen(['ffprobe', '-show_streams', path], + handle = subprocess.Popen(['ffprobe', '-show_streams', FFmpegExtractAudioPP.safe_path(path)], stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE) output = handle.communicate()[0] if handle.wait() != 0: @@ -2638,7 +2644,7 @@ @staticmethod def run_ffmpeg(path, out_path, codec, more_opts): try: - ret = subprocess.call(['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + [out_path], + ret = subprocess.call(['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + [FFmpegExtractAudioPP.safe_path(out_path)], stdout=file(os.path.devnull, 'w'), stderr=subprocess.STDOUT) return (ret == 0) except (IOError, OSError):