4
4
5
5
apps = []
6
6
7
- def add_app (app ,title , category ):
7
+ def add_app (app ,information ):
8
8
global apps
9
+ try :
10
+ title = information ["name" ]
11
+ except :
12
+ title = app
13
+ try :
14
+ category = information ["category" ]
15
+ except :
16
+ category = ""
9
17
info = {"file" :app ,"title" :title ,"category" :category }
10
18
apps .append (info )
11
19
@@ -17,16 +25,11 @@ def populate_apps():
17
25
except OSError :
18
26
userApps = []
19
27
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" })
30
33
31
34
# List as shown on screen
32
35
currentListTitles = []
@@ -50,20 +53,19 @@ def populate_options():
50
53
for title in currentListTitles :
51
54
options .add_item (title )
52
55
53
- # Read app info
54
- def read_info (app ):
56
+ # Read app metadata
57
+ def read_metadata (app ):
55
58
try :
56
59
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 )
58
61
print ("Reading " + info_file + "..." )
59
62
fd = open (info_file )
60
63
information = ujson .loads (fd .read ())
61
- title = information ["title" ]
62
- category = information ["category" ]
63
- return [title ,category ]
64
+ return information
64
65
except BaseException as e :
65
- print ("[ERROR] Can not read info for app " + app )
66
+ print ("[ERROR] Can not read metadata for app " + app )
66
67
sys .print_exception (e )
68
+ information = {"name" :app ,"description" :"" ,"category" :"" , "author" :"" ,"revision" :0 }
67
69
return [app ,"" ]
68
70
69
71
# Uninstaller
0 commit comments