Commits

Travis Shirk committed 64fd4f9

Added --no-config and default config name change.

Comments (0)

Files changed (5)

 .coverage
 src/eyed3/info.py
 tags
-allmusic-regtest
 src/test/data
+
+[default]
+
+# Default plugin to use.
+plugin = 
+
+# General options to always use. These can be plugin specific but SHOULD NOT be
+# A -C/--config and -P/--plugin options are ignored.
+options = --pdb
+
+# Extra directories to load plugins. Separated by ':'
+plugin_path = ${HOME}/.eyeD3/plugins
+
+
+# vim: set filetype=dosini:

etc/eyeD3rc

-
-[default]
-
-# Default plugin to use.
-plugin = 
-
-# General options to always use. These can be plugin specific but SHOULD NOT be
-# A -C/--config and -P/--plugin options are ignored.
-options = -Q --pdb -l debug
-
-# Extra directories to load plugins. Separated by ':'
-plugin_path = ~/.eyeD3:${HOME}/.eyeD3/plugins
-
-
-# vim: set filetype=dosini:

src/eyed3/info.py.in

 %s
 """ % (VERSION, RELEASE, AUTHOR, URL)
 
-USER_CONFIG = os.path.expandvars(os.path.join("${HOME}", ".eyeD3rc"))
+USER_CONFIG = os.path.expandvars("${HOME}/eyeD3/config.ini")
 
 LICENCE = """
 		    GNU GENERAL PUBLIC LICENSE

src/eyed3/main.py

         print("")
 
 
-def _loadConfig(config_file=None):
+def _loadConfig(args):
     import os
     import ConfigParser
 
     config = None
-    if config_file:
+    config_file = None
+
+    if args.config:
         config_file = os.path.abspath(config_file)
-    else:
+    elif args.no_config == False:
         config_file = DEFAULT_CONFIG
 
+    if not config_file:
+        return None
+
     if os.path.isfile(config_file):
         try:
             config = ConfigParser.SafeConfigParser()
                             "but this option is still useful when reading "
                             "from mounted file systems." %
                             eyed3.LOCAL_FS_ENCODING)
+        p.add_argument("--no-config", action="store_true", dest="no_config",
+                       help="Do not load the default user config '%s'. "
+                            "The -c/--config options are still honored if "
+                            "present." % DEFAULT_CONFIG)
+
         # Debugging options
         group = p.debug_arg_group
         group.add_argument("--profile", action="store_true", default=False,
         if auto_append:
             stage_one_args.append(opt)
             auto_append = False
-        if opt in ("-C", "--config", "-P", "--plugin"):
+
+        if opt in ("-C", "--config", "-P", "--plugin", "--no-config"):
             stage_one_args.append(opt)
-            auto_append = True
+            if opt != "--no-config":
+                auto_append = True
         elif (opt.startswith("-C=") or opt.startswith("--config=") or
                 opt.startswith("-P=") or opt.startswith("--plugin=")):
             stage_one_args.append(opt)
     parser = makeParser()
     args = parser.parse_args(stage_one_args)
 
-    config = _loadConfig(args.config)
+    config = _loadConfig(args)
 
     if args.plugin:
         # Plugin on the command line takes precedence over config.