summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ogcp/views.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 2c8f650..456b444 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -2170,16 +2170,17 @@ def action_oglive():
if r.status_code != requests.codes.ok:
return ogserver_error('commands')
- most_used_oglive = max(oglives_set, key=lambda l: len(oglives_set[l]))
- available_oglives = [(oglive.get('directory'), oglive.get('directory'))
- for oglive in r.json()['oglive']
- if oglive.get('directory') == most_used_oglive]
- if not available_oglives:
- available_oglives.append(('default', 'default'))
- available_oglives.extend([(oglive.get('directory'), oglive.get('directory'))
- for oglive in r.json()['oglive']
- if oglive.get('directory') != most_used_oglive])
- form.oglive.choices = list(available_oglives)
+ oglive_list = r.json()['oglive']
+
+ available_oglives = []
+ for oglive in oglive_list:
+ available_oglives.append((oglive.get('directory'), oglive.get('directory')))
+
+ default_idx = int(r.json()['default'])
+ default_oglive_dir = oglive_list[default_idx].get('directory')
+ available_oglives.append(('default', f'ogLive ({default_oglive_dir})'))
+
+ form.oglive.choices = available_oglives
form.ok.render_kw = {'formaction': url_for('action_oglive')}
scopes, clients = get_scopes(set(ips))