mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Put apps in a list
This commit is contained in:
parent
557a46f0b1
commit
655550ec6b
1 changed files with 16 additions and 8 deletions
|
@ -121,7 +121,10 @@ def app_list(offset=None, limit=None, filter=None, raw=False):
|
|||
|
||||
applists = os.listdir(repo_path)
|
||||
app_dict = {}
|
||||
if raw:
|
||||
list_dict = {}
|
||||
else:
|
||||
list_dict=[]
|
||||
|
||||
if not applists: app_fetchlist()
|
||||
|
||||
|
@ -144,22 +147,27 @@ def app_list(offset=None, limit=None, filter=None, raw=False):
|
|||
installed_txt = 'Yes ('+ str(instance_number) +' times)'
|
||||
elif instance_number == 1:
|
||||
installed_txt = 'Yes'
|
||||
installed = True
|
||||
else:
|
||||
installed_txt = 'No'
|
||||
installed = False
|
||||
|
||||
if raw:
|
||||
app_info['installed'] = installed
|
||||
list_dict[app_id] = app_info
|
||||
else:
|
||||
list_dict[app_id] = [
|
||||
('Name', app_info['manifest']['name']),
|
||||
('Version', app_info['manifest']['version']),
|
||||
('Description', app_info['manifest']['description']),
|
||||
('Installed', installed_txt)
|
||||
]
|
||||
list_dict.append({
|
||||
'ID': app_id,
|
||||
'Name': app_info['manifest']['name'],
|
||||
'Version': app_info['manifest']['version'],
|
||||
'Description': app_info['manifest']['description'],
|
||||
'Installed': installed_txt
|
||||
})
|
||||
i += 1
|
||||
else:
|
||||
break
|
||||
|
||||
if not raw:
|
||||
list_dict = { 'Apps': list_dict }
|
||||
return list_dict
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue