corrected words
@@ -42,7 +42,6 @@ DOWNLOAD_DELEGATE_MAP = {
'transmission-rpc': __transmission__,
}
-
if not os.environ.get('BGMI_PATH'):
if platform.system() == 'Windows':
BGMI_PATH = os.path.join(os.environ.get('USERPROFILE', None), '.bgmi')
@@ -53,7 +52,6 @@ if not os.environ.get('BGMI_PATH'):
else:
BGMI_PATH = os.environ.get('BGMI_PATH')
-
DB_PATH = os.path.join(BGMI_PATH, 'bangumi.db')
CONFIG_FILE_PATH = os.path.join(BGMI_PATH, 'bgmi.cfg')
@@ -73,7 +71,7 @@ def read_config():
if c.has_option('bgmi', i):
globals().update({i: c.get('bgmi', i)})
- for i in DOWNLOAD_DELEGATE_MAP.get(DOWNLOAD_DELEGATE):
+ for i in DOWNLOAD_DELEGATE_MAP.get(DOWNLOAD_DELEGATE, []):
if c.has_option(DOWNLOAD_DELEGATE, i):
globals().update({i: c.get(DOWNLOAD_DELEGATE, i)})
@@ -90,7 +88,7 @@ def print_config():
string += '{0}={1}\n'.format(i, c.get('bgmi', i))
string += '\n[{0}]\n'.format(DOWNLOAD_DELEGATE)
- for i in DOWNLOAD_DELEGATE_MAP.get(DOWNLOAD_DELEGATE):
+ for i in DOWNLOAD_DELEGATE_MAP.get(DOWNLOAD_DELEGATE, []):
string += '{0}={1}\n'.format(i, c.get(DOWNLOAD_DELEGATE, i))
return string
@@ -115,7 +113,7 @@ def write_default_config():
if not c.has_section(DOWNLOAD_DELEGATE):
c.add_section(DOWNLOAD_DELEGATE)
- for k in DOWNLOAD_DELEGATE_MAP.get(DOWNLOAD_DELEGATE):
+ for k in DOWNLOAD_DELEGATE_MAP.get(DOWNLOAD_DELEGATE, []):
v = globals().get(k, None)
c.set(DOWNLOAD_DELEGATE, k, v)
@@ -164,7 +162,7 @@ def write_config(config=None, value=None):
if config == 'DOWNLOAD_DELEGATE':
if not c.has_section(DOWNLOAD_DELEGATE):
c.add_section(DOWNLOAD_DELEGATE)
- for i in DOWNLOAD_DELEGATE_MAP.get(DOWNLOAD_DELEGATE):
+ for i in DOWNLOAD_DELEGATE_MAP[DOWNLOAD_DELEGATE]:
v = globals().get(i, '')
c.set(DOWNLOAD_DELEGATE, i, v)
@@ -185,7 +183,7 @@ def write_config(config=None, value=None):
except configparser.NoOptionError:
write_default_config()
- result = {'status': 'error', 'message': 'Error in config file, write default config'}
+ result = {'status': 'error', 'message': 'Error in config file, adding missing options'}
result['data'] = [{'writable': True, 'name': x, 'value': globals()[x]} for x in __writeable__] + \
[{'writable': False, 'name': x, 'value': globals()[x]} for x in __readonly__]
