mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Revert "Remove get_settings API command"
This reverts commit c39f89356c
.
This commit is contained in:
parent
c35cbb06e2
commit
81dc790a0c
1 changed files with 45 additions and 0 deletions
|
@ -271,6 +271,51 @@ class API2(object):
|
||||||
|
|
||||||
return templog
|
return templog
|
||||||
|
|
||||||
|
def get_settings(self, key=''):
|
||||||
|
""" Gets all settings from the config file.
|
||||||
|
|
||||||
|
```
|
||||||
|
Required parameters:
|
||||||
|
None
|
||||||
|
|
||||||
|
Optional parameters:
|
||||||
|
key (str): Name of a config section to return
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
json:
|
||||||
|
{"General": {"api_enabled": true, ...}
|
||||||
|
"Advanced": {"cache_sizemb": "32", ...},
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
|
||||||
|
interface_dir = os.path.join(plexpy.PROG_DIR, 'data/interfaces/')
|
||||||
|
interface_list = [name for name in os.listdir(interface_dir) if
|
||||||
|
os.path.isdir(os.path.join(interface_dir, name))]
|
||||||
|
|
||||||
|
conf = plexpy.CONFIG._config
|
||||||
|
config = {}
|
||||||
|
|
||||||
|
# Truthify the dict
|
||||||
|
for k, v in conf.items():
|
||||||
|
if isinstance(v, dict):
|
||||||
|
d = {}
|
||||||
|
for kk, vv in v.items():
|
||||||
|
if vv == '0' or vv == '1':
|
||||||
|
d[kk] = bool(vv)
|
||||||
|
else:
|
||||||
|
d[kk] = vv
|
||||||
|
config[k] = d
|
||||||
|
if k == 'General':
|
||||||
|
config[k]['interface'] = interface_dir
|
||||||
|
config[k]['interface_list'] = interface_list
|
||||||
|
|
||||||
|
if key:
|
||||||
|
return config.get(key)
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
def sql(self, query=''):
|
def sql(self, query=''):
|
||||||
""" Query the Tautulli database with raw SQL. Automatically makes a backup of
|
""" Query the Tautulli database with raw SQL. Automatically makes a backup of
|
||||||
the database if the latest backup is older then 24h. `api_sql` must be
|
the database if the latest backup is older then 24h. `api_sql` must be
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue