forked from 0x2620/pandora
make it easer to copy&paste default values
This commit is contained in:
parent
8c48f652ea
commit
e216a7b307
1 changed files with 13 additions and 10 deletions
|
@ -96,11 +96,11 @@ def load_config(init=False):
|
||||||
|
|
||||||
|
|
||||||
#add missing defaults
|
#add missing defaults
|
||||||
for section in (
|
for section in sorted((
|
||||||
'capabilities', 'cantPlay', 'entities', 'itemName', 'itemTitleKeys', 'media', 'posters',
|
'capabilities', 'cantPlay', 'entities', 'itemName', 'itemTitleKeys', 'media', 'posters',
|
||||||
'site', 'tv', 'user.ui', 'user.ui.part', 'user.ui.showFolder',
|
'site', 'tv', 'user.ui', 'user.ui.part', 'user.ui.showFolder',
|
||||||
'menuExtras', 'languages'
|
'menuExtras', 'languages'
|
||||||
):
|
)):
|
||||||
parts = map(lambda p: p.replace('\0', '\\.'), section.replace('\\.', '\0').split('.'))
|
parts = map(lambda p: p.replace('\0', '\\.'), section.replace('\\.', '\0').split('.'))
|
||||||
#print 'checking', section
|
#print 'checking', section
|
||||||
c = config
|
c = config
|
||||||
|
@ -117,23 +117,26 @@ def load_config(init=False):
|
||||||
if isinstance(d, list):
|
if isinstance(d, list):
|
||||||
if not c and section not in ('entities', ):
|
if not c and section not in ('entities', ):
|
||||||
c += d
|
c += d
|
||||||
sys.stderr.write("adding default value for %s = %s\n" % (
|
sys.stderr.write("adding default value:\n\t\"%s\": %s,\n\n" % (
|
||||||
section, str(d)))
|
section, json.dumps(d)))
|
||||||
else:
|
else:
|
||||||
for key in d:
|
added = []
|
||||||
|
for key in sorted(d):
|
||||||
if key not in c:
|
if key not in c:
|
||||||
sys.stderr.write("adding default value for %s.%s = %s\n" % (
|
added.append("\"%s\": %s," % (key, json.dumps(d[key])))
|
||||||
section, key, str(d[key])))
|
|
||||||
c[key] = d[key]
|
c[key] = d[key]
|
||||||
|
if added:
|
||||||
|
sys.stderr.write("adding default %s:\n\t" % section)
|
||||||
|
sys.stderr.write("\n\t".join(added) + '\n\n')
|
||||||
for key in ('language', ):
|
for key in ('language', ):
|
||||||
if not key in config:
|
if not key in config:
|
||||||
sys.stderr.write("adding default value for %s = %s\n" % (key, default[key]))
|
sys.stderr.write("adding default value:\n\t\"%s\": %s,\n\n" % (key, json.dumps(default[key])))
|
||||||
config[key] = default[key]
|
config[key] = default[key]
|
||||||
|
|
||||||
key = get_by_id(config['itemKeys'], 'title')
|
key = get_by_id(config['itemKeys'], 'title')
|
||||||
if not 'autocompleteSort' in key:
|
if not 'autocompleteSort' in key or True:
|
||||||
key['autocompleteSort'] = get_by_id(default['itemKeys'], 'title')['autocompleteSort']
|
key['autocompleteSort'] = get_by_id(default['itemKeys'], 'title')['autocompleteSort']
|
||||||
sys.stderr.write("adding default value for itemKeys.title.autocompleteSort = %r\n" % key['autocompleteSort'])
|
sys.stderr.write("adding default value to itemKeys.title.autocompleteSort:\n\t\"autocompleteSort\": %s\n\n" % json.dumps(key['autocompleteSort']))
|
||||||
|
|
||||||
old_formats = getattr(settings, 'CONFIG', {}).get('video', {}).get('formats', [])
|
old_formats = getattr(settings, 'CONFIG', {}).get('video', {}).get('formats', [])
|
||||||
formats = config.get('video', {}).get('formats')
|
formats = config.get('video', {}).get('formats')
|
||||||
|
|
Loading…
Reference in a new issue