Lines 1-14
Link Here
|
1 |
--- youtube-dl.orig Wed Mar 28 22:12:49 2007 |
1 |
--- youtube-dl.orig 2008-01-24 18:13:29.000000000 +0100 |
2 |
+++ youtube-dl Wed Mar 28 22:11:38 2007 |
2 |
+++ youtube-dl 2008-01-26 02:40:32.000000000 +0100 |
3 |
@@ -203,6 +203,7 @@ |
3 |
@@ -208,6 +208,7 @@ |
4 |
cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name') |
4 |
cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name') |
5 |
cmdl_parser.add_option('-l', '--literal', action='store_true', dest='use_literal', help='use literal title in file name') |
5 |
cmdl_parser.add_option('-l', '--literal', action='store_true', dest='use_literal', help='use literal title in file name') |
6 |
cmdl_parser.add_option('-n', '--netrc', action='store_true', dest='use_netrc', help='use .netrc authentication data') |
6 |
cmdl_parser.add_option('-n', '--netrc', action='store_true', dest='use_netrc', help='use .netrc authentication data') |
7 |
+cmdl_parser.add_option('-a', '--avi', action='store_true', dest='use_avi', help='output file in avi format') |
7 |
+cmdl_parser.add_option('-a', '--avi', action='store_true', dest='use_avi', help='output file in avi format') |
8 |
cmdl_parser.add_option('-g', '--get-url', action='store_true', dest='get_url', help='print final video URL only') |
8 |
cmdl_parser.add_option('-g', '--get-url', action='store_true', dest='get_url', help='print final video URL only') |
|
|
9 |
cmdl_parser.add_option('-2', '--title-too', action='store_true', dest='get_title', help='used with -g, print title too') |
9 |
(cmdl_opts, cmdl_args) = cmdl_parser.parse_args() |
10 |
(cmdl_opts, cmdl_args) = cmdl_parser.parse_args() |
10 |
|
11 |
@@ -276,7 +277,11 @@ |
11 |
@@ -275,13 +276,21 @@ |
|
|
12 |
|
12 |
|
13 |
# Get output file name |
13 |
# Get output file name |
14 |
if cmdl_opts.outfile is None: |
14 |
if cmdl_opts.outfile is None: |
Lines 21-26
Link Here
|
21 |
else: |
21 |
else: |
22 |
video_filename = cmdl_opts.outfile |
22 |
video_filename = cmdl_opts.outfile |
23 |
|
23 |
|
|
|
24 |
@@ -311,11 +316,19 @@ |
25 |
prefix = title_string_norm(video_title) |
26 |
else: |
27 |
prefix = title_string_touch(video_title) |
28 |
- video_filename = '%s-%s.flv' % (prefix, video_url_id) |
29 |
+ if cmdl_opts.use_avi: |
30 |
+ ext = 'avi' |
31 |
+ else: |
32 |
+ ext = 'flv' |
33 |
+ video_filename = '%s-%s.%s' % (prefix, video_url_id, ext) |
34 |
|
24 |
# Check name |
35 |
# Check name |
25 |
-if not video_filename.lower().endswith('.flv'): |
36 |
-if not video_filename.lower().endswith('.flv'): |
26 |
- sys.stderr.write('Warning: video file name does not end in .flv\n') |
37 |
- sys.stderr.write('Warning: video file name does not end in .flv\n') |
Lines 31-60
Link Here
|
31 |
+ if not video_filename.lower().endswith('.flv'): |
42 |
+ if not video_filename.lower().endswith('.flv'): |
32 |
+ sys.stderr.write('Warning: video file name does not end in .flv\n') |
43 |
+ sys.stderr.write('Warning: video file name does not end in .flv\n') |
33 |
|
44 |
|
34 |
# Test writable file |
45 |
# Retrieve video data |
35 |
if not (cmdl_opts.simulate or cmdl_opts.get_url): |
46 |
try: |
36 |
@@ -328,7 +337,10 @@ |
47 |
@@ -334,7 +347,10 @@ |
37 |
if cmdl_opts.simulate or cmdl_opts.get_url: |
|
|
38 |
sys.exit() |
48 |
sys.exit() |
39 |
|
49 |
|
40 |
- video_file = open(video_filename, 'wb') |
|
|
41 |
+ if cmdl_opts.use_avi: |
42 |
+ video_file = os.popen('ffmpeg -y -i - "%s" > %s 2> %s' % (video_filename, os.path.devnull, os.path.devnull), 'wb') |
43 |
+ else: |
44 |
+ video_file = open(video_filename, 'wb') |
45 |
try: |
50 |
try: |
46 |
video_len = long(video_data.info()['Content-length']) |
51 |
- video_file = open(video_filename, 'wb') |
47 |
video_len_str = format_bytes(video_len) |
|
|
48 |
@@ -382,7 +394,11 @@ |
49 |
prefix = title_string_norm(video_title) |
50 |
else: |
51 |
prefix = title_string_touch(video_title) |
52 |
- final_filename = '%s-%s.flv' % (prefix, video_url_id) |
53 |
+ if cmdl_opts.use_avi: |
52 |
+ if cmdl_opts.use_avi: |
54 |
+ ext = 'avi' |
53 |
+ video_file = os.popen('ffmpeg -y -i - "%s" > %s 2> %s' % (video_filename, os.path.devnull, os.path.devnull), 'wb') |
55 |
+ else: |
54 |
+ else: |
56 |
+ ext = 'flv' |
55 |
+ video_file = open(video_filename, 'wb') |
57 |
+ final_filename = '%s-%s.%s' % (prefix, video_url_id, ext) |
56 |
except (IOError, OSError): |
58 |
os.rename(video_filename, final_filename) |
57 |
sys.exit('Error: unable to open "%s" for writing.' % video_filename) |
59 |
cond_print('Video file renamed to %s\n' % final_filename) |
58 |
try: |
60 |
|
|
|