Skip to content

Commit f1f394d

Browse files
committed
Use existing metadata.json instead of app.json
1 parent 6b225f0 commit f1f394d

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

esp32/modules/launcher.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44

55
apps = []
66

7-
def add_app(app,title,category):
7+
def add_app(app,information):
88
global apps
9+
try:
10+
title = information["name"]
11+
except:
12+
title = app
13+
try:
14+
category = information["category"]
15+
except:
16+
category = ""
917
info = {"file":app,"title":title,"category":category}
1018
apps.append(info)
1119

@@ -17,16 +25,11 @@ def populate_apps():
1725
except OSError:
1826
userApps = []
1927
for app in userApps:
20-
[title,category] = read_info(app)
21-
22-
if app=="resources":
23-
category = "hidden"
24-
25-
add_app(app,title,category)
26-
add_app("installer","Installer","system")
27-
add_app("setup","Set nickname","system")
28-
add_app("update","Update apps","system")
29-
add_app("ota_update","Update firmware","system")
28+
add_app(app,read_metadata(app))
29+
add_app("installer",{"name":"Installer", "category":"system"})
30+
add_app("setup",{"name":"Set nickname", "category":"system"})
31+
add_app("update",{"name":"Update apps", "category":"system"})
32+
add_app("ota_update",{"name":"Update firmware", "category":"system"})
3033

3134
# List as shown on screen
3235
currentListTitles = []
@@ -50,20 +53,19 @@ def populate_options():
5053
for title in currentListTitles:
5154
options.add_item(title)
5255

53-
# Read app info
54-
def read_info(app):
56+
# Read app metadata
57+
def read_metadata(app):
5558
try:
5659
install_path = get_install_path()
57-
info_file = "%s/%s/app.json" % (install_path, app)
60+
info_file = "%s/%s/metadata.json" % (install_path, app)
5861
print("Reading "+info_file+"...")
5962
fd = open(info_file)
6063
information = ujson.loads(fd.read())
61-
title = information["title"]
62-
category = information["category"]
63-
return [title,category]
64+
return information
6465
except BaseException as e:
65-
print("[ERROR] Can not read info for app "+app)
66+
print("[ERROR] Can not read metadata for app "+app)
6667
sys.print_exception(e)
68+
information = {"name":app,"description":"","category":"", "author":"","revision":0}
6769
return [app,""]
6870

6971
# Uninstaller

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy