Lines 1-34
Link Here
|
1 |
--- youtube-dl.orig 2008-06-09 09:36:33.000000000 +0400 |
1 |
--- youtube-dl-orig 2008-07-24 08:17:26.000000000 +0400 |
2 |
+++ youtube-dl 2008-06-09 09:43:10.000000000 +0400 |
2 |
+++ youtube-dl 2008-07-24 08:19:28.000000000 +0400 |
3 |
@@ -216,6 +216,7 @@ |
3 |
@@ -264,6 +264,22 @@ |
4 |
cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name') |
4 |
except (urllib2.URLError, httplib.HTTPException, socket.error), err: |
5 |
cmdl_parser.add_option('-l', '--literal', action='store_true', dest='use_literal', help='use literal title in file name') |
5 |
retcode = self.trouble('ERROR: unable to download video data: %s' % str(err)) |
6 |
cmdl_parser.add_option('-n', '--netrc', action='store_true', dest='use_netrc', help='use .netrc authentication data') |
6 |
continue |
7 |
+cmdl_parser.add_option('-a', '--avi', action='store_true', dest='use_avi', help='convert file to MPEG4 format') |
|
|
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') |
10 |
cmdl_parser.add_option('-f', '--format', dest='video_format', metavar='FORMAT', help='append &fmt=FORMAT to the URL') |
11 |
@@ -420,6 +421,22 @@ |
12 |
|
13 |
except KeyboardInterrupt: |
14 |
sys.exit('\n') |
15 |
- |
16 |
+ |
7 |
+ |
17 |
+ # Convert to avi if needed |
8 |
+ # Convert to avi if needed |
18 |
+ avi_filename = '%s.avi' % video_filename |
9 |
+ if self._params['useavi']: |
|
|
10 |
+ avi_filename = '%s.avi' % filename |
19 |
+ |
11 |
+ |
20 |
+ try: |
12 |
+ try: |
21 |
+ os.system('%%CONV2AVI_CMD%% "%s" "%s" > %s 2> %s' % (video_filename, avi_filename, os.path.devnull, os.path.devnull)) |
13 |
+ os.system('%%CONV2AVI_CMD%% "%s" "%s" > %s 2> %s' % (filename, avi_filename, os.path.devnull, os.path.devnull)) |
22 |
+ cond_print('Video file converted to %s\n' % avi_filename) |
14 |
+ self.to_stdout('Video file converted to %s' % avi_filename) |
23 |
+ except OSError: |
15 |
+ except OSError, e: |
24 |
+ sys.exit('Error: unable to convert file.\n') |
16 |
+ retcode = self.trouble('ERROR: unable to convert file: %s' % e.strerror) |
25 |
+ except KeyboardInterrupt: |
|
|
26 |
+ sys.exit('\n') |
27 |
+ |
17 |
+ |
28 |
+ try: |
18 |
+ try: |
29 |
+ os.unlink(video_filename) |
19 |
+ os.unlink(filename) |
30 |
+ except OSError: |
20 |
+ except OSError, e: |
31 |
+ sys.exit('Error: unable to remove downloaded file.\n') |
21 |
+ retcode = self.trouble('ERROR: unable to remove downloaded file: %s' % e.strerror) |
32 |
+ |
22 |
+ |
33 |
# Finish |
23 |
break |
34 |
sys.exit() |
24 |
if not suitable_found: |
|
|
25 |
retcode = self.trouble('ERROR: no suitable InfoExtractor: %s' % url) |
26 |
@@ -563,6 +579,8 @@ |
27 |
action='store_true', dest='useliteral', help='use literal title in file name', default=False) |
28 |
parser.add_option('-n', '--netrc', |
29 |
action='store_true', dest='usenetrc', help='use .netrc authentication data', default=False) |
30 |
+ parser.add_option('-a', '--avi', |
31 |
+ action='store_true', dest='useavi', help='convert file to MPEG4 format', default=False) |
32 |
parser.add_option('-g', '--get-url', |
33 |
action='store_true', dest='geturl', help='simulate, quiet but print URL', default=False) |
34 |
parser.add_option('-e', '--get-title', |
35 |
@@ -609,6 +627,7 @@ |
36 |
or (opts.useliteral and '%(title)s-%(id)s.%(ext)s') |
37 |
or '%(id)s.%(ext)s'), |
38 |
'ignoreerrors': opts.ignoreerrors, |
39 |
+ 'useavi': opts.useavi, |
40 |
}) |
41 |
fd.add_info_extractor(youtube_ie) |
42 |
retcode = fd.download(args) |