Merge pull request #730 by @JohnyMoSwag
[youtube-dl] / youtube_dl / __init__.py
index e5a7469af25b08f688d43ffae6e0d0db216291c0..807b735412a674bb4d2098a2a057c0e91266ad68 100644 (file)
@@ -126,7 +126,7 @@ def parseOpts():
     general.add_option('-i', '--ignore-errors',
             action='store_true', dest='ignoreerrors', help='continue on download errors', default=False)
     general.add_option('-r', '--rate-limit',
-            dest='ratelimit', metavar='LIMIT', help='download rate limit (e.g. 50k or 44.6m)')
+            dest='ratelimit', metavar='LIMIT', help='maximum download rate (e.g. 50k or 44.6m)')
     general.add_option('-R', '--retries',
             dest='retries', metavar='RETRIES', help='number of retries (default is %default)', default=10)
     general.add_option('--buffer-size',
@@ -173,7 +173,7 @@ def parseOpts():
             action='store', dest='format_limit', metavar='FORMAT', help='highest quality format to download')
     video_format.add_option('-F', '--list-formats',
             action='store_true', dest='listformats', help='list all available formats (currently youtube only)')
-    video_format.add_option('--write-sub',
+    video_format.add_option('--write-sub', '--write-srt',
             action='store_true', dest='writesubtitles',
             help='write subtitle file (currently youtube only)', default=False)
     video_format.add_option('--only-sub',
@@ -188,7 +188,7 @@ def parseOpts():
     video_format.add_option('--sub-format',
             action='store', dest='subtitlesformat', metavar='LANG',
             help='subtitle format [srt/sbv] (default=srt) (currently youtube only)', default='srt')
-    video_format.add_option('--sub-lang',
+    video_format.add_option('--sub-lang', '--srt-lang',
             action='store', dest='subtitleslang', metavar='LANG',
             help='language of the subtitles to download (optional) use IETF language tags like \'en\'')
 
@@ -286,12 +286,20 @@ def parseOpts():
 
     xdg_config_home = os.environ.get('XDG_CONFIG_HOME')
     if xdg_config_home:
-        userConf = os.path.join(xdg_config_home, 'youtube-dl.conf')
+        userConfFile = os.path.join(xdg_config_home, 'youtube-dl.conf')
     else:
-        userConf = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl.conf')
-    argv = _readOptions('/etc/youtube-dl.conf') + _readOptions(userConf) + sys.argv[1:]
+        userConfFile = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl.conf')
+    systemConf = _readOptions('/etc/youtube-dl.conf')
+    userConf = _readOptions(userConfFile)
+    commandLineConf = sys.argv[1:]
+    argv = systemConf + userConf + commandLineConf
     opts, args = parser.parse_args(argv)
 
+    if opts.verbose:
+        print(u'[debug] System config: ' + repr(systemConf))
+        print(u'[debug] User config: ' + repr(userConf))
+        print(u'[debug] Command-line args: ' + repr(commandLineConf))
+
     return parser, opts, args
 
 def _real_main():