优化主页显示

pull/121/head
midoks 3 years ago
parent 4ac1f1e35c
commit 573218cdca
  1. 62
      class/core/plugins_api.py

@ -565,16 +565,15 @@ class plugins_api:
if dirinfo[0:1] == '.': if dirinfo[0:1] == '.':
continue continue
path = self.__plugin_dir + '/' + dirinfo path = self.__plugin_dir + '/' + dirinfo
if os.path.isdir(path): json_file = path + '/info.json'
json_file = path + '/info.json' if os.path.exists(json_file):
if os.path.exists(json_file): try:
try: data = json.loads(mw.readFile(json_file))
data = json.loads(mw.readFile(json_file)) tmp_data = self.makeList(data, sType)
tmp_data = self.makeList(data, sType) for index in range(len(tmp_data)):
for index in range(len(tmp_data)): plugins_info.append(tmp_data[index])
plugins_info.append(tmp_data[index]) except Exception as e:
except Exception as e: print(e)
print(e)
return plugins_info return plugins_info
def getAllListPage(self, sType='0', page=1, pageSize=10): def getAllListPage(self, sType='0', page=1, pageSize=10):
@ -747,28 +746,29 @@ class plugins_api:
indexList = json.loads(mw.readFile(self.__index)) indexList = json.loads(mw.readFile(self.__index))
plist = [] plist = []
app = []
for i in indexList: for i in indexList:
info = i.split('-') tmp = i.split('-')
if not info[0] in app: tmp_len = len(tmp)
app.append(info[0]) plugin_name = tmp[0]
path = self.__plugin_dir + '/' + info[0] plugin_ver = tmp[1]
if os.path.isdir(path): if tmp_len > 2:
json_file = path + '/info.json' tmpArr = tmp[0:tmp_len - 1]
if os.path.exists(json_file): plugin_name = '-'.join(tmpArr)
try: plugin_ver = tmp[tmp_len - 1]
content = mw.readFile(json_file)
if content: json_file = self.__plugin_dir + '/' + plugin_name + '/info.json'
data = json.loads(content) if os.path.exists(json_file):
tmp_data = self.makeList(data) content = mw.readFile(json_file)
for index in range(len(tmp_data)): try:
if tmp_data[index]['versions'] == info[1] or info[1] in tmp_data[index]['versions']: data = json.loads(content)
tmp_data[index]['display'] = True data = self.makeList(data)
plist.append(tmp_data[index]) for index in range(len(data)):
continue if data[index]['versions'] == plugin_ver or plugin_ver in data[index]['versions']:
except Exception as e: data[index]['display'] = True
# raise e plist.append(data[index])
print('getIndexList:', e) continue
except Exception as e:
print('getIndexList:', e)
# 使用gevent模式时,无法使用多进程 # 使用gevent模式时,无法使用多进程
#plist = self.checkStatusMProcess(plist) #plist = self.checkStatusMProcess(plist)

Loading…
Cancel
Save