Skip to content

Commit

Permalink
版本推进至3.0.9
Browse files Browse the repository at this point in the history
+ 自动更新
  • Loading branch information
lunzhiPenxil committed Aug 29, 2022
1 parent 73aca56 commit a5d48dd
Show file tree
Hide file tree
Showing 7 changed files with 333 additions and 201 deletions.
1 change: 1 addition & 0 deletions OlivaDiceMaster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import OlivaDiceCore
from . import main
from . import msgReply
from . import msgReplyModel
from . import msgCustom
from . import msgCustomManager
from . import data
Expand Down
4 changes: 2 additions & 2 deletions OlivaDiceMaster/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"namespace" : "OlivaDiceMaster",
"message_mode" : "old_string",
"info" : "本模块为OlivaDice的大师模块,提供了更高级的骰主管理功能,其中的功能可能不是必须的,但是却是强大的,这些功能包括但不限于更新和安装新的模块。",
"version" : "3.0.8",
"svn" : 9,
"version" : "3.0.9",
"svn" : 10,
"compatible_svn" : 101,
"priority" : 20020,
"support" : [
Expand Down
4 changes: 2 additions & 2 deletions OlivaDiceMaster/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
'''


OlivaDiceMaster_ver = '3.0.8'
OlivaDiceMaster_svn = 9
OlivaDiceMaster_ver = '3.0.9'
OlivaDiceMaster_svn = 10
OlivaDiceMaster_ver_short = '%s(%s)' % (str(OlivaDiceMaster_ver), str(OlivaDiceMaster_svn))

OlivaDiceMaster_oopm_host = 'https://api.dice.center/OlivaDiceVer'
Expand Down
186 changes: 11 additions & 175 deletions OlivaDiceMaster/msgReply.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,182 +167,18 @@ def unity_reply(plugin_event, Proc):
tmp_reast_str = skipSpaceStart(tmp_reast_str)
tmp_reply_str = None
if isMatchWordStart(tmp_reast_str, 'show') or isMatchWordStart(tmp_reast_str, 'update'):
flag_type = None
flag_api_ok = False
if isMatchWordStart(tmp_reast_str, 'show'):
tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'show')
tmp_reast_str = skipSpaceStart(tmp_reast_str)
tmp_reast_str = tmp_reast_str.rstrip(' ')
flag_type = 'show'
elif isMatchWordStart(tmp_reast_str, 'update'):
tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'update')
tmp_reast_str = skipSpaceStart(tmp_reast_str)
tmp_reast_str = tmp_reast_str.rstrip(' ')
flag_type = 'update'
tmp_reply_str_1 = ''
tmp_reply_str_1_list = []
tmp_api_data = None
tmp_api_data_model = None
tmp_model_branch_select = 'main'
if tmp_reast_str == '':
tmp_omodel_select = 'all'
else:
tmp_omodel_select = tmp_reast_str
tmp_api_data = OlivaDiceMaster.webTool.GETHttpJson2Dict(
OlivaDiceMaster.data.OlivaDiceMaster_oopm_host
OlivaDiceMaster.msgReplyModel.replyOOPM_ShowUpdate_command(
plugin_event = plugin_event,
Proc = Proc,
tmp_reast_str = tmp_reast_str,
dictStrCustom = dictStrCustom,
dictTValue = dictTValue,
skipSpaceStart = skipSpaceStart,
getMatchWordStartRight = getMatchWordStartRight,
isMatchWordStart = isMatchWordStart,
replyMsg = replyMsg,
flagReply = True
)
if type(tmp_api_data) == dict:
if 'model' in tmp_api_data:
if type(tmp_api_data['model']) == dict:
tmp_api_data_model = tmp_api_data['model']
flag_api_ok = True
tmp_omodel_list = OlivaDiceCore.crossHook.dictHookList['model']
tmp_omodel_list_select = []
for tmp_omodel_list_this in tmp_omodel_list:
if tmp_omodel_select.lower() in [tmp_omodel_list_this[0].lower(), 'all']:
tmp_omodel_list_select.append(tmp_omodel_list_this)
if flag_api_ok and flag_type != None and len(tmp_omodel_list_select) > 0:
if flag_type == 'show':
for tmp_omodel_list_this in tmp_omodel_list_select:
tmp_omodel_ver_target = 'N/A'
tmp_omodel_ver_compare = '=>'
if tmp_api_data_model != None:
if tmp_omodel_list_this[0] in tmp_api_data_model:
if tmp_model_branch_select in tmp_api_data_model[tmp_omodel_list_this[0]]:
tmp_omodel_ver_target_version = None
tmp_omodel_ver_target_svn = None
if 'version' in tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]:
tmp_omodel_ver_target_version = tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]['version']
if 'svn' in tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]:
tmp_omodel_ver_target_svn = tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]['svn']
if tmp_omodel_ver_target_version != None and tmp_omodel_ver_target_svn != None:
tmp_omodel_ver_target = '%s(%s)' % (
tmp_omodel_ver_target_version,
tmp_omodel_ver_target_svn
)
tmp_oopm_target_path = './plugin/app/%s.opk' % tmp_omodel_list_this[0]
if tmp_omodel_list_this[1] == tmp_omodel_ver_target:
tmp_omodel_ver_compare = '=='
elif tmp_omodel_ver_target == 'N/A':
tmp_omodel_ver_compare = '=×'
if os.path.exists(tmp_oopm_target_path[:-4]):
tmp_omodel_ver_compare = '[SRC]=×'
elif not os.path.exists(tmp_oopm_target_path):
tmp_omodel_ver_compare = '[DEV]=×'
tmp_reply_str_1_list.append(
'[%s]\n%s %s %s' % (
tmp_omodel_list_this[0],
tmp_omodel_list_this[1],
tmp_omodel_ver_compare,
tmp_omodel_ver_target
)
)
tmp_reply_str_1 = '\n'.join(tmp_reply_str_1_list)
dictTValue['tMasterResult'] = tmp_reply_str_1
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterReply'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
elif flag_type == 'update':
flag_done = True
flag_need_done = False
for tmp_omodel_list_this in tmp_omodel_list_select:
tmp_omodel_ver_target = 'N/A'
tmp_omodel_ver_compare = '=>'
flag_have_info = False
if tmp_api_data_model != None:
if tmp_omodel_list_this[0] in tmp_api_data_model:
if tmp_model_branch_select in tmp_api_data_model[tmp_omodel_list_this[0]]:
tmp_omodel_ver_target_version = None
tmp_omodel_ver_target_svn = None
tmp_omodel_ver_target_opk_path = None
tmp_download_tmp_path = '%s/unity/update/%s.opk' % (
OlivaDiceCore.data.dataDirRoot,
tmp_omodel_list_this[0]
)
tmp_oopm_target_path = './plugin/app/%s.opk' % tmp_omodel_list_this[0]
if 'version' in tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]:
tmp_omodel_ver_target_version = tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]['version']
if 'svn' in tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]:
tmp_omodel_ver_target_svn = tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]['svn']
if 'opk_path' in tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]:
tmp_omodel_ver_target_opk_path = tmp_api_data_model[tmp_omodel_list_this[0]][tmp_model_branch_select]['opk_path']
if tmp_omodel_ver_target_version != None and tmp_omodel_ver_target_svn != None and tmp_omodel_ver_target_opk_path != None:
flag_have_info = True
if flag_have_info:
tmp_omodel_ver_target = '%s(%s)' % (
tmp_omodel_ver_target_version,
tmp_omodel_ver_target_svn
)
if tmp_omodel_list_this[1] == tmp_omodel_ver_target:
tmp_omodel_ver_compare = '=='
elif tmp_omodel_ver_target == 'N/A':
tmp_omodel_ver_compare = '=×'
if os.path.exists(tmp_oopm_target_path[:-4]):
tmp_omodel_ver_compare = '[SRC]=×'
elif not os.path.exists(tmp_oopm_target_path):
tmp_omodel_ver_compare = '[DEV]=×'
dictTValue['tMasterOopkNameList'] = '[%s]\n%s %s %s' % (
tmp_omodel_list_this[0],
tmp_omodel_list_this[1],
tmp_omodel_ver_compare,
tmp_omodel_ver_target
)
flag_done_this = True
while tmp_omodel_ver_compare in ['=>']:
flag_download = False
flag_copy = False
try:
flag_download = OlivaDiceMaster.webTool.GETHttpFile(
tmp_omodel_ver_target_opk_path,
tmp_download_tmp_path
)
except:
flag_download = False
if not flag_download:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmDownloadFailed'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
flag_done = False
flag_done_this = False
break
try:
shutil.copyfile(
tmp_download_tmp_path,
tmp_oopm_target_path
)
flag_copy = True
except:
flag_copy = False
if not flag_copy:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmCopyFailed'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
flag_done = False
flag_done_this = False
break
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmUpdate'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
flag_need_done = True
break
if tmp_omodel_ver_compare in ['[SRC]=×']:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmUpdateNotSkipSrc'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
elif tmp_omodel_ver_compare in ['[DEV]=×']:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmUpdateNotSkipDev'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
if not flag_done_this:
break
if flag_done and flag_need_done:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmUpdateAllDone'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
time.sleep(1)
Proc.set_restart()
elif flag_done and not flag_need_done:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmUpdateNotNeed'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
elif flag_api_ok:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmNotMatch'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
else:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strMasterOopmApiFailed'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
elif isMatchWordStart(tmp_reast_str, 'list', fullMatch = True):
tmp_api_data = OlivaDiceMaster.webTool.GETHttpJson2Dict(
OlivaDiceMaster.data.OlivaDiceMaster_oopm_host
Expand Down
Loading

0 comments on commit a5d48dd

Please sign in to comment.