[youtube:playlist] Recognize mix ids for direct use (fixes #1295)
[youtube-dl] / youtube_dl / __init__.py
index 32490b24eecd78f9f6f4a50652b06c7f0568b0ea..d2446b6706a6eb239cf52a00fb775ef0eb9cac9f 100644 (file)
@@ -81,13 +81,15 @@ from .PostProcessor import (
 
 
 def parseOpts(overrideArguments=None):
-    def _readOptions(filename_bytes, def=[]):
+    def _readOptions(filename_bytes, default=[]):
         try:
             optionf = open(filename_bytes)
         except IOError:
-            return def  # silently skip if file is not present
+            return default  # silently skip if file is not present
         try:
-            res = [shlex.split(l, comments=True) for l in optionf]
+            res = []
+            for l in optionf:
+                res += shlex.split(l, comments=True)
         finally:
             optionf.close()
         return res
@@ -189,7 +191,9 @@ def parseOpts(overrideArguments=None):
     general.add_option('--extractor-descriptions',
             action='store_true', dest='list_extractor_descriptions',
             help='Output descriptions of all supported extractors', default=False)
-    general.add_option('--proxy', dest='proxy', default=None, help='Use the specified HTTP/HTTPS proxy', metavar='URL')
+    general.add_option(
+        '--proxy', dest='proxy', default=None, metavar='URL',
+        help='Use the specified HTTP/HTTPS proxy. Pass in an empty string (--proxy "") for direct connection')
     general.add_option('--no-check-certificate', action='store_true', dest='no_check_certificate', default=False, help='Suppress HTTPS certificate validation.')
     general.add_option(
         '--cache-dir', dest='cachedir', default=get_cachedir(), metavar='DIR',
@@ -435,12 +439,20 @@ def parseOpts(overrideArguments=None):
             if appdata_dir:
                 userConf = _readOptions(
                     os.path.join(appdata_dir, 'youtube-dl', 'config'),
-                    def=None)
+                    default=None)
+                if userConf is None:
+                    userConf = _readOptions(
+                        os.path.join(appdata_dir, 'youtube-dl', 'config.txt'),
+                        default=None)
 
         if userConf is None:
-            userConfFile = _readOptions(
+            userConf = _readOptions(
                 os.path.join(os.path.expanduser('~'), 'youtube-dl.conf'),
-                def=None)
+                default=None)
+        if userConf is None:
+            userConf = _readOptions(
+                os.path.join(os.path.expanduser('~'), 'youtube-dl.conf.txt'),
+                default=None)
 
         if userConf is None:
             userConf = []