aboutsummaryrefslogtreecommitdiff
path: root/www/youtube_dl/files/ffmpeg.patch
diff options
context:
space:
mode:
Diffstat (limited to 'www/youtube_dl/files/ffmpeg.patch')
-rw-r--r--www/youtube_dl/files/ffmpeg.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/www/youtube_dl/files/ffmpeg.patch b/www/youtube_dl/files/ffmpeg.patch
new file mode 100644
index 000000000000..ff4edbedf6e9
--- /dev/null
+++ b/www/youtube_dl/files/ffmpeg.patch
@@ -0,0 +1,59 @@
+--- youtube-dl.orig Sat Jan 20 02:44:25 2007
++++ youtube-dl Sat Jan 20 23:53:11 2007
+@@ -167,6 +167,7 @@
+ cmdl_parser.add_option('-s', '--simulate', action='store_true', dest='simulate', help='do not download video')
+ cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name')
+ cmdl_parser.add_option('-n', '--netrc', action='store_true', dest='use_netrc', help='use .netrc authentication data')
++cmdl_parser.add_option('-a', '--avi', action='store_true', dest='use_avi', help='output file in avi format')
+ (cmdl_opts, cmdl_args) = cmdl_parser.parse_args()
+
+ # Get video URL
+@@ -232,19 +233,30 @@
+
+ # Get output file name
+ if cmdl_opts.outfile is None:
+- video_filename = '%s.flv' % video_url_id
++ if cmdl_opts.use_avi:
++ ext = 'avi'
++ else:
++ ext='flv'
++ video_filename = '%s.%s' % (video_url_id,ext)
+ else:
+ video_filename = cmdl_opts.outfile
+
+ # Check name
+-if not video_filename.lower().endswith('.flv'):
+- sys.stderr.write('Warning: video file name does not end in .flv\n')
++if cmdl_opts.use_avi:
++ if not video_filename.lower().endswith('.avi'):
++ sys.stderr.write('Warning: video file name does not end in .avi\n')
++else:
++ if not video_filename.lower().endswith('.flv'):
++ sys.stderr.write('Warning: video file name does not end in .flv\n')
+
+ # Test writable file
+ if not cmdl_opts.simulate:
+ try:
+- disk_test = open(video_filename, 'wb')
+- disk_test.close()
++ if cmdl_opts.use_avi:
++ video_file = os.popen('ffmpeg -y -i - "%s" > %s 2> %s' % (video_filename, os.path.devnull, os.path.devnull), 'wb')
++ else:
++ disk_test = open(video_filename, 'wb')
++ disk_test.close()
+
+ except (OSError, IOError):
+ sys.exit('Error: unable to open %s for writing.' % video_filename)
+@@ -317,7 +329,11 @@
+ # Rename video file if needed
+ if cmdl_opts.use_title:
+ try:
+- final_filename = '%s-%s.flv' % (title_string_norm(video_title), video_url_id)
++ if cmdl_opts.use_avi:
++ ext = 'avi'
++ else:
++ ext = 'flv'
++ final_filename = '%s-%s.%s' % (title_string_norm(video_title), video_url_id, ext)
+ os.rename(video_filename, final_filename)
+ cond_print('Video file renamed to %s\n' % final_filename)
+